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 mergify[bot]
parent 437ed29f27
commit 7fc183df71
1 changed files with 13 additions and 3 deletions

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 {
return TRUE;
} }
if (!SHA256_Update (&Context, Data, DataSize)) {
return FALSE;
}
if (!SHA256_Final (HashValue, &Context)) {
return FALSE;
}
return TRUE;
} }