From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.4556.1579148798500654634 for ; Wed, 15 Jan 2020 20:26:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=x11YjTcd; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: amol.n.sukerkar@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2020 20:26:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,324,1574150400"; d="scan'208";a="305730316" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 15 Jan 2020 20:26:37 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jan 2020 20:26:32 -0800 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jan 2020 20:26:32 -0800 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.55) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jan 2020 20:26:19 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HYkVqk4Cn6cRfzg6pu9rD1q/1zaFa3OFhemtgwovnoJMUHQ+XMypodRAKZf3yK81zrvfM0iaqLUScM1YsSbrGTSCqS9/yOdwPCy9SX2/zpuF91SwGoxqe8aqzFdAqd6om/Fq8J0xy4PbvwNPcf5gc/jG2xoC8ZbaY8rmAkeEyy6asSU0wItEmbmeKiH3uFW2HRUwOWEvmG+5K9k476FZZ839cSnYKQNXit2GmNRmTSqJKMMOuGeT/hDwqv56EDOphyOcxXMCw6cH1C+p3pBzr5ZiBwoGJ/w1PTtfOH30W54pC0u7hpdD9GrtzM8JRwtkNKfNbbymk49EFeXtWXwauQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LTNnx44rdxTNEqbLIvtK1bz6h7ZZLcGnrVlUSg5gw2Q=; b=f6U1ZqhlJUZDVDcja1Bda9YwGwcG+OLmRtyp1z6zAVuGu76j4e18mUTWaUgXwyw2LdCi7/M8Wu3QewomrLv+dD0KuOWzciSAR0hMIGclRk4Kb6alWPkbsEPnX/xHKKyJScLqLNXULcqUNb4lkaOUkZwU8ovlJVVQVf8yzpFVizn+3ubmjOVKJK6xwwHDGMsjKSwxc9J19Aj6T5WSMW1ZRXuS1LKET0xqoCBYEp440Fw+BClKJjvE0imTcCOrKlqbXzukwIewzP8aKmz5Kj/lD4qmPHj4UAdp6nMwHoVnKbgXF2/zwEdllkg0Zy8o7XM1th/aWKkWGYYfNcsrg+Wc9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LTNnx44rdxTNEqbLIvtK1bz6h7ZZLcGnrVlUSg5gw2Q=; b=x11YjTcdsXZ0oON9rgoniuukmmzNk1pOwzISqyfE/UtaxM1u0D5O5r3ItDtVLCZ01XUvHnE8+0ekBMalBHyPFBl3WWdOgHNS8FbDyKoRURIYzXD2xl1A9KAHgQMSVsF+E0NW4zHi6936GvQDnXTZwyLVKhQ/lY9JPatcBAU+xEg= Received: from MWHPR11MB0064.namprd11.prod.outlook.com (10.164.192.146) by MWHPR11MB1760.namprd11.prod.outlook.com (10.175.53.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Thu, 16 Jan 2020 04:25:46 +0000 Received: from MWHPR11MB0064.namprd11.prod.outlook.com ([fe80::6921:1be9:8a98:4549]) by MWHPR11MB0064.namprd11.prod.outlook.com ([fe80::6921:1be9:8a98:4549%5]) with mapi id 15.20.2623.018; Thu, 16 Jan 2020 04:25:46 +0000 From: "Sukerkar, Amol N" To: "Wang, Jian J" , "Kinney, Michael D" , "devel@edk2.groups.io" CC: "Yao, Jiewen" , "Agrawal, Sachin" , "Musti, Srinivas" , "Lakkimsetti, Subash" , "Sukerkar, Amol N" Subject: Re: [PATCH v3 0/1] SecurityPkg/BaseHashLib: Implement Unified Hash Calculation API Thread-Topic: [PATCH v3 0/1] SecurityPkg/BaseHashLib: Implement Unified Hash Calculation API Thread-Index: AQHVy/cvAOJdNme+tUqAppRUJtsJEKfsZRsggAAH+jCAAAmqIIAAFroAgAAkKYA= Date: Thu, 16 Jan 2020 04:25:46 +0000 Message-ID: References: <20200115225730.1330-1-amol.n.sukerkar@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows authentication-results: spf=none (sender IP is ) smtp.mailfrom=amol.n.sukerkar@intel.com; x-originating-ip: [134.134.136.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dea21c2b-67c9-4fbd-4a8d-08d79a3c28a2 x-ms-traffictypediagnostic: MWHPR11MB1760: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 02843AA9E0 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(346002)(376002)(39860400002)(136003)(189003)(199004)(55016002)(26005)(66446008)(66556008)(53546011)(6506007)(186003)(64756008)(66476007)(86362001)(5660300002)(107886003)(52536014)(33656002)(9686003)(66946007)(71200400001)(110136005)(966005)(54906003)(2906002)(81166006)(76116006)(4326008)(15650500001)(81156014)(478600001)(8936002)(8676002)(7696005)(316002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR11MB1760;H:MWHPR11MB0064.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RyOKeIXEEie6AoTAj2XVbnpqyK0KSZNaCKBXT01DwhW2qmAESZtF+eGGM6Trxjht4UE9UVdgQjD9/qdHoBF89x6Wl1w87olYM+xGK7dPN1VOBVg5xYfhY5+cLV8pFR1MKPJpnyZplyppxeo/gReIqZyXECzjcl0WzkM2PVwXb1nvwlSdLYfa86lPXVCwt9hD7AvANCWXIh4T1mbkgQmn+Imv/LE57Alsy2bPzKnTjBjaJTqAl6/hFBT2bPuwlgQAshxyaVa3T5TX4ZSP7TLeArC+YByWjYNPTX4pWsEPt0VtIEuUeXRI93dJkio19a6Atm8fB1hNBwWhlnIR5lO48vVI0Z9QcoAxazwdtNW+jloOxUtZSkyDvlEXzsvwOa0Msl74fH47WghC2a749C2MIJ+tt2kFkpXOl4+Tt1dJ07IX5Wfgjk4KEXiuGvGmvXegWGko6TLwX/0QIngePrzwOm9PN18LZOLwoJziXfv2SiE= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: dea21c2b-67c9-4fbd-4a8d-08d79a3c28a2 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2020 04:25:46.5315 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PfrY9ouIE0KSMd8PNfttqa5oMWN9OaFd3UrF+z8KTr1LEmJxc3nZWqlcQINtsttREls0CikdKnnzaxjP39LWZOcr2hy0BOmPmV0Du1IIJhQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1760 Return-Path: amol.n.sukerkar@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Also, I don't have a definitive way of checking the optimization. I have on= ly been checking size of the FVs. Can you suggest how to? Use of UefiTool d= oes not help or at least, I don't know how to properly use it. Thanks, Amol -----Original Message----- From: Wang, Jian J =20 Sent: Wednesday, January 15, 2020 7:15 PM To: Kinney, Michael D ; Sukerkar, Amol N ; devel@edk2.groups.io Cc: Yao, Jiewen ; Agrawal, Sachin ; Musti, Srinivas ; Lakkimsetti, Subash Subject: RE: [PATCH v3 0/1] SecurityPkg/BaseHashLib: Implement Unified Hash= Calculation API Mike, If I remember correctly, the optimization will be left to the PPI/Protocol = version of BaseCryptLib, which will be merged into edk2 code base from Mu p= roject. Regards, Jian > -----Original Message----- > From: Kinney, Michael D > Sent: Thursday, January 16, 2020 8:56 AM > To: Sukerkar, Amol N ;=20 > devel@edk2.groups.io; Kinney, Michael D > Cc: Yao, Jiewen ; Wang, Jian J=20 > ; Agrawal, Sachin ;=20 > Musti, Srinivas ; Lakkimsetti, Subash=20 > > Subject: RE: [PATCH v3 0/1] SecurityPkg/BaseHashLib: Implement Unified=20 > Hash Calculation API >=20 > Amol, >=20 > Add a PCD to CryptoPkg. >=20 > There are other CryptoPkg extensions I am working on that will also=20 > define a PCD. >=20 > When you build your code and disassemble, are all the hash algorithms=20 > included even through a module only needs one? The design I have in=20 > mind allows unused hash services to always be optimized away. >=20 > Mike >=20 > > -----Original Message----- > > From: Sukerkar, Amol N > > Sent: Wednesday, January 15, 2020 4:48 PM > > To: Kinney, Michael D ;=20 > > devel@edk2.groups.io > > Cc: Yao, Jiewen ; Wang, Jian J=20 > > ; Agrawal, Sachin ;=20 > > Musti, Srinivas ; Lakkimsetti, Subash=20 > > ; Sukerkar, Amol N=20 > > > > Subject: RE: [PATCH v3 0/1] SecurityPkg/BaseHashLib: > > Implement Unified Hash Calculation API > > > > Hi Mike, > > > > This design does not implement any registration. The hashing=20 > > algorithm is selected from the array index specified by=20 > > PcdSystemHashPolicy value, just like switch..case, based on=20 > > recommendation by Jian. Are you referring to the document attached=20 > > to Bugzilla ticket mentioned below? I plan to update it as soon as=20 > > we agree on the final design. Apologies if it was misleading today. > > > > The reason this lib was added to SecurityPkg and not CryptoPkg was=20 > > done because the decision to choose hashing algorithm is based on=20 > > PCD, PcdSystemHashPolicy. > > CryptoPkg only provides API for accessing specific hashing algorithm=20 > > and there is no mechanism to choose, as there is no precedent to=20 > > using a PCD in CryptoPkg and it does not look like that needs to=20 > > change. On the other hand, we actually do have API support in=20 > > SecurityPkg (HashInstanceLib). Our design provides similar API=20 > > support, although, it is much simpler and does not involve=20 > > registration as in HashInstanceLib. Do you still think this lib=20 > > should be implemented in CryptoPkg? If yes, how do you propose the=20 > > user choose the desired hashing mechanism? > > > > Thanks, > > Amol > > > > -----Original Message----- > > From: Kinney, Michael D > > Sent: Wednesday, January 15, 2020 4:52 PM > > To: Sukerkar, Amol N ;=20 > > devel@edk2.groups.io; Kinney, Michael D > > Cc: Yao, Jiewen ; Wang, Jian J=20 > > ; Agrawal, Sachin ;=20 > > Musti, Srinivas ; Lakkimsetti, Subash=20 > > > > Subject: RE: [PATCH v3 0/1] SecurityPkg/BaseHashLib: > > Implement Unified Hash Calculation API > > > > Amol, > > > > I still think the handle based registration is too complex for this=20 > > feature. > > > > I recommend a simpler lib design and add it to CryptoPkg instead of=20 > > SecurityPkg. Providing a different method to access the hashing=20 > > functions in BaseCryptLib is not a Security feature, it is a Crypto=20 > > feature. > > > > Thanks, > > > > Mike > > > > > > > -----Original Message----- > > > From: Sukerkar, Amol N > > > Sent: Wednesday, January 15, 2020 2:57 PM > > > To: devel@edk2.groups.io > > > Cc: Kinney, Michael D ; > > Yao, Jiewen > > > ; Wang, Jian J > > ; Agrawal, > > > Sachin ; Musti, Srinivas=20 > > > ; Lakkimsetti, Subash=20 > > > > > > Subject: [PATCH v3 0/1] SecurityPkg/BaseHashLib: > > > Implement Unified Hash Calculation API > > > > > > Currently, the UEFI drivers using the SHA/SM3 hashing > > algorithms use > > > hard-coded API to calculate the hash, for instance, > > sha_256(...), etc. > > > Since SHA384 and/or > > > SM3_256 are being increasingly adopted for > > robustness, it becomes > > > cumbersome to modify each driver that calls into hash > > calculating API. > > > > > > To better achieve this, we are proposing a Unified > > API, which can be > > > used by UEFI drivers, that provides the drivers with > > flexibility to > > > use the desired hashing algorithm based on the > > required robnustness. > > > > > > Alternatively, the design document is also attached > > to Bugzilla, > > > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2151. > > > > > > Sukerkar, Amol N (1): > > > SecurityPkg/BaseHashLib: Implement Unified Hash > > Calculation API > > > > > > SecurityPkg/Library/BaseHashLib/BaseHashLibCommon.c > > | > > > 151 ++++++++++++++++++++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibDxe.c > > | > > > 100 +++++++++++++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibPei.c > > | > > > 103 +++++++++++++ > > > SecurityPkg/Include/Library/BaseHashLib.h > > | > > > 85 +++++++++++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibCommon.h > > | > > > 141 ++++++++++++++++++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibDxe.inf > > | > > > 46 ++++++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibDxe.uni > > | > > > 17 +++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibPei.inf > > | > > > 51 +++++++ > > > SecurityPkg/Library/BaseHashLib/BaseHashLibPei.uni > > | > > > 16 +++ > > > SecurityPkg/SecurityPkg.dec > > | > > > 23 ++- > > > SecurityPkg/SecurityPkg.dsc > > | > > > 10 +- > > > SecurityPkg/SecurityPkg.uni > > | > > > 15 +- > > > 12 files changed, 755 insertions(+), 3 deletions(-) > > create mode > > > 100644 > > SecurityPkg/Library/BaseHashLib/BaseHashLibCommon.c > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibDxe.c > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibPei.c > > > create mode 100644 > > > SecurityPkg/Include/Library/BaseHashLib.h > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibCommon.h > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibDxe.inf > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibDxe.uni > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibPei.inf > > > create mode 100644 > > > SecurityPkg/Library/BaseHashLib/BaseHashLibPei.uni > > > > > > -- > > > 2.16.2.windows.1 > > > >