From nobody Sun May 5 16:47:02 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+43683+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+43683+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562978826; cv=none; d=zoho.com; s=zohoarc; b=gdeEwpjuj0m4ZnM68EX5keuP/NFB2I5Fxn9irPN9aWwq+Fqaakws3OlCqOtFhSuv0Z3rzpdlEPCHucz/Eyg1/dQqtnnMyCs61xzPETpwBHn6gGpIiG75sBkp0wC+khvkpbA95Hsj73T5NxCe2h25c9lJ5yiqj1XPOo7MkCnvQ+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562978826; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=fzcZIekJSPZeGnZPL1N9dJQ1u7elykZMKCXVXqTFYmU=; b=SILbas9aXn77HgI7GOWSYk/qOHDLtT/wOygCLzRFru5nK4/NARC54Rtve4EMAIY2etfvh5POgMz/ZV4nZW2k+yrefmqW4wHrZlHSo3165QMZIRAurnTIIm6OMVqPHEkyTPw8bPdH4bdYcuyx6fMrpIb3/CkVq8B1AUFWPBrbPI8= 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+43683+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 1562978825913690.7388250092027; Fri, 12 Jul 2019 17:47:05 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 12 Jul 2019 17:47:04 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2019 17:47:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,484,1557212400"; d="scan'208";a="160544038" X-Received: from mariengu-mobl.amr.corp.intel.com ([10.252.129.197]) by orsmga008.jf.intel.com with ESMTP; 12 Jul 2019 17:47:03 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH v6 1/5] MdePkg/Protocol/Hash: introduce GUID for SM3 digest algorithm Date: Fri, 12 Jul 2019 17:46:57 -0700 Message-Id: <20190713004701.78253-2-imran.desai@intel.com> In-Reply-To: <20190713004701.78253-1-imran.desai@intel.com> References: <20190713004701.78253-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=1562978825; bh=IJtiLDNMEa5tt8wyAJ1+vQ0y0enzhhyKDnZvw1LgUpE=; h=Cc:Date:From:Reply-To:Subject:To; b=Gyl3RqbBwHln5zI4U1E5QEg9egiCgbKSLC/3qYMJBUfMJWgN2aIDsKw4n9UvR8InIme A2iApgOLoaUDTWUJP9zIps6chfZ1jfFuZvWkvi9S15iZd8FZoYxKEOLwAiqNLO59bVNsv XiJJW8D/F7KRZ3KLBYywJACK8c28NkIMRyY= 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 GUID for SM3 digest algorithm. Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Imran Desai --- MdePkg/Include/Protocol/Hash.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MdePkg/Include/Protocol/Hash.h b/MdePkg/Include/Protocol/Hash.h index 931d7916ef1e..8abf1a4fa305 100644 --- a/MdePkg/Include/Protocol/Hash.h +++ b/MdePkg/Include/Protocol/Hash.h @@ -48,6 +48,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent 0xcaa4381e, 0x750c, 0x4770, {0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21,= 0x30 } \ } =20 +#define EFI_HASH_ALGORITHM_SM3_256_GUID \ + { \ + 0x251C7818, 0x0DBF, 0xE619, { 0x7F, 0xC2, 0xD6, 0xAC, 0x43, 0x42, 0x7D= , 0xA3 } \ + } + #define EFI_HASH_ALGORTIHM_MD5_GUID \ { \ 0xaf7c79c, 0x65b5, 0x4319, {0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, = 0xd7 } \ --=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 (#43683): https://edk2.groups.io/g/devel/message/43683 Mute This Topic: https://groups.io/mt/32454898/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 Sun May 5 16:47:02 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+43684+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+43684+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562978826; cv=none; d=zoho.com; s=zohoarc; b=gPn079FCRAA+mTudKMVS3Q07f7BUwMpLa/0rNdAevPeqNU9IyrDL6b0X1xDg+VJpnWJyssO8Nk6yOpCub6XpSp3NKfvlBv3lSTinIGaPWOKXLcWNU7HpKo5QM6cvfoGwPZ+bB5lcptKMpdpq7wUnoAbmCFFlWMlofqUnrBJf8JQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562978826; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=JNzV8mkR34ZLdvoKwl/aHYhEwZqAWxI887Y4B6lXUTQ=; b=DKIeKnkWeO9sS+jBDLgrUcka4DzYHq1CWiA3aw3+rAae+/iYDye2F6+I1LohI3vWdzS4otURTvq9o6Ayugp0VTsVC2C1dred4rjkSnEuq+wm4WgWhnhVYIJAImWMD28PTuuJe2yO4bvV62hVi9pkH7008bVyu/Os2kLZPJ/bgz0= 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+43684+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 1562978826712318.88784781272227; Fri, 12 Jul 2019 17:47:06 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 12 Jul 2019 17:47:05 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2019 17:47:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,484,1557212400"; d="scan'208";a="160544043" X-Received: from mariengu-mobl.amr.corp.intel.com ([10.252.129.197]) by orsmga008.jf.intel.com with ESMTP; 12 Jul 2019 17:47:03 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Chao Zhang , Jiewen Yao , Jian Wang Subject: [edk2-devel] [PATCH v6 2/5] SecurityPkg: introduce the SM3 digest algorithm Date: Fri, 12 Jul 2019 17:46:58 -0700 Message-Id: <20190713004701.78253-3-imran.desai@intel.com> In-Reply-To: <20190713004701.78253-1-imran.desai@intel.com> References: <20190713004701.78253-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=1562978826; bh=48ghfhhFIXngpNUjYrpT2pLLOT2WTl+YPwMUXU8yMg0=; h=Cc:Date:From:Reply-To:Subject:To; b=nPfjvOFaVJxplVMIz3aRn5Wtypmoaj+Jut9TS2Sd7fS5P/v+pSrDMUug3uyy0DFYuPs 5xTRL6YwyqQSwhg/M8hOA9sCLyEmd/eWQgo6BFm+1LNKhONNtZ3/Kq5FAVFGNrDqm/oq6 bwdfOPMrJQuYmqyw2GdGkh+LnH3XOwMwLTs= 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. Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai Reviewed-by: Jiewen Yao Reviewed-by: Jian J Wang --- SecurityPkg/Include/Library/HashLib.h | 1 + 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, 210 insertions(+) diff --git a/SecurityPkg/Include/Library/HashLib.h b/SecurityPkg/Include/Li= brary/HashLib.h index 63f08398788b..a5b433d824a4 100644 --- a/SecurityPkg/Include/Library/HashLib.h +++ b/SecurityPkg/Include/Library/HashLib.h @@ -137,6 +137,7 @@ 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 EFI_HASH_ALGORITHM_SM3_256_GUID =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 (#43684): https://edk2.groups.io/g/devel/message/43684 Mute This Topic: https://groups.io/mt/32454902/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 Sun May 5 16:47:02 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+43685+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+43685+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562978827; cv=none; d=zoho.com; s=zohoarc; b=IYuFxzluWN7a6cbQ0ITl38Zk9naz2Vcj9rw7f5egZKy1wqKmiWMmDiPD7OboctcjGb0+PcUeiGDafo4l2XEj5aV8qw3rZwQr+0+XTvtG55kQiyY0Tx7/o9i4Lr/VfIgDNBviLzbE15Nhnc8MaftpddLt+gYAmatSe9dPt3Dxwow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562978827; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=OrB3EC+HIxZcMhaHAluYzu6OaEc8EtSoZ43on1EcZgU=; b=TQLT0Ba+udVE4L9YBvhFOVUH2MGDL5U3m4Xg/Jp4PgKAFBhAtgnGSSF9ZeUkE9rjJJAxssdbuwdWroPqcMtR/QndBvLNF+4qw8oFxHkTiosBxtmQZr9kXlJ3FXj3THTlGAcknd8bK4sT0bMbYuGBrARVYkampoEC33hQAEeZXjs= 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+43685+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 156297882794010.3243921362847; Fri, 12 Jul 2019 17:47:07 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 12 Jul 2019 17:47:05 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2019 17:47:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,484,1557212400"; d="scan'208";a="160544047" X-Received: from mariengu-mobl.amr.corp.intel.com ([10.252.129.197]) by orsmga008.jf.intel.com with ESMTP; 12 Jul 2019 17:47:04 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Chao Zhang , Jiewen Yao , Jian Wang Subject: [edk2-devel] [PATCH v6 3/5] SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm Date: Fri, 12 Jul 2019 17:46:59 -0700 Message-Id: <20190713004701.78253-4-imran.desai@intel.com> In-Reply-To: <20190713004701.78253-1-imran.desai@intel.com> References: <20190713004701.78253-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=1562978827; bh=J3fVQSX3fhjg/zEU4uHrDxs1YoGb9aU+MJ+gwmJbFP8=; h=Cc:Date:From:Reply-To:Subject:To; b=SP4gflPHOfOCKsTdHWZJBTR1rN+QllnxPYBA3+YJ9TUBTWFerWMAowaxFL+4X4mnXYT Re2BOnbNHsLGmK4VDwEHFOBcqZO25gUwaULc1xqucpiHSg/QOtsHz7Vy1tL65DqF3Wve+ vY9bHAa5hdBiZZjH7UjG5LAGQn4uNAdBtMM= 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 (#43685): https://edk2.groups.io/g/devel/message/43685 Mute This Topic: https://groups.io/mt/32454903/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 Sun May 5 16:47:02 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+43686+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+43686+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562978828; cv=none; d=zoho.com; s=zohoarc; b=gXDTEgQQzvkjmebATRgbdRDKqTzbLUNI13yiGL1+7+1DdLo202LEYQsfV/NCaXfZN3kZlO/gZTVc+xGtZMiZK6li5FngdDDv9aQ5SNdN1LCyk+5vU9xoamIT0qrGkbbyVG/w1H1am++lpAd/p91T4gkFCmV1m4GIujtW9chOzHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562978828; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Adk/InsExw7y+AZAQ2RwoN++p3unqYepoi+JEe1E42s=; b=Kkrz1NucBoMKBpPYsFwhvjqsF8ofD9PHnrHnBOd/rA1gVexnvY9pOpZF7yNqUgxaqdfk4ysMQLyOfD9KlZUsM/b0wSAoex27LFRbZByGkGOEcQTEzQ8XeYwqcu4Jyu5URLBgz546edyVUkR6kzLrr3pq1WexrjjcTfsdlOFWeqc= 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+43686+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 1562978828105302.5810830709639; Fri, 12 Jul 2019 17:47:08 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 12 Jul 2019 17:47:05 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2019 17:47:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,484,1557212400"; d="scan'208";a="160544051" X-Received: from mariengu-mobl.amr.corp.intel.com ([10.252.129.197]) by orsmga008.jf.intel.com with ESMTP; 12 Jul 2019 17:47:04 -0700 From: "Imran Desai" To: devel@edk2.groups.io Cc: Chao Zhang , Jiewen Yao , Jian Wang Subject: [edk2-devel] [PATCH v6 4/5] SecurityPkg: set SM3 bit in TPM 2.0 hash mask by default Date: Fri, 12 Jul 2019 17:47:00 -0700 Message-Id: <20190713004701.78253-5-imran.desai@intel.com> In-Reply-To: <20190713004701.78253-1-imran.desai@intel.com> References: <20190713004701.78253-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=1562978827; bh=9fRbijErDgPQsnx09wRDXqwhro01FvYTNt9N8+5dFIY=; h=Cc:Date:From:Reply-To:Subject:To; b=Mrl18neZF1hV/1A3UGoi2Ljo1d/ir9AmaOfhaEInDYGOZ4cFu71iTSAu7EA0mdShgSS jIggMgha9kn/VthvMTMW0eq1BUeg4sEXkq+SSPEczrozm9LcW6chbXMFuZpHyz8pF1S68 +dN4M9MEi6l4Kn4A1qfCBvkUkuKO7kCN5Hc= 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 (#43686): https://edk2.groups.io/g/devel/message/43686 Mute This Topic: https://groups.io/mt/32454904/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 Sun May 5 16:47:02 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+43687+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+43687+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562978827; cv=none; d=zoho.com; s=zohoarc; b=hFQPAj9c0v++aS+rFZGCIyaKVoCOK3Z7PyLKjTs7xJ14Egq9v8n60+JAcXN5YGv96xnOBRcn7YuPa7L30C7Pj91Ohn8iNd9Izc+/ARmE6nTrbO9emiyYKRRHvrNUxAgv/iYG0iJKz7TYCrrQSt4EupaMIhFN+ZIobe1izkiK/Ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562978827; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=dNI4KYAL9FdJRkJJuOoCodPZqqUtC3L+rg0Ibfs+C0k=; b=P4Gs1aiCaOAgEMCAuRaT5iie6wnXXBi2OEwS2QXNdeaWfxUe0XUZ7qOs5tCskgu5dWXyC8DozcmXt1aWduPexYnpr64ftfCsN/KrLHQuFrvzueVKIdQKB/FxCl7KkkcWJs2sQmPjoigSPwUZjCYoShN6/VMzmjNeJvkhijAm1DA= 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+43687+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 1562978827840243.6122154159233; Fri, 12 Jul 2019 17:47:07 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 12 Jul 2019 17:47:06 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2019 17:47:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,484,1557212400"; d="scan'208";a="160544060" X-Received: from mariengu-mobl.amr.corp.intel.com ([10.252.129.197]) by orsmga008.jf.intel.com with ESMTP; 12 Jul 2019 17:47:05 -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 v6 5/5] OvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe Date: Fri, 12 Jul 2019 17:47:01 -0700 Message-Id: <20190713004701.78253-6-imran.desai@intel.com> In-Reply-To: <20190713004701.78253-1-imran.desai@intel.com> References: <20190713004701.78253-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=1562978827; bh=zALcqSu4Bpy18R9wmngvIudXuQ4KnxEIi5FrhZljFiw=; h=Cc:Date:From:Reply-To:Subject:To; b=R9zcZfYbc6ZN91xnM/kTQ3+y0nOpErldlmcOjupfRDRDWfTmedxnspuXAfp23ojg1RV 7hSdRA3PrMy/bjrKx3rxgdMvYa+11Nfgf7vLsuNFCYIh00Tmurx2xu5Yo//QpjinJm3xp 9aSdshbeDeZBpD+MDX3PZ0FxK1gRtgUifbI= 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 (#43687): https://edk2.groups.io/g/devel/message/43687 Mute This Topic: https://groups.io/mt/32454905/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-