CryptoPkg/BaseCryptLib: avoid using SHA256()

In openssl 3.0 SHA256() 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 <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Gerd Hoffmann 2023-02-14 03:19:56 +08:00 committed by Mikhail Krichanov
parent 6ead224873
commit fb3153ce7c

View File

@ -202,6 +202,8 @@ Sha256HashAll (
OUT UINT8 *HashValue OUT UINT8 *HashValue
) )
{ {
SHA256_CTX Context;
// //
// Check input parameters. // Check input parameters.
// //
@ -216,9 +218,17 @@ Sha256HashAll (
// //
// OpenSSL SHA-256 Hash Computation. // OpenSSL SHA-256 Hash Computation.
// //
if (SHA256 (Data, DataSize, HashValue) == NULL) { if (!SHA256_Init (&Context)) {
return FALSE; return FALSE;
} else { }
if (!SHA256_Update (&Context, Data, DataSize)) {
return FALSE;
}
if (!SHA256_Final (HashValue, &Context)) {
return FALSE;
}
return TRUE; return TRUE;
} }
}