From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web12.2506.1579227595228048979 for ; Thu, 16 Jan 2020 18:19:55 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: jian.j.wang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2020 18:19:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,327,1574150400"; d="scan'208";a="226974813" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 16 Jan 2020 18:19:54 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 16 Jan 2020 18:19:46 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 16 Jan 2020 18:19:45 -0800 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.210]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.55]) with mapi id 14.03.0439.000; Fri, 17 Jan 2020 10:19:44 +0800 From: "Wang, Jian J" To: Laszlo Ersek , "devel@edk2.groups.io" CC: "Lu, XiaoyuX" Subject: Re: [PATCH v3 1/2] CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey Thread-Topic: [PATCH v3 1/2] CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey Thread-Index: AQHVzEyNg1SGknkx5k65rNcmB192K6fuIDhw Date: Fri, 17 Jan 2020 02:19:43 +0000 Message-ID: References: <20200116061004.636-1-jian.j.wang@intel.com> <20200116061004.636-2-jian.j.wang@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDA3MTA4ODUtMDIwOC00MzYzLWFjMTYtMGI5MWJkNjBkMzQ1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS0xLdFhvSGhhS2J2MHhpZ3VyNEFpblhQcHRpV3g3UldWRUNMSjM4aXZmSWRHN1hvT0ZLV1BkQXVMa2ZjeHA3WiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jian.j.wang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo, Thanks for catching the problem. I'll fix them before push. Regards, Jian > -----Original Message----- > From: Laszlo Ersek > Sent: Thursday, January 16, 2020 5:08 PM > To: Wang, Jian J ; devel@edk2.groups.io > Cc: Lu, XiaoyuX > Subject: Re: [PATCH v3 1/2] CryptoPkg/BaseCryptLib: replace HmacXxxInit A= PI > with HmacXxxSetKey >=20 > Hi Jian, >=20 > On 01/16/20 07:10, Jian J Wang wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1792 > > > > HmacXxxInit() is supposed to be initialize user supplied buffer as HMAC > > context, as well as user supplied key. Currently it has no real use cas= es. > > > > Due to BZ1792, the user has no way to get correct size of context buffe= r > > 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 functional= ity > > of supplying a key to HMAC, but drop all other initialization works. Th= e > > user can still get HMAC context via HmacXxxNew interface, which hides t= he > > details about the context. > > > > Cc: Xiaoyu Lu > > Cc: Laszlo Ersek > > Signed-off-by: Jian J Wang > > --- > > 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 >=20 > [...] >=20 > > @@ -1175,23 +1175,6 @@ HmacMd5Final ( > > OUT UINT8 *HmacValue > > ); > > > > -/** > > - Retrieves the size, in bytes, of the context buffer required for HMA= C-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-S= HA1 > use. > > >=20 > (1) This hunk belongs to patch#2. In other words, > HmacSha1GetContextSize() should not be removed from the lib class header > in patch#1. >=20 > [...] >=20 > > @@ -1325,23 +1308,6 @@ HmacSha1Final ( > > OUT UINT8 *HmacValue > > ); > > > > -/** > > - Retrieves the size, in bytes, of the context buffer required for HMA= C-SHA256 > operations. > > - (NOTE: This API is deprecated. > > - Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Contex= t > 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. > > >=20 > (2) This hunk belongs to patch#2. In other words, > HmacSha256GetContextSize() should not be removed from the lib class > header in patch#1. >=20 >=20 > With the above two points addressed: >=20 > Reviewed-by: Laszlo Ersek >=20 > Thanks! > Laszlo