From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web09.527.1580339389645427235 for ; Wed, 29 Jan 2020 15:09:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=myCFZaDC; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: amol.n.sukerkar@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 15:09:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,379,1574150400"; d="scan'208";a="429838419" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by fmsmga006.fm.intel.com with ESMTP; 29 Jan 2020 15:09:49 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX109.amr.corp.intel.com (10.22.240.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 29 Jan 2020 15:09:48 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 29 Jan 2020 15:09:48 -0800 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 29 Jan 2020 15:09:48 -0800 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.52) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 29 Jan 2020 15:09:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QuDxlDldeGlXpYDAfuuqNAqKsbUg2KC9iVsu20nS6Wv45lwjwttqqmu36YNNEB/WSs+Nkw/M9zrKYhuc4tXhaLugx9n4xrNIiXR1z8igNHEWWyXGGiGMWqqEQokrRrC9DVv/KUnsWCUYzKFxDrRjJ989NIyROS3Bsz6CSNnP1VCxU6hXNKNtwWT46BytvQqiEvA1kMBmqWDE3N5C4qqBK4ViASgM8CjcPgs5s5+Aj75zAQuuqEJeDk5XjZdvx4WFFi1Q1zspte+v/3532ni8NdzKhbA61DgsIQdpP/BYHMmf5tFkKGTCSBSlBa6I5rOi/ja6Na0T2xAlpPLLhu/AYw== 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=KJlPUndKyxqzJz2BBy8A0230EnaLUcDZquJAvhrbEyY=; b=a+/1L2TA+fhvRhO30MimS3gzCkCWlyGajwbzlAEFHs3pWml3+A5gqSp/vyKIdXY3EQI/wJ8SLL+tBxmidulzS+ahzzD14BNGUZMgWJXOEeViwpooiJJRRieBwx4UvYGgnq8ZlwGdKn9Bv98tqaHW06wb/4zgJmdVdOJu9Hf0weQqWdJRoDPWY9EsUh/Emzp1cGMq+nyvnqFF2GtoEWqkSPLNWba3GsmFIJoiyWjlNhAZL0yQ1F5Qc6Yf1kW9yz4jWAFW7s9tQiBEt6odQdCPG0nS1VmYORifTijaNm3LVRbb0xLBZ8tH6IWOT9zk55oEKxjy56cRi2tKlVlXXXXI0g== 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=KJlPUndKyxqzJz2BBy8A0230EnaLUcDZquJAvhrbEyY=; b=myCFZaDCls0iyKnnaNoFEKTDthNXLgLtbVvhpYFptxViriYb3hNCYmzgsc/9mXiixT7+VAU3yE8GB9ZF6F/9m9Yqw14kxqcuCvnkWDFuLA5nL2Ytwho9cf0+NQaBu73+WJDHFAVqGYs6Hjga+beWLkXGikyBpyp4mMs7f+070kE= Received: from MWHPR11MB0064.namprd11.prod.outlook.com (10.164.192.146) by MWHPR11MB1567.namprd11.prod.outlook.com (10.172.54.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.20; Wed, 29 Jan 2020 23:09:44 +0000 Received: from MWHPR11MB0064.namprd11.prod.outlook.com ([fe80::2d9d:54b4:ffdc:5f6d]) by MWHPR11MB0064.namprd11.prod.outlook.com ([fe80::2d9d:54b4:ffdc:5f6d%3]) with mapi id 15.20.2665.026; Wed, 29 Jan 2020 23:09:44 +0000 From: "Sukerkar, Amol N" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: "Yao, Jiewen" , "Wang, Jian J" , "Agrawal, Sachin" , "Musti, Srinivas" , "Lakkimsetti, Subash" , "Sukerkar, Amol N" Subject: Re: [PATCH v6 0/2] CryptoPkg/HashApiLib: Implement Unified Hash Calculation API Thread-Topic: [PATCH v6 0/2] CryptoPkg/HashApiLib: Implement Unified Hash Calculation API Thread-Index: AQHV1gVRMo3qASUng0qpuAl+3tncSKgB5WFwgABfN6A= Date: Wed, 29 Jan 2020 23:09:44 +0000 Message-ID: References: <20200128180340.15136-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: [192.55.52.202] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9b6c9127-37b8-4bf9-228b-08d7a5105455 x-ms-traffictypediagnostic: MWHPR11MB1567: 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: 02973C87BC x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(189003)(199004)(107886003)(71200400001)(86362001)(33656002)(8676002)(186003)(81166006)(52536014)(26005)(81156014)(55016002)(8936002)(54906003)(7696005)(9686003)(6506007)(2906002)(53546011)(66556008)(66476007)(76116006)(64756008)(66946007)(5660300002)(66446008)(498600001)(966005)(110136005)(4326008);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR11MB1567;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: 1YzeWFNGkdwMSZmamPLPcifaj6k89kb+6NkwzZz4yrzxyslzLnTWf82Of2/eXw1w9YaAUZvADbMyWmYZU+sbzeCHr6l0UHBc8nt8cZf3iUrRT80Ea0CcpCjTDz+/ZDfroX86Cr3cbXFd4XZw/C6SkYm9M0A0ZQzSgh4XwgB5zUKExXIiuW8ix42/pwPnH0VmA+4KaI867zsmV/n2LFo0jjZgq+cFS/LVmH+tKYIniNBiE9w/yZKOu39FRvOXIcOB7sCMP4leRwz08Jy3ewJAY/7LudWYQzHTAEC2+FVwS4YGIsh7XxsjLpNdjykRxj2XeDvYFv3fgXp4f/yTBEyKMHnR3T+5Y9OG7D9HK/Vo2/kG+3FEeySYqzvxWeNHfUmDjD3yTIDTpwRmDRFanMcNZ3EtsBQYbST6y+L9gQFB1NLLusgg483w4WhGHxLE32hGh0fKq9uwvH70VP3gNV+gFaFDF61E/pWXJPhK+oS3h1i145bF42ROdxeiRqBb+o5pKZ0enZ0FeCE+BcbqUKL9Yw== x-ms-exchange-antispam-messagedata: eddTeipbvXgdjyxTya6x7vr8hV81/TVCY6iLzU75NVXYHWe9NJaT3R8dh0SbkO4AGTbsrqNhO0BhGZlZO54+f6IQj6hNxPJktBlZg0JVvUg1GdwvUWlkIVSwFy0KuEeqheaL9H3A5aHE6JaZpG+24w== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9b6c9127-37b8-4bf9-228b-08d7a5105455 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2020 23:09:44.7360 (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: BQwejlUVtypeHCqcbEERMhSfbUTRByCStxP1h0nZpQRHG90dXdMtzN4PKLj3t86CQA1ppTJ7gxhhfHnRvvBb0A1z2Br8rGMi4pcFFCe42y4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1567 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 Hi Mike, Question about point 4. Could you help me clear the confusion? 4) The name of the HashApiLib instance should be "BaseHashApiLib" and the should be in the CryptoPkg/Library/BaseHashApiLib directory with files BashHashApiLib.inf, BaseHashApiLib.c, and BaseHashApiLib.uni. BASE_NAME in BaseHashApiLib.iunf should also be BaseHashApiLib. Perhaps I am not very clear but it appears you are contradicting your earli= er feedback: I have received feedback before against the use of the term "Base" in the n= ame of a library class. It causes confusion because the term "Base" usuall= y applies to the library implementation to describe the module type compati= bility of the lib instance. Take BaseCryptLib class as an example. There = are instances of this library that are specific to PEI, DXE, SMM, and Runti= me. If we look at the entire edk2 repo, there are only 3 lib classes that s= tart with the term "Base": BaseLib - OK. Single instance of type BASE. BaseMemoryLib - Confusing. BASE, PEI, DXE versions BaseCryptLib - Confusing. PEI, DXE, SMM, RT versions I also see the BaseHashLib service names use "HashApi". In order to address both the use of the term "Base" and The inconsistency b= etween the lib class name and the lib service names, I recommend the lib cl= ass be changed from "BaseHashLib" to "HashApiLib" along with a few other na= me changes to scope defines and types to the HashApiLib: BaseHashLib -> HashApiLib HASH_HANDLE -> HASH_API_CONTEXT HASH_INVALID -> HASH_API_ALGORITHM_INVALID HASH_MD4 -> HASH_API_ALGORITHM_MD4 HASH_MD5 -> HASH_API_ALGORITHM_MD5 HASH_SHA1 -> HASH_API_ALGORITHM_SHA1 HASH_SHA256 -> HASH_API_ALGORITHM_SHA256 HASH_SHA384 -> HASH_API_ALGORITHM_SHA384 HASH_SHA512 -> HASH_API_ALGORITHM_SHA512 HASH_SM3_256 -> HASH_API_ALGORITHM_SM3_256 HASH_MAX -> Remove. Not used. Some file name a directory names changes would also be required to follow t= his same pattern. Thanks, Amol -----Original Message----- From: Kinney, Michael D =20 Sent: Wednesday, January 29, 2020 1:10 PM To: Sukerkar, Amol N ; devel@edk2.groups.io; Kin= ney, Michael D Cc: Yao, Jiewen ; Wang, Jian J ; Agrawal, Sachin ; Musti, Srinivas ; Lakkimsetti, Subash Subject: RE: [PATCH v6 0/2] CryptoPkg/HashApiLib: Implement Unified Hash Ca= lculation API Amol, 1) Typo in CryptoPkg.dec. Should be Crypto Package, not Security package. [Guids] ## Security package token space guid. 2) CryptoPkg.dec/uni. I see the default value for PcdHashApiLibPolicy is 0x04. This is documented to be SHA256. The DEC/UNI file descriptions of this PCD should state that the default policy is SHA256. This makes it clear to platform developers that maintain DSC files what the default policy is. 3) CryptoPkg.dsc: The same HashApiLib instance is used for all module types so a single mapping can be moved to [LibraryClasses] section and the DSC file and removed from the [LibraryClass.common.] section= s. 4) The name of the HashApiLib instance should be "BaseHashApiLib" and the should be in the CryptoPkg/Library/BaseHashApiLib directory with files BashHashApiLib.inf, BaseHashApiLib.c, and BaseHashApiLib.uni. BASE_NAME in BaseHashApiLib.iunf should also be BaseHashApiLib. 5) In order to be consistent with other EDK II context typedefs, I recommen= d typedef VOID *HASH_API_CONTEXT; Also update APIs to use HashContext instead of *HashContext. 6) HashApiDuplicate() - The NewHashContext parameter should be type HASH_API_CONTEXT. 7) HashApiLib.inf - I think you can remove MdeModulePkg.dec from [Packages] Thanks, Mike > -----Original Message----- > From: Sukerkar, Amol N > Sent: Tuesday, January 28, 2020 10:04 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D ; Yao, Jiewen=20 > ; Wang, Jian J ; Agrawal,=20 > Sachin ; Musti, Srinivas=20 > ; Lakkimsetti, Subash=20 > > Subject: [PATCH v6 0/2] CryptoPkg/HashApiLib: Implement Unified Hash=20 > Calculation API >=20 > Currently, the UEFI drivers using the SHA/SM3 hashing algorithms use=20 > hard-coded API to calculate the hash, for instance, sha_256(...), etc.=20 > Since SHA384 and/or > SM3_256 are being increasingly adopted for robustness, it becomes=20 > cumbersome to modify each driver that calls into hash calculating API. >=20 > To better achieve this, we are proposing a Unified API, which can be=20 > used by UEFI drivers, that provides the drivers with flexibility to=20 > use the desired hashing algorithm based on the required robnustness. >=20 > Alternatively, the design document is also attached to Bugzilla,=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2151. >=20 > Sukerkar, Amol N (2): > CryptoPkg: Add CryptoPkg Token Space GUID > CryptoPkg/HashApiLib: Implement Unified Hash Calculation API >=20 > CryptoPkg/Library/HashApiLib/HashApiLib.c | 333 > ++++++++++++++++++++ > CryptoPkg/CryptoPkg.dec | 27 +- > CryptoPkg/CryptoPkg.dsc | 7 +- > CryptoPkg/CryptoPkg.uni | 17 + > CryptoPkg/Include/Library/HashApiLib.h | 122 > +++++++ > CryptoPkg/Library/HashApiLib/HashApiLib.inf | 45 +++ =20 > CryptoPkg/Library/HashApiLib/HashApiLib.uni | 17 + > 7 files changed, 566 insertions(+), 2 deletions(-) create mode=20 > 100644 CryptoPkg/Library/HashApiLib/HashApiLib.c > create mode 100644 > CryptoPkg/Include/Library/HashApiLib.h > create mode 100644 > CryptoPkg/Library/HashApiLib/HashApiLib.inf > create mode 100644 > CryptoPkg/Library/HashApiLib/HashApiLib.uni >=20 > -- > 2.16.2.windows.1