From 5a6455e04cc2d1eab8124a7b7f5465c2f475c59c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 14 Feb 2023 03:19:57 +0800 Subject: [PATCH] CryptoPkg/BaseCryptLib: avoid using SHA384() In openssl 3.0 SHA384() goes through the provider logic, requiring a huge amount of openssl code. The individual functions do not, so use them instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Jiewen Yao --- .../Library/BaseCryptLib/Hash/CryptSha512.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c index 59e5708465..2ab7188035 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; - } else { - return TRUE; } + + if (!SHA384_Update (&Context, Data, DataSize)) { + return FALSE; + } + + if (!SHA384_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } /**