From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Oliver Steffen <osteffen@redhat.com>,
Pawel Polawski <ppolawsk@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH 2/4] CryptoPkg/BaseCryptLib: avoid using SHA256()
Date: Mon, 13 Feb 2023 20:19:56 +0100 [thread overview]
Message-ID: <20230213191958.913689-3-kraxel@redhat.com> (raw)
In-Reply-To: <20230213191958.913689-1-kraxel@redhat.com>
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>
---
.../Library/BaseCryptLib/Hash/CryptSha256.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c
index f105e6e57708..4d7d92812c4d 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;
}
--
2.39.1
next prev parent reply other threads:[~2023-02-13 19:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 19:19 [PATCH 0/4] CryptoPkg/BaseCryptLib: avoid certain openssl library calls Gerd Hoffmann
2023-02-13 19:19 ` [PATCH 1/4] CryptoPkg/BaseCryptLib: avoid using SHA1() Gerd Hoffmann
2023-02-13 22:14 ` [edk2-devel] " Michael D Kinney
2023-02-14 2:23 ` Yao, Jiewen
2023-02-13 19:19 ` Gerd Hoffmann [this message]
2023-02-13 19:19 ` [PATCH 3/4] CryptoPkg/BaseCryptLib: avoid using SHA384() Gerd Hoffmann
2023-02-13 19:19 ` [PATCH 4/4] CryptoPkg/BaseCryptLib: avoid using SHA512() Gerd Hoffmann
2023-02-14 1:17 ` [edk2-devel] [PATCH 0/4] CryptoPkg/BaseCryptLib: avoid certain openssl library calls Yao, Jiewen
2023-02-14 10:13 ` Gerd Hoffmann
2023-02-15 8:15 ` Yao, Jiewen
2023-03-07 6:54 ` Gerd Hoffmann
2023-03-07 7:59 ` Yao, Jiewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213191958.913689-3-kraxel@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox