From nobody Mon May 6 22:25:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43975+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43975+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563490417; cv=none; d=zoho.com; s=zohoarc; b=UnD/724YyOdCUtmD9ww216v+iM4je1j85sJq5k+JXuzTvfKlwIWAglKgz+oZzhz30b62Lw86S8KE1elemRuifxUB6yMazc75f88VSd5x0S8eZxz3sMm2vjytkN5AynAt0SHu1sePPkL5DGq1dMpEvaZ4e/CVD2qJdVGDQZr1e80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563490417; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=045tU4cAdcJl4mjUvqKphhfavIDaD97SVutuX63PxhI=; b=Q8KhPA54HM14glOkJFSCUA5UGmvD4XS0Q++uHiGwmLGdTb0atQVNw3J7lOC8PpYovAJ231SaREcrGCpj6ahgphB44z+l7Y+wytVTBSkK/BrsEh+v98QShZiwBDe2LbkrBwru9oM7GPf3j+m1bYDn6sNpj93Lmk1CKk+aTU5MPj0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43975+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563490417734666.7754848375306; Thu, 18 Jul 2019 15:53:37 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Thu, 18 Jul 2019 15:53:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 15:53:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,279,1559545200"; d="scan'208";a="195783049" X-Received: from ejuergex-mobl1.amr.corp.intel.com ([10.255.82.10]) by fmsmga002.fm.intel.com with ESMTP; 18 Jul 2019 15:53:35 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Chao Zhang , Jiewen Yao , Jian Wang Subject: [edk2-devel] [PATCH v7 1/4] SecurityPkg: introduce the SM3 digest algorithm Date: Thu, 18 Jul 2019 15:53:23 -0700 Message-Id: <20190718225326.40839-2-imran.desai@intel.com> In-Reply-To: <20190718225326.40839-1-imran.desai@intel.com> References: <20190718225326.40839-1-imran.desai@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,imran.desai@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563490417; bh=xWuajI4UOGhTRk7mD5PnXHxD0jMgUbcJ7zgh+kLxQUk=; h=Cc:Date:From:Reply-To:Subject:To; b=B+YIkhiuUXSZooN5iVLFX9VbYJtwlozbVOafUot7WmJdQIktiso9Jr8WwBIeC/r1jFU mCmR/TLMfd639adk3ktloP3iD03rDLkNsatv7zAOa6voYb3mysjkDqAFQwk+hd+OmNQWu wQOGaR5OTdQIA2zuUNaLLeSyjZ3bngq3oTo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch add SM3 algorithm in the hashinstance library. Delta in v7: 1. Dropped 95a040cff from v6 to address https://edk2.groups.io/g/devel/topi= c/ 32454898?p=3D,,,20,0,0,0::Created,,sm3,20,2,0,32454898,ct=3D1&ct=3D1 2. Relocated SM3 GUID definition from MdePkg to SecurityPkg in 9728b54f4 Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai --- SecurityPkg/Include/Library/HashLib.h | 4 + SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c | 150 ++++++= ++++++++++++++ SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf | 41 ++++++ SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni | 15 ++ SecurityPkg/SecurityPkg.dsc | 3 + 5 files changed, 213 insertions(+) diff --git a/SecurityPkg/Include/Library/HashLib.h b/SecurityPkg/Include/Li= brary/HashLib.h index 63f08398788b..6ad960ad70ee 100644 --- a/SecurityPkg/Include/Library/HashLib.h +++ b/SecurityPkg/Include/Library/HashLib.h @@ -137,6 +137,10 @@ EFI_STATUS #define HASH_ALGORITHM_SHA256_GUID EFI_HASH_ALGORITHM_SHA256_GUID #define HASH_ALGORITHM_SHA384_GUID EFI_HASH_ALGORITHM_SHA384_GUID #define HASH_ALGORITHM_SHA512_GUID EFI_HASH_ALGORITHM_SHA512_GUID +#define HASH_ALGORITHM_SM3_256_GUID \ + { \ + 0x251C7818, 0x0DBF, 0xE619, { 0x7F, 0xC2, 0xD6, 0xAC, 0x43, 0x42, 0x7D= , 0xA3 } \ + } =20 typedef struct { EFI_GUID HashGuid; diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c b/= SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c new file mode 100644 index 000000000000..8fd95162118a --- /dev/null +++ b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c @@ -0,0 +1,150 @@ +/** @file + BaseCrypto SM3 hash instance library. + It can be registered to BaseCrypto router, to serve as hash engine. + + Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + The function set SM3 to digest list. + + @param DigestList digest list + @param Sm3Digest SM3 digest +**/ +VOID +Tpm2SetSm3ToDigestList ( + IN TPML_DIGEST_VALUES *DigestList, + IN UINT8 *Sm3Digest + ) +{ + DigestList->count =3D 1; + DigestList->digests[0].hashAlg =3D TPM_ALG_SM3_256; + CopyMem ( + DigestList->digests[0].digest.sm3_256, + Sm3Digest, + SM3_256_DIGEST_SIZE + ); +} + +/** + Start hash sequence. + + @param HashHandle Hash handle. + + @retval EFI_SUCCESS Hash sequence start and HandleHandle return= ed. + @retval EFI_OUT_OF_RESOURCES No enough resource to start hash. +**/ +EFI_STATUS +EFIAPI +Sm3HashInit ( + OUT HASH_HANDLE *HashHandle + ) +{ + VOID *Sm3Ctx; + UINTN CtxSize; + + CtxSize =3D Sm3GetContextSize (); + Sm3Ctx =3D AllocatePool (CtxSize); + if (Sm3Ctx =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Sm3Init (Sm3Ctx); + + *HashHandle =3D (HASH_HANDLE)Sm3Ctx; + + return EFI_SUCCESS; +} + +/** + Update hash sequence data. + + @param HashHandle Hash handle. + @param DataToHash Data to be hashed. + @param DataToHashLen Data size. + + @retval EFI_SUCCESS Hash sequence updated. +**/ +EFI_STATUS +EFIAPI +Sm3HashUpdate ( + IN HASH_HANDLE HashHandle, + IN VOID *DataToHash, + IN UINTN DataToHashLen + ) +{ + VOID *Sm3Ctx; + + Sm3Ctx =3D (VOID *)HashHandle; + Sm3Update (Sm3Ctx, DataToHash, DataToHashLen); + + return EFI_SUCCESS; +} + +/** + Complete hash sequence complete. + + @param HashHandle Hash handle. + @param DigestList Digest list. + + @retval EFI_SUCCESS Hash sequence complete and DigestList is returne= d. +**/ +EFI_STATUS +EFIAPI +Sm3HashFinal ( + IN HASH_HANDLE HashHandle, + OUT TPML_DIGEST_VALUES *DigestList + ) +{ + UINT8 Digest[SM3_256_DIGEST_SIZE]; + VOID *Sm3Ctx; + + Sm3Ctx =3D (VOID *)HashHandle; + Sm3Final (Sm3Ctx, Digest); + + FreePool (Sm3Ctx); + + Tpm2SetSm3ToDigestList (DigestList, Digest); + + return EFI_SUCCESS; +} + +HASH_INTERFACE mSm3InternalHashInstance =3D { + HASH_ALGORITHM_SM3_256_GUID, + Sm3HashInit, + Sm3HashUpdate, + Sm3HashFinal, +}; + +/** + The function register SM3 instance. + + @retval EFI_SUCCESS SM3 instance is registered, or system dose not sup= port register SM3 instance +**/ +EFI_STATUS +EFIAPI +HashInstanceLibSm3Constructor ( + VOID + ) +{ + EFI_STATUS Status; + + Status =3D RegisterHashInterfaceLib (&mSm3InternalHashInstance); + if ((Status =3D=3D EFI_SUCCESS) || (Status =3D=3D EFI_UNSUPPORTED)) { + // + // Unsupported means platform policy does not need this instance enabl= ed. + // + return EFI_SUCCESS; + } + return Status; +} diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf = b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf new file mode 100644 index 000000000000..781164d74ea0 --- /dev/null +++ b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf @@ -0,0 +1,41 @@ +## @file +# Provides BaseCrypto SM3 hash service +# +# This library can be registered to BaseCrypto router, to serve as hash e= ngine. +# +# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D HashInstanceLibSm3 + MODULE_UNI_FILE =3D HashInstanceLibSm3.uni + FILE_GUID =3D C5865D5D-9ACE-39FB-DC7C-0511891D40F9 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D NULL + CONSTRUCTOR =3D HashInstanceLibSm3Constructor + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + HashInstanceLibSm3.c + +[Packages] + MdePkg/MdePkg.dec + SecurityPkg/SecurityPkg.dec + CryptoPkg/CryptoPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + Tpm2CommandLib + MemoryAllocationLib + BaseCryptLib diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni = b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni new file mode 100644 index 000000000000..07a5c53d9915 --- /dev/null +++ b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni @@ -0,0 +1,15 @@ +// /** @file +// Provides BaseCrypto SM3 hash service +// +// This library can be registered to BaseCrypto router, to serve as hash e= ngine. +// +// Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Provides BaseCryp= to SM3 hash service" + +#string STR_MODULE_DESCRIPTION #language en-US "This library can = be registered to BaseCrypto router, to serve as hash engine." + diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc index 60f3b0110eb7..aef2ac3a208d 100644 --- a/SecurityPkg/SecurityPkg.dsc +++ b/SecurityPkg/SecurityPkg.dsc @@ -226,6 +226,7 @@ [Components.IA32, Components.X64] SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf =20 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf { @@ -240,6 +241,7 @@ [Components.IA32, Components.X64] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } =20 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf { @@ -250,6 +252,7 @@ [Components.IA32, Components.X64] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf } SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf { --=20 2.17.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43975): https://edk2.groups.io/g/devel/message/43975 Mute This Topic: https://groups.io/mt/32520441/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 22:25:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43976+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43976+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563490417; cv=none; d=zoho.com; s=zohoarc; b=LlOhCzAh3wYFcmgDDHPFiwqVwvChzEBRFc30YB9vscDatRUbUmExjXBEJ+LijuLfhlEWZr6D1E8NKluo/ZAvObfr30tUz8hsqljMHnRGSEKjdWy2Xo6k56nnljxdlZBMzA5WxeolQgZvmNxP8DEetMUUURV8KEj3L/gu8Hn+0k8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563490417; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=wZ7xtVwPTmnDHb5+vNuhXwHERE8K2r6gWbT6Try94Yg=; b=N4dgiBdVcjNHQQ7RqyFYrQWOetmIyq5cByJcWPuIlgOjqIE3oAUvvqn9+BY0rPAn5Honk6rgWaWUhZ2fvLROHU+gvsa90Es04NyuwvgyOgmmk+o6egsXJa61Wy22I6y8Qj8dW10jm0g7Bz7D7uvpEOdSdjPKwBHFS0WHrRSeHUA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43976+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563490417796975.9832393880326; Thu, 18 Jul 2019 15:53:37 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Thu, 18 Jul 2019 15:53:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 15:53:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,279,1559545200"; d="scan'208";a="195783053" X-Received: from ejuergex-mobl1.amr.corp.intel.com ([10.255.82.10]) by fmsmga002.fm.intel.com with ESMTP; 18 Jul 2019 15:53:35 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Chao Zhang , Jiewen Yao , Jian Wang Subject: [edk2-devel] [PATCH v7 2/4] SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm Date: Thu, 18 Jul 2019 15:53:24 -0700 Message-Id: <20190718225326.40839-3-imran.desai@intel.com> In-Reply-To: <20190718225326.40839-1-imran.desai@intel.com> References: <20190718225326.40839-1-imran.desai@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,imran.desai@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563490417; bh=xiNPjM0HJNtQGR7z9F+FvoRZZ2MKXxPeXdmYBlnChWw=; h=Cc:Date:From:Reply-To:Subject:To; b=pq70U7YzTDLsiQKVMZUtC4BrLb/P2rLll2VTmw+drLoKjDssCkRYzS7lLApujZVCZ3G IdHQBjlsyp1NoVmjjqikQn2rkLWEibBnIP7k3tW72MRPimkKtDkhUfaSZ/K8obSbAz4hk Dfu/oeubakEcnRqPEyrKMrpcvrI5FPXe7EE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch adds SM3 as an available digest algorithm to crypto router. Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai Reviewed-by: Jian J Wang --- SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCommon.= c | 1 + 1 file changed, 1 insertion(+) diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR= outerCommon.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryp= toRouterCommon.c index 7f3bdab53066..aec874a9e072 100644 --- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCo= mmon.c +++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCo= mmon.c @@ -25,6 +25,7 @@ TPM2_HASH_MASK mTpm2HashMask[] =3D { {HASH_ALGORITHM_SHA256_GUID, HASH_ALG_SHA256}, {HASH_ALGORITHM_SHA384_GUID, HASH_ALG_SHA384}, {HASH_ALGORITHM_SHA512_GUID, HASH_ALG_SHA512}, + {HASH_ALGORITHM_SM3_256_GUID, HASH_ALG_SM3_256}, }; =20 /** --=20 2.17.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43976): https://edk2.groups.io/g/devel/message/43976 Mute This Topic: https://groups.io/mt/32520442/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 22:25:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43977+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43977+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563490417; cv=none; d=zoho.com; s=zohoarc; b=nM+rY0OX1+J/5d52oW60PLIZ2oiYZMLTEX2CXTSnSonJvyEwVSWSmZAg4qWdFTckuQSUOurVjgjqqGQws0Tig22YyJ9iFcRdyN6ARGfFSFEOoXCOtxCPKSnrCHQKXRsM+iA4jtwQPf4QurNxOFv5I8mjyeW0fwp1S8ebAa71MSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563490417; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=KfwigxUTAzndFlmzM0XuYdhy7HSKQe/3uafAkXKBm90=; b=Pj49JWMRWsC4sfLp6vsQRNOmt7e23I82lSbTkfl5xQBR7ZCNNqtqFL5LLKPP88YVECyRVRW77S9ErrFlTTLOeu110Ieh1fDkPTQDjalbU2wyF1cqPxEAZzSxEwEwOyW5gYwZKe6DPA06f9ETj9hW5QcUYyG8wN8CaglXm86EC6U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43977+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563490417877376.0985691868394; Thu, 18 Jul 2019 15:53:37 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Thu, 18 Jul 2019 15:53:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 15:53:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,279,1559545200"; d="scan'208";a="195783057" X-Received: from ejuergex-mobl1.amr.corp.intel.com ([10.255.82.10]) by fmsmga002.fm.intel.com with ESMTP; 18 Jul 2019 15:53:36 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Chao Zhang , Jiewen Yao , Jian Wang Subject: [edk2-devel] [PATCH v7 3/4] SecurityPkg: set SM3 bit in TPM 2.0 hash mask by default Date: Thu, 18 Jul 2019 15:53:25 -0700 Message-Id: <20190718225326.40839-4-imran.desai@intel.com> In-Reply-To: <20190718225326.40839-1-imran.desai@intel.com> References: <20190718225326.40839-1-imran.desai@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,imran.desai@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563490417; bh=Caj23I9eBZ4+v8jm7J2einTttaeINdSiFez5Ilh2R2M=; h=Cc:Date:From:Reply-To:Subject:To; b=awzDmUV7P571HAb/jhvfISjfSrsd6jleLC70Xmj7WkDZr45xMo24BEHKxfbTe6CShAk +cnLG4Xqy7N7zDnV46y4O9/61x4MfFTYgshJGK7PTOZeoeUsXU9jJ4eJ5ru0nH/ZXUnW5 vM65UPdeaCNaWTJ2FPbVEUpSbKSimbjmyDI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch sets SM3 bit in TPM2.0 hash mask by default. Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai Reviewed-by: Jian J Wang --- SecurityPkg/SecurityPkg.dec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec index b9c04a3d13d1..d2f6a6fd1293 100644 --- a/SecurityPkg/SecurityPkg.dec +++ b/SecurityPkg/SecurityPkg.dec @@ -453,9 +453,10 @@ [PcdsDynamic, PcdsDynamicEx] # BIT1 - SHA256.
# BIT2 - SHA384.
# BIT3 - SHA512.
+ # BIT4 - SM3_256.
# @Prompt Hash mask for TPM 2.0 - # @ValidRange 0x80000001 | 0x00000000 - 0x0000000F - gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x0000000F|UINT32|0x000100= 10 + # @ValidRange 0x80000001 | 0x00000000 - 0x0000001F + gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x0000001F|UINT32|0x000100= 10 =20 ## This PCD indicated final BIOS supported Hash mask. # Bios may choose to register a subset of PcdTpm2HashMask. --=20 2.17.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43977): https://edk2.groups.io/g/devel/message/43977 Mute This Topic: https://groups.io/mt/32520443/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 22:25:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43978+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43978+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563490418; cv=none; d=zoho.com; s=zohoarc; b=QxEwoYteecBfUeT41m+vjXcNwnEAGFH8kLD8k56j0HLRu9QBccBvkcZrNQG4Jw64PL4d1AANzOQmLe3TvHyifwbS93CyI10szWZ43+tKL0RaH3Gd9zCEEvNncUf3X+LNIz8bvfjDjB/0zCwHphVCnhZsrpYmFnEK5K+5T0xps5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563490418; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=vXtut3vxDnyFCPZoFjIrfJT1TaziPibkvre981LrS9s=; b=EOYiwWkojAycUnRCrU7eGqONz6bFhAV1JVaSv9dyfhSVarE3FVUyEC6xoLNCn0q7uq+S25U7QoZUe7LubD1C411I06F133u/IbZcZSh+sQFbPfguoOT6G0ZWgH/v3loUCyVzJbEGnGkS9iNVrC1VdbtceF03WqKdgln/7oMRO4U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43978+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563490418274937.085927731642; Thu, 18 Jul 2019 15:53:38 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Thu, 18 Jul 2019 15:53:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 15:53:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,279,1559545200"; d="scan'208";a="195783060" X-Received: from ejuergex-mobl1.amr.corp.intel.com ([10.255.82.10]) by fmsmga002.fm.intel.com with ESMTP; 18 Jul 2019 15:53:36 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Berger Subject: [edk2-devel] [PATCH v7 4/4] OvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe Date: Thu, 18 Jul 2019 15:53:26 -0700 Message-Id: <20190718225326.40839-5-imran.desai@intel.com> In-Reply-To: <20190718225326.40839-1-imran.desai@intel.com> References: <20190718225326.40839-1-imran.desai@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,imran.desai@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563490417; bh=iQyifoa00NHBC58QmaiVNYvnuLRtmZOIYRVIoEOnd8M=; h=Cc:Date:From:Reply-To:Subject:To; b=lTDI+/I+vCnjZaM2Cav5fnNqxn5Zw0zCEIlpb4RemHK20XPQHXZbX1sY6aPwmAnEtCk 55s6UDIE2yFZ57dBOIqQoNywrifgy9/p1T9YBSyljQ2zv8U9mFB0zxb21xUmVGYYcyHJh wNo1RGJ8b1nS6U31zzpCOFIqHCt1gUcmgk8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch links SM3 support into Tcg2Pei and Tcg2Dxe. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Marc-Andr\ufffd\ufffd Lureau Cc: Stefan Berger Signed-off-by: Imran Desai Reviewed-by: Laszlo Ersek --- OvmfPkg/OvmfPkgIa32.dsc | 2 ++ OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++ OvmfPkg/OvmfPkgX64.dsc | 2 ++ 3 files changed, 6 insertions(+) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 5bbf87540ab9..6ab730018694 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -625,6 +625,7 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !if $(TPM2_CONFIG_ENABLE) =3D=3D TRUE SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf @@ -906,5 +907,6 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !endif diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 5015e92b6eea..f163aa267132 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -637,6 +637,7 @@ [Components.IA32] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !if $(TPM2_CONFIG_ENABLE) =3D=3D TRUE SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf @@ -920,5 +921,6 @@ [Components.X64] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !endif diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index dda8dac18441..fa98f16a3fb3 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -636,6 +636,7 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !if $(TPM2_CONFIG_ENABLE) =3D=3D TRUE SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf @@ -918,5 +919,6 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !endif --=20 2.17.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43978): https://edk2.groups.io/g/devel/message/43978 Mute This Topic: https://groups.io/mt/32520444/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-