diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c index 1e071ce2b3..cfe1f4bc44 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c @@ -204,6 +204,8 @@ Sha1HashAll ( OUT UINT8 *HashValue ) { + SHA_CTX Context; + // // Check input parameters. // @@ -218,11 +220,19 @@ Sha1HashAll ( // // OpenSSL SHA-1 Hash Computation. // - if (SHA1 (Data, DataSize, HashValue) == NULL) { + if (!SHA1_Init (&Context)) { return FALSE; - } else { - return TRUE; } + + if (!SHA1_Update (&Context, Data, DataSize)) { + return FALSE; + } + + if (!SHA1_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } #endif