public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Jian J Wang <jian.j.wang@intel.com>, devel@edk2.groups.io
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Subject: Re: [PATCH v3 1/2] CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey
Date: Thu, 16 Jan 2020 10:08:27 +0100	[thread overview]
Message-ID: <b7a93561-13db-ff4e-ef27-030f61d01d74@redhat.com> (raw)
In-Reply-To: <20200116061004.636-2-jian.j.wang@intel.com>

Hi Jian,

On 01/16/20 07:10, Jian J Wang wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1792
> 
> HmacXxxInit() is supposed to be initialize user supplied buffer as HMAC
> context, as well as user supplied key. Currently it has no real use cases.
> 
> Due to BZ1792, the user has no way to get correct size of context buffer
> after it's fixed, and then cannot make use of HmacXxxInit to initialize
> it.
> 
> So it's decided to replace it with HmacXxxSetKey to keep the functionality
> of supplying a key to HMAC, but drop all other initialization works. The
> user can still get HMAC context via HmacXxxNew interface, which hides the
> details about the context.
> 
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> ---
>  CryptoPkg/Include/Library/BaseCryptLib.h      | 94 ++++++-------------
>  .../Library/BaseCryptLib/Hmac/CryptHmacMd5.c  | 27 ++----
>  .../BaseCryptLib/Hmac/CryptHmacMd5Null.c      |  8 +-
>  .../Library/BaseCryptLib/Hmac/CryptHmacSha1.c | 27 ++----
>  .../BaseCryptLib/Hmac/CryptHmacSha1Null.c     |  8 +-
>  .../BaseCryptLib/Hmac/CryptHmacSha256.c       | 27 ++----
>  .../BaseCryptLib/Hmac/CryptHmacSha256Null.c   |  8 +-
>  .../BaseCryptLibNull/Hmac/CryptHmacMd5Null.c  |  8 +-
>  .../BaseCryptLibNull/Hmac/CryptHmacSha1Null.c |  8 +-
>  .../Hmac/CryptHmacSha256Null.c                |  8 +-
>  10 files changed, 84 insertions(+), 139 deletions(-)
> 
> diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h
> index 8fe303a0b3..c5803ea673 100644
> --- a/CryptoPkg/Include/Library/BaseCryptLib.h
> +++ b/CryptoPkg/Include/Library/BaseCryptLib.h

[...]

> @@ -1175,23 +1175,6 @@ HmacMd5Final (
>    OUT     UINT8  *HmacValue
>    );
>  
> -/**
> -  Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations.
> -  (NOTE: This API is deprecated.
> -         Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.)
> -
> -  If this interface is not supported, then return zero.
> -
> -  @return  The size, in bytes, of the context buffer required for HMAC-SHA1 operations.
> -  @retval  0   This interface is not supported.
> -
> -**/
> -UINTN
> -EFIAPI
> -HmacSha1GetContextSize (
> -  VOID
> -  );
> -
>  /**
>    Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
>  

(1) This hunk belongs to patch#2. In other words,
HmacSha1GetContextSize() should not be removed from the lib class header
in patch#1.

[...]

> @@ -1325,23 +1308,6 @@ HmacSha1Final (
>    OUT     UINT8  *HmacValue
>    );
>  
> -/**
> -  Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.
> -  (NOTE: This API is deprecated.
> -         Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)
> -
> -  If this interface is not supported, then return zero.
> -
> -  @return  The size, in bytes, of the context buffer required for HMAC-SHA256 operations.
> -  @retval  0   This interface is not supported.
> -
> -**/
> -UINTN
> -EFIAPI
> -HmacSha256GetContextSize (
> -  VOID
> -  );
> -
>  /**
>    Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
>  

(2) This hunk belongs to patch#2. In other words,
HmacSha256GetContextSize() should not be removed from the lib class
header in patch#1.


With the above two points addressed:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo


  reply	other threads:[~2020-01-16  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16  6:10 [PATCH v3 0/2] Remove deprecated code in BaseCryptLib Wang, Jian J
2020-01-16  6:10 ` [PATCH v3 1/2] CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey Wang, Jian J
2020-01-16  9:08   ` Laszlo Ersek [this message]
2020-01-17  2:19     ` Wang, Jian J
2020-01-16  6:10 ` [PATCH v3 2/2] CryptoPkg/BaseCryptLib: remove HmacXxxGetContextSize interface Wang, Jian J
2020-01-16  9:13   ` Laszlo Ersek
2020-01-19  2:04 ` [edk2-devel] [PATCH v3 0/2] Remove deprecated code in BaseCryptLib Xiaoyu Lu
2020-01-20 16:25   ` Wang, Jian J

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=b7a93561-13db-ff4e-ef27-030f61d01d74@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