public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"kraxel@redhat.com" <kraxel@redhat.com>
Cc: Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/4] CryptoPkg/BaseCryptLib: avoid using SHA1()
Date: Mon, 13 Feb 2023 22:14:05 +0000	[thread overview]
Message-ID: <CO1PR11MB4929CDE89A4E2FD8B376A90BD2DD9@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230213191958.913689-2-kraxel@redhat.com>

Hi Gerd,

This is an interesting pattern for the openssl 3.0 size issues.

It looks like the 1.1.1 APIs we are currently using are still available.
Are those legacy APIs guaranteed to be supported under openssl 3.0?

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann
> Sent: Monday, February 13, 2023 11:20 AM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen <osteffen@redhat.com>; Pawel Polawski <ppolawsk@redhat.com>; Gerd Hoffmann <kraxel@redhat.com>
> Subject: [edk2-devel] [PATCH 1/4] CryptoPkg/BaseCryptLib: avoid using SHA1()
> 
> 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@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
> 
> 
> 
> 
> 


  reply	other threads:[~2023-02-13 22:14 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   ` Michael D Kinney [this message]
2023-02-14  2:23     ` [edk2-devel] " Yao, Jiewen
2023-02-13 19:19 ` [PATCH 2/4] CryptoPkg/BaseCryptLib: avoid using SHA256() Gerd Hoffmann
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=CO1PR11MB4929CDE89A4E2FD8B376A90BD2DD9@CO1PR11MB4929.namprd11.prod.outlook.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