[edk2-devel] [PATCH 4/4] CryptoPkg/BaseCryptLib: avoid using SHA512()
Gerd Hoffmann
kraxel at redhat.com
Mon Feb 13 19:19:58 UTC 2023
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 <kraxel at redhat.com>
---
.../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 2ab7188035e8..dee8f35c41ad 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
@@ -430,6 +430,8 @@ Sha512HashAll (
OUT UINT8 *HashValue
)
{
+ SHA512_CTX Context;
+
//
// Check input parameters.
//
@@ -444,9 +446,17 @@ Sha512HashAll (
//
// OpenSSL SHA-512 Hash Computation.
//
- if (SHA512 (Data, DataSize, HashValue) == NULL) {
+ if (!SHA512_Init (&Context)) {
return FALSE;
- } else {
- return TRUE;
}
+
+ if (!SHA512_Update (&Context, Data, DataSize)) {
+ return FALSE;
+ }
+
+ if (!SHA512_Final (HashValue, &Context)) {
+ return FALSE;
+ }
+
+ return TRUE;
}
--
2.39.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100126): https://edk2.groups.io/g/devel/message/100126
Mute This Topic: https://groups.io/mt/96943602/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list