summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library/BaseCryptLib
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-02-14 03:19:57 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-07 09:59:50 +0000
commit5a6455e04cc2d1eab8124a7b7f5465c2f475c59c (patch)
treee8002a14ccf5ecc198f07a640ad01913024314a6 /CryptoPkg/Library/BaseCryptLib
parent7fc183df71b0aa2106139677258227662ce1f004 (diff)
downloadedk2-5a6455e04cc2d1eab8124a7b7f5465c2f475c59c.tar.gz
edk2-5a6455e04cc2d1eab8124a7b7f5465c2f475c59c.tar.bz2
edk2-5a6455e04cc2d1eab8124a7b7f5465c2f475c59c.zip
CryptoPkg/BaseCryptLib: avoid using SHA384()
In openssl 3.0 SHA384() 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/BaseCryptLib')
-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 59e5708465..2ab7188035 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
@@ -204,6 +204,8 @@ Sha384HashAll (
OUT UINT8 *HashValue
)
{
+ SHA512_CTX Context;
+
//
// Check input parameters.
//
@@ -218,11 +220,19 @@ Sha384HashAll (
//
// OpenSSL SHA-384 Hash Computation.
//
- if (SHA384 (Data, DataSize, HashValue) == NULL) {
+ if (!SHA384_Init (&Context)) {
+ return FALSE;
+ }
+
+ if (!SHA384_Update (&Context, Data, DataSize)) {
return FALSE;
- } else {
- return TRUE;
}
+
+ if (!SHA384_Final (HashValue, &Context)) {
+ return FALSE;
+ }
+
+ return TRUE;
}
/**