summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-02-14 03:19:56 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-07 09:59:50 +0000
commit7fc183df71b0aa2106139677258227662ce1f004 (patch)
tree4cccb0e689bd13687eb1c57b541abf45d3b4cd67 /CryptoPkg/Library
parent437ed29f278687140c29e00f1a0e4204f25e2d33 (diff)
downloadedk2-7fc183df71b0aa2106139677258227662ce1f004.tar.gz
edk2-7fc183df71b0aa2106139677258227662ce1f004.tar.bz2
edk2-7fc183df71b0aa2106139677258227662ce1f004.zip
CryptoPkg/BaseCryptLib: avoid using SHA256()
In openssl 3.0 SHA256() 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/CryptSha256.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c
index f105e6e577..4d7d92812c 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c
@@ -202,6 +202,8 @@ Sha256HashAll (
OUT UINT8 *HashValue
)
{
+ SHA256_CTX Context;
+
//
// Check input parameters.
//
@@ -216,9 +218,17 @@ Sha256HashAll (
//
// OpenSSL SHA-256 Hash Computation.
//
- if (SHA256 (Data, DataSize, HashValue) == NULL) {
+ if (!SHA256_Init (&Context)) {
return FALSE;
- } else {
- return TRUE;
}
+
+ if (!SHA256_Update (&Context, Data, DataSize)) {
+ return FALSE;
+ }
+
+ if (!SHA256_Final (HashValue, &Context)) {
+ return FALSE;
+ }
+
+ return TRUE;
}