[edk2-devel] [PATCH 1/4] CryptoPkg/BaseCryptLib: avoid using SHA1()
Gerd Hoffmann
kraxel at redhat.com
Mon Feb 13 19:19:55 UTC 2023
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 at redhat.com>
---
CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c
index 1e071ce2b325..cfe1f4bc44c9 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c
@@ -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
--
2.39.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100127): https://edk2.groups.io/g/devel/message/100127
Mute This Topic: https://groups.io/mt/96943603/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