CryptoPkg/BaseCryptLib: avoid using SHA1()

In openssl 3.0 SHA1() 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:55 +08:00 committed by mergify[bot]
parent c7c2599759
commit 437ed29f27
1 changed files with 13 additions and 3 deletions

View File

@ -204,6 +204,8 @@ Sha1HashAll (
OUT UINT8 *HashValue
)
{
SHA_CTX Context;
//
// Check input parameters.
//
@ -218,11 +220,19 @@ Sha1HashAll (
//
// OpenSSL SHA-1 Hash Computation.
//
if (SHA1 (Data, DataSize, HashValue) == NULL) {
if (!SHA1_Init (&Context)) {
return FALSE;
} else {
return TRUE;
}
if (!SHA1_Update (&Context, Data, DataSize)) {
return FALSE;
}
if (!SHA1_Final (HashValue, &Context)) {
return FALSE;
}
return TRUE;
}
#endif