Skip to content

Commit

Permalink
CryptoPkg/BaseCryptLib: avoid using SHA512()
Browse files Browse the repository at this point in the history
In openssl 3.0 SHA512() 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 <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
  • Loading branch information
kraxel authored and mergify[bot] committed Mar 7, 2023
1 parent 5a6455e commit f335d91
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ Sha512HashAll (
OUT UINT8 *HashValue
)
{
SHA512_CTX Context;

//
// Check input parameters.
//
Expand All @@ -444,9 +446,17 @@ Sha512HashAll (
//
// OpenSSL SHA-512 Hash Computation.
//
if (SHA512 (Data, DataSize, HashValue) == NULL) {
if (!SHA512_Init (&Context)) {
return FALSE;
}

if (!SHA512_Update (&Context, Data, DataSize)) {
return FALSE;
} else {
return TRUE;
}

if (!SHA512_Final (HashValue, &Context)) {
return FALSE;
}

return TRUE;
}

0 comments on commit f335d91

Please sign in to comment.