summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-02-14 03:19:58 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-07 09:59:50 +0000
commitf335d91a3bfe47de702af564eb3661ab8906d1be (patch)
tree8d6891a4ef9803d54c3bf57206ddfed9dfebd8f6 /CryptoPkg/Library
parent5a6455e04cc2d1eab8124a7b7f5465c2f475c59c (diff)
downloadedk2-f335d91a3bfe47de702af564eb3661ab8906d1be.tar.gz
edk2-f335d91a3bfe47de702af564eb3661ab8906d1be.tar.bz2
edk2-f335d91a3bfe47de702af564eb3661ab8906d1be.zip
CryptoPkg/BaseCryptLib: avoid using SHA512()
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@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'CryptoPkg/Library')
-rw-r--r--CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
index 2ab7188035..dee8f35c41 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;
+ }
+
+ if (!SHA512_Update (&Context, Data, DataSize)) {
return FALSE;
- } else {
- return TRUE;
}
+
+ if (!SHA512_Final (HashValue, &Context)) {
+ return FALSE;
+ }
+
+ return TRUE;
}