diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c index 59e570846588..2ab7188035e8 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c @@ -204,6 +204,8 @@ Sha384HashAll ( OUT UINT8 *HashValue ) { + SHA512_CTX Context; + // // Check input parameters. // @@ -218,11 +220,19 @@ Sha384HashAll ( // // OpenSSL SHA-384 Hash Computation. // - if (SHA384 (Data, DataSize, HashValue) == NULL) { + if (!SHA384_Init (&Context)) { + return FALSE; + } + + if (!SHA384_Update (&Context, Data, DataSize)) { return FALSE; - } else { - return TRUE; } + + if (!SHA384_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } /**