From nobody Thu May 16 17:30:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76142+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76142+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1623081933; cv=none; d=zohomail.com; s=zohoarc; b=MTXVmUrjr/dj2UKrJjtl/E9M+PWbmll3Ljn1QPUBryz7Qjw+ywk+iiAXpbsIn9QwC54Cr0J1R06HlUDc1Mk0BtDBwT2opQae+Wzi51gOUJmLCJ0m/SATDvUbUjr1pgsXtefkn0sIFpOQGH7gEBlFk0NSx3uEvrQKQOUH5lmB4kM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623081933; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=zwLrnKth0hcHw4m/Hl+FG3l9oQmFfxpgRytwHQGVXq0=; b=DILKfX759/sCzhz35THvLcKigsCyZoBBV+Yb+rZJzfUyusNwDO6wa/0tr7zm7NvKMdysGDT8cp2yKrjruYUNMU1t0Gxy6pQDxrUEgorhj9zpqzDO3eGyefxCWlm+wgwpvMfMlLpmnIlJG7sj14F70Asu/WAqFw8EtySmrGcPLaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76142+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1623081933440753.8707770241366; Mon, 7 Jun 2021 09:05:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ItRWYY1788612xXGHayHP0zp; Mon, 07 Jun 2021 09:05:33 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.440.1623081927605231492 for ; Mon, 07 Jun 2021 09:05:27 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 2E99A20B83EB; Mon, 7 Jun 2021 09:05:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2E99A20B83EB From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/4] MinPlatformPkg: Add TpmPlatformHierarchyLib to Components in DSC Date: Mon, 7 Jun 2021 12:05:03 -0400 Message-Id: <20210607160506.2411-2-mikuback@linux.microsoft.com> In-Reply-To: <20210607160506.2411-1-mikuback@linux.microsoft.com> References: <20210607160506.2411-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: jFhRNTNsIll7bBUytQEhIK1Wx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1623081933; bh=2lLexBBa2MOFh/nxPA96oJrVjK62+BQ6Na/71Q78+hM=; h=Cc:Date:From:Reply-To:Subject:To; b=m5XzM7vOfLgeqL1iKzeFcvsOLexWLI3IEkBLwXeHLadtLI87iZz7SSY4z1oylmQB9am zBHgEUgokMWws/f20rVfQvEHInIjuFzMoCsoOsTIIt0JAs2vO7XbrVqbkITfznWvAlXmj VAQ/Uk6DA+7HxKlY+a6Pwxed8stUXJkUCxQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki Adds TpmPlatformHierarchyLib to the [Components] section in MinPlatformPkg.dsc so it is always built in the package build. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dsc index 35cbd40abb05..7e952dfaf300 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc @@ -200,6 +200,7 @@ [Components] MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf MinPlatformPkg/Test/TestPointDumpApp/TestPointDumpApp.inf =20 + MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyLib/TpmPlatformHierarchyL= ib.inf !if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable =3D=3D TRUE MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf MinPlatformPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf --=20 2.28.0.windows.1 -=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 (#76142): https://edk2.groups.io/g/devel/message/76142 Mute This Topic: https://groups.io/mt/83373864/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 Thu May 16 17:30:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76143+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76143+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1623081931; cv=none; d=zohomail.com; s=zohoarc; b=Up+nxlVm0yyHGWA5trPg4v5Ao7PuwjCypMfK3xOJmULtdTUwdp/jKpv2W0chordfDXIiOzqbN1bxMdVgW8zXng1pw+z8Aw3UOtQhCC3GIW2+vZ/LAgM7ZB1WPJMSHiMBkjIcIfjP6ThI/1C1cY0jZyeOc7bgtrVFkZxPXUPsyJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623081931; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=TAcHZlXuj++GtavWV9Sc+W7YAtGgwtLnJsnNnBh3QeU=; b=FvNvgnIJqNQ/rcGm2CKVRF54b5Bfd8jc//0v4DkMSVveBCfJyzROAxtMlZeKGSGyVXb8/2QNDpXuc9zNInZdh6SLvoNcsto3XrBww61+I0ifF14uGvQCl5GWDzNkw7TvwecrAU/sm2s57lQkSI3/1dJuOqgTAppzog2BwJXU36M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76143+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1623081931964805.4004499121708; Mon, 7 Jun 2021 09:05:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id sTMdYY1788612x7dTCGPdcdE; Mon, 07 Jun 2021 09:05:31 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.439.1623081930953881743 for ; Mon, 07 Jun 2021 09:05:31 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 8F75F20B83EA; Mon, 7 Jun 2021 09:05:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8F75F20B83EA From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 2/4] MinPlatformPkg/TpmPlatformHierarchyLib: Add PEI support Date: Mon, 7 Jun 2021 12:05:04 -0400 Message-Id: <20210607160506.2411-3-mikuback@linux.microsoft.com> In-Reply-To: <20210607160506.2411-1-mikuback@linux.microsoft.com> References: <20210607160506.2411-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: nX94WxQhfeRpVAZ1M4vGSqSFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1623081931; bh=1juPsZoak8L8jQulDKGsXamFTyAX9j0mp660xCc5dQY=; h=Cc:Date:From:Reply-To:Subject:To; b=jLQr4PZRt3AmCz049IU15IUpaRF4nSkioE9bt6/1bL2tfTM8lH+n4wCl15H4Tq5Zp5x s7+KpIIOV+sRQ30KrCIvdGXupN9MdT0pJjuqPzCOe3V6UDZpJiyl4OP6INpwPEYETP2p4 imIHQlAeLIEQXrBmMua5cmn0R4dtMeqicYA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki Expands the TpmPlatformHierarchyLib instance in MinPlatformPkg to support PEIM in addition to DXE_DRIVER. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Platform/Intel/MinPlatformPkg/Tcg/Library/{TpmPlatformHierarchyLib/TpmPlat= formHierarchyLib.c =3D> PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHier= archyLib.c} | 9 +++------ Platform/Intel/MinPlatformPkg/Include/Library/TpmPlatformHierarchyLib.h = = | 4 +--- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc = = | 4 ++-- Platform/Intel/MinPlatformPkg/Tcg/Library/{TpmPlatformHierarchyLib/TpmPlat= formHierarchyLib.inf =3D> PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHi= erarchyLib.inf} | 20 +++++++------------- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/TpmPlatformHierarchy= Lib/TpmPlatformHierarchyLib.c b/Platform/Intel/MinPlatformPkg/Tcg/Library/P= eiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c similarity index 93% rename from Platform/Intel/MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyL= ib/TpmPlatformHierarchyLib.c rename to Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierar= chyLib/PeiDxeTpmPlatformHierarchyLib.c index 41ddb26f4046..fa590089f0a0 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyLib/Tpm= PlatformHierarchyLib.c +++ b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.c @@ -12,16 +12,13 @@ https://trustedcomputinggroup.org/resource/tcg-tpm-v2-0-provisioning-g= uidance/ **/ =20 -#include +#include =20 -#include #include -#include +#include #include -#include #include -#include -#include +#include =20 // // The authorization value may be no larger than the digest produced by th= e hash diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/TpmPlatformHiera= rchyLib.h b/Platform/Intel/MinPlatformPkg/Include/Library/TpmPlatformHierar= chyLib.h index ed9709b24a73..a872fa09dc6a 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Library/TpmPlatformHierarchyLib= .h +++ b/Platform/Intel/MinPlatformPkg/Include/Library/TpmPlatformHierarchyLib= .h @@ -6,6 +6,7 @@ Policy (platformPolicy) can be defined through this function. =20 Copyright (c) 2019, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -13,9 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _TPM_PLATFORM_HIERARCHY_LIB_H_ #define _TPM_PLATFORM_HIERARCHY_LIB_H_ =20 -#include -#include - /** This service will perform the TPM Platform Hierarchy configuration at t= he SmmReadyToLock event. =20 diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dsc index 7e952dfaf300..0240a803f868 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc @@ -106,7 +106,7 @@ [LibraryClasses.common.DXE_DRIVER] FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/DxeFspWrapperPla= tformLib/DxeFspWrapperPlatformLib.inf TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.inf TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointLib.inf - TpmPlatformHierarchyLib|MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyL= ib/TpmPlatformHierarchyLib.inf + TpmPlatformHierarchyLib|MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHier= archyLib/PeiDxeTpmPlatformHierarchyLib.inf =20 [LibraryClasses.common.DXE_SMM_DRIVER] SpiFlashCommonLib|MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/Spi= FlashCommonLibNull.inf @@ -200,7 +200,7 @@ [Components] MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf MinPlatformPkg/Test/TestPointDumpApp/TestPointDumpApp.inf =20 - MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyLib/TpmPlatformHierarchyL= ib.inf + MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatfo= rmHierarchyLib.inf !if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable =3D=3D TRUE MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf MinPlatformPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/TpmPlatformHierarchy= Lib/TpmPlatformHierarchyLib.inf b/Platform/Intel/MinPlatformPkg/Tcg/Library= /PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf similarity index 70% rename from Platform/Intel/MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyL= ib/TpmPlatformHierarchyLib.inf rename to Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierar= chyLib/PeiDxeTpmPlatformHierarchyLib.inf index 0911bdffa01f..7165cda31357 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Library/TpmPlatformHierarchyLib/Tpm= PlatformHierarchyLib.inf +++ b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.inf @@ -7,6 +7,7 @@ # Policy (platformPolicy) can be defined through this function. # # Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -14,23 +15,19 @@ =20 [Defines] INF_VERSION =3D 0x00010005 - BASE_NAME =3D TpmPlatformHierarchyLib + BASE_NAME =3D PeiDxeTpmPlatformHierarchyLib FILE_GUID =3D 7794F92C-4E8E-4E57-9E4A-49A0764C7D73 - MODULE_TYPE =3D DXE_DRIVER + MODULE_TYPE =3D PEIM VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D TpmPlatformHierarchyLib + LIBRARY_CLASS =3D TpmPlatformHierarchyLib|PEIM DXE_DRIV= ER =20 [LibraryClasses] - MemoryAllocationLib BaseLib - UefiBootServicesTableLib - UefiDriverEntryPoint BaseMemoryLib DebugLib - Tpm2CommandLib - Tpm2DeviceLib + MemoryAllocationLib RngLib - UefiLib + Tpm2CommandLib =20 [Packages] MdePkg/MdePkg.dec @@ -39,7 +36,4 @@ [Packages] CryptoPkg/CryptoPkg.dec =20 [Sources] - TpmPlatformHierarchyLib.c - -[Depex] - gEfiTcg2ProtocolGuid + PeiDxeTpmPlatformHierarchyLib.c --=20 2.28.0.windows.1 -=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 (#76143): https://edk2.groups.io/g/devel/message/76143 Mute This Topic: https://groups.io/mt/83373866/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 Thu May 16 17:30:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76144+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76144+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1623081934; cv=none; d=zohomail.com; s=zohoarc; b=PoIRP0cnjDK+AhRgdSqkV6/s0PuGzR94xI8iq4Nsn3Jn/VbOr7UZSzzezS3WiJR2yOv1rzV39bwBMPnzmhZc9iDTBw+Slpc7mcuCMdHSisXTFKbR1B2n6YHGfLfLZpL8Vn3wDdqhZMP2OjwM9GELJxx52hOdC/Hrsh9ZLaiXTFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623081934; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=EDrsKe2zzmSSML/nsHMseZ3Qky0c+NU43joZM39o80U=; b=Wq/feEPgMSMrmv9mqb3NbW+ZgBus5elXRy+sr1jgFpD49byDafti3mncil+81Pc8zzmNvjMvcKNLbEW6/r0n8baRhaB293VXCQIwPfhsD208mrkkyMQwaFk/v4XczSuYgnqG01Tp2RMGX4xqON5Xysz61RxcVUINA0qpx4RAz4M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76144+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1623081934462132.45169246889793; Mon, 7 Jun 2021 09:05:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id I2eqYY1788612xhp4kY4RXSQ; Mon, 07 Jun 2021 09:05:34 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.443.1623081933482873446 for ; Mon, 07 Jun 2021 09:05:33 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 2D85720B83EC; Mon, 7 Jun 2021 09:05:33 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2D85720B83EC From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 3/4] MinPlatformPkg/Tcg2PlatformPei: Use TpmPlatformHierarchyLib Date: Mon, 7 Jun 2021 12:05:05 -0400 Message-Id: <20210607160506.2411-4-mikuback@linux.microsoft.com> In-Reply-To: <20210607160506.2411-1-mikuback@linux.microsoft.com> References: <20210607160506.2411-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: 9WDzebaVRhTNfgux08W6xmnHx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1623081934; bh=TRD+DtjvCAgwivUYrIo2T0KKH7KMWVbPuwjIaTS1zGQ=; h=Cc:Date:From:Reply-To:Subject:To; b=IJApO8BZ/FC5mGKmauayhNZeTzhMBESX7tB2um8NPqdLWKgmyBDWJEaGxZg7WoSiF84 8CyTFKoreyAmTipDvJCZVDfs4t5wE+KAqYlrjRwmT/dDI+SPblxBdYzP5iD6zPt9rWoWp C3vQxOgr4YfJk6UfSvsttYki4moVAt6a2ok= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki Eliminates code duplication in the module with TpmPlatformHierarchyLib. Pre-existing behavior of randomzing the TPM platform auth is retained by calling the implementation of ConfigureTpmPlatformHierarchy() in TpmPlatformHierarchyLib. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c | 13= 0 +------------------- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | = 1 + Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf | = 2 + 3 files changed, 8 insertions(+), 125 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2Platform= Pei.c b/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c index 3a2d7d31e983..66ec75ad0e0f 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c +++ b/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c @@ -1,6 +1,7 @@ /** @file =20 Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -13,134 +14,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include =20 #include =20 #define MAX_NEW_AUTHORIZATION_SIZE SHA512_DIGEST_SIZE =20 -/** - Generate high-quality entropy source through RDRAND. - - @param[in] Length Size of the buffer, in bytes, to fill with. - @param[out] Entropy Pointer to the buffer to store the entropy da= ta. - - @retval EFI_SUCCESS Entropy generation succeeded. - @retval EFI_NOT_READY Failed to request random data. - -**/ -EFI_STATUS -EFIAPI -RdRandGenerateEntropy ( - IN UINTN Length, - OUT UINT8 *Entropy - ) -{ - EFI_STATUS Status; - UINTN BlockCount; - UINT64 Seed[2]; - UINT8 *Ptr; - - Status =3D EFI_NOT_READY; - BlockCount =3D Length / 64; - Ptr =3D (UINT8 *)Entropy; - - // - // Generate high-quality seed for DRBG Entropy - // - while (BlockCount > 0) { - Status =3D GetRandomNumber128(Seed); - if (EFI_ERROR(Status)) { - return Status; - } - CopyMem(Ptr, Seed, 64); - - BlockCount--; - Ptr =3D Ptr + 64; - } - - // - // Populate the remained data as request. - // - Status =3D GetRandomNumber128(Seed); - if (EFI_ERROR(Status)) { - return Status; - } - CopyMem(Ptr, Seed, (Length % 64)); - - return Status; -} - -/** - Set PlatformAuth to random value. -**/ -VOID -RandomizePlatformAuth ( - VOID - ) -{ - EFI_STATUS Status; - UINT16 AuthSize; - TPML_PCR_SELECTION Pcrs; - UINT32 Index; - UINT8 *Rand; - UINTN RandSize; - TPM2B_AUTH NewPlatformAuth; - - // - // Send Tpm2HierarchyChange Auth with random value to avoid PlatformAuth= being null - // - ZeroMem(&Pcrs, sizeof(TPML_PCR_SELECTION)); - AuthSize =3D MAX_NEW_AUTHORIZATION_SIZE; - - Status =3D Tpm2GetCapabilityPcrs(&Pcrs); - if (EFI_ERROR(Status)) { - DEBUG((EFI_D_ERROR, "Tpm2GetCapabilityPcrs fail!\n")); - } else { - for (Index =3D 0; Index < Pcrs.count; Index++) { - switch (Pcrs.pcrSelections[Index].hash) { - case TPM_ALG_SHA1: - AuthSize =3D SHA1_DIGEST_SIZE; - break; - case TPM_ALG_SHA256: - AuthSize =3D SHA256_DIGEST_SIZE; - break; - case TPM_ALG_SHA384: - AuthSize =3D SHA384_DIGEST_SIZE; - break; - case TPM_ALG_SHA512: - AuthSize =3D SHA512_DIGEST_SIZE; - break; - case TPM_ALG_SM3_256: - AuthSize =3D SM3_256_DIGEST_SIZE; - break; - } - } - } - - ZeroMem(NewPlatformAuth.buffer, AuthSize); - NewPlatformAuth.size =3D AuthSize; - - // - // Allocate one buffer to store random data. - // - RandSize =3D MAX_NEW_AUTHORIZATION_SIZE; - Rand =3D AllocatePool(RandSize); - - RdRandGenerateEntropy(RandSize, Rand); - CopyMem(NewPlatformAuth.buffer, Rand, AuthSize); - - FreePool(Rand); - - // - // Send Tpm2HierarchyChangeAuth command with the new Auth value - // - Status =3D Tpm2HierarchyChangeAuth(TPM_RH_PLATFORM, NULL, &NewPlatformAu= th); - DEBUG((DEBUG_INFO, "Tpm2HierarchyChangeAuth Result: - %r\n", Status)); - ZeroMem(NewPlatformAuth.buffer, AuthSize); - ZeroMem(Rand, RandSize); -} - /** This function handles PlatformInit task at the end of PEI =20 @@ -179,9 +59,9 @@ PlatformInitEndOfPei ( =20 // // If there is S3 error on TPM_SU_STATE and success on TPM_SU_CLEAR, - // Send Tpm2HierarchyChange Auth with random value to avoid PlatformAuth= being null + // configure the TPM Platform Hierarchy. // - RandomizePlatformAuth(); + ConfigureTpmPlatformHierarchy (); =20 return EFI_SUCCESS; } @@ -198,7 +78,7 @@ static EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiNotifyList = =3D { @param[in] FileHandle Handle of the file being invoked. @param[in] PeiServices Pointer to PEI Services table. =20 - @retval EFI_SUCCESS Install function successfully.=20 + @retval EFI_SUCCESS Install function successfully. =20 **/ EFI_STATUS diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dsc index 0240a803f868..0665a18cdcbe 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc @@ -98,6 +98,7 @@ [LibraryClasses.common.PEIM] TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestP= ointCheckLib.inf TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNu= ll.inf + TpmPlatformHierarchyLib|MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHier= archyLib/PeiDxeTpmPlatformHierarchyLib.inf =20 [LibraryClasses.common.DXE_DRIVER] # diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2Platform= Pei.inf b/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei= .inf index 1aabfe7ba88d..579f09b940e7 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf +++ b/Platform/Intel/MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf @@ -29,11 +29,13 @@ [LibraryClasses] DebugLib Tpm2DeviceLib Tpm2CommandLib + TpmPlatformHierarchyLib RngLib =20 [Packages] MdePkg/MdePkg.dec SecurityPkg/SecurityPkg.dec + MinPlatformPkg/MinPlatformPkg.dec =20 [Sources] Tcg2PlatformPei.c --=20 2.28.0.windows.1 -=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 (#76144): https://edk2.groups.io/g/devel/message/76144 Mute This Topic: https://groups.io/mt/83373867/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 Thu May 16 17:30:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76145+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76145+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1623081943; cv=none; d=zohomail.com; s=zohoarc; b=Qt1i5LkQWvxMgN165DHhL+O1QDkHQymilrXXtqB/x40FTEyyOSlRAOXeXHRPxtVHxW7ahdfq6CfUEOw2CL92dVM5Z0xz3oILAkXoXT0RoZTwHsea1vi/BGDo5bIdmk87H/SycVg3HO5jLvDQ3OL90UuisHmZiVTANVIlwlld0Nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623081943; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=uGk0ET+k/RyXx833RCfwebhnV3suECTFlMBq909KobA=; b=aWJvavoiUpxd9ygCBquMK7WUmDfNyPChpsnqt0/zFY4rhNGNt0eO52H05Wmn1E7mlXQbEZWFqRgVBBAX4mi6yWBIavOcLnkZXblQuhpJ2L3Em4R5vWdSuFOLSsP1jyQJdOhUOCaO/Xlx29q/mQgGlkQd6gANK/e/0+9wSzMGL1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76145+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16230819432991001.3482175253018; Mon, 7 Jun 2021 09:05:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OXEqYY1788612xYU0wNtnNSs; Mon, 07 Jun 2021 09:05:42 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.406.1623081937317592836 for ; Mon, 07 Jun 2021 09:05:37 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id EC7D820B83EF; Mon, 7 Jun 2021 09:05:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EC7D820B83EF From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jeremiah Cox , Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 4/4] MinPlatformPkg/TpmPlatformHierarchyLib: Add disable support Date: Mon, 7 Jun 2021 12:05:06 -0400 Message-Id: <20210607160506.2411-5-mikuback@linux.microsoft.com> In-Reply-To: <20210607160506.2411-1-mikuback@linux.microsoft.com> References: <20210607160506.2411-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: yKvexmdRcLtvBlU9wRVHlCqWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1623081942; bh=APd44oQ7JVat0nD15v9wUf/d73N3dMPHTmPEejdZboU=; h=Cc:Date:From:Reply-To:Subject:To; b=ke42pvPdzkEevZFig+8Pjer9sKc2VFGgoWHXnyO2P918GHBB7Z9zEkL4PLdDkWQDMfR EhEx3BUdBKY5vKCFYIiSvZ+czfBoJcFNLUcRw1KrZqe1IAn1/Z8WibiJfCHcEh8SFGHV4 wUHA6NB6uUPJTSUs8A69Lpy5urim8mzrIJo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3411 Adds a new PCD (PcdRandomizePlatformHierarchy) to MinPlatformPkg.dec that allows a platform integrator to choose whether to randomize or disable the TPM platform hierarchy. The current behavior to randomize the platform hierachy is preserved in the default PCD value. In the randomization case, the platform auth is randomized and then it is "forgotten" to prevent future platform access. The ConfigureTpmPlatformHierarchy() implementation is updated to configure the TPM platform hierarchy based on the value of the new PCD. Co-authored-by: Jeremiah Cox Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/Pe= iDxeTpmPlatformHierarchyLib.c | 63 ++++++++++++++++++-- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec = | 1 + Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/Pe= iDxeTpmPlatformHierarchyLib.inf | 6 ++ 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHie= rarchyLib/PeiDxeTpmPlatformHierarchyLib.c b/Platform/Intel/MinPlatformPkg/T= cg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c index fa590089f0a0..9812ab99abf5 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.c +++ b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.c @@ -6,6 +6,7 @@ Policy (platformPolicy) can be defined through this function. =20 Copyright (c) 2019, Intel Corporation. All rights reserved.
+ Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Specification Reference: @@ -17,8 +18,10 @@ #include #include #include +#include #include #include +#include =20 // // The authorization value may be no larger than the digest produced by th= e hash @@ -194,6 +197,51 @@ RandomizePlatformAuth ( ZeroMem (Rand, RandSize); } =20 +/** + Disable the TPM platform hierarchy. + + @retval EFI_SUCCESS The TPM was disabled successfully. + @retval Others An error occurred attempting to disable the = TPM platform hierarchy. + +**/ +EFI_STATUS +DisableTpmPlatformHierarchy ( + VOID + ) +{ + EFI_STATUS Status; + + // Make sure that we have use of the TPM. + Status =3D Tpm2RequestUseTpm (); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%a() - Tpm2RequestUseTpm Failed! %r\n", gEfiC= allerBaseName, __FUNCTION__, Status)); + ASSERT_EFI_ERROR (Status); + return Status; + } + + // Let's do what we can to shut down the hierarchies. + + // Disable the PH NV. + // IMPORTANT NOTE: We *should* be able to disable the PH NV here, but TP= M parts have + // been known to store the EK cert in the PH NV. If we d= isable it, the + // EK cert will be unreadable. + + // Disable the PH. + Status =3D Tpm2HierarchyControl ( + TPM_RH_PLATFORM, // AuthHandle + NULL, // AuthSession + TPM_RH_PLATFORM, // Hierarchy + NO // State + ); + DEBUG ((DEBUG_VERBOSE, "%a:%a() - Disable PH =3D %r\n", gEfiCallerBaseN= ame, __FUNCTION__, Status)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%a() - Disable PH Failed! %r\n", gEfiCallerB= aseName, __FUNCTION__, Status)); + ASSERT_EFI_ERROR (Status); + } + + return Status; +} + /** This service defines the configuration of the Platform Hierarchy Author= ization Value (platformAuth) and Platform Hierarchy Authorization Policy (platformPolicy) @@ -204,8 +252,15 @@ EFIAPI ConfigureTpmPlatformHierarchy ( ) { - // - // Send Tpm2HierarchyChange Auth with random value to avoid PlatformAuth= being null - // - RandomizePlatformAuth (); + if (PcdGetBool (PcdRandomizePlatformHierarchy)) { + // + // Send Tpm2HierarchyChange Auth with random value to avoid PlatformAu= th being null + // + RandomizePlatformAuth (); + } else { + // + // Disable the hierarchy entirely (do not randomize it) + // + DisableTpmPlatformHierarchy (); + } } diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dec index 947431470a1f..bcb42f0ef9e6 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec @@ -244,6 +244,7 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, = PcdsDynamicEx] gMinPlatformPkgTokenSpaceGuid.PcdPciNoExtendedConfigSpace |FALSE|BOOL= EAN|0x4001004C gMinPlatformPkgTokenSpaceGuid.PcdPciResourceAssigned |FALSE|BOOL= EAN|0x4001004D gMinPlatformPkgTokenSpaceGuid.PcdPciSegmentCount |0x1 |UI= NT8|0x4001004E + gMinPlatformPkgTokenSpaceGuid.PcdRandomizePlatformHierarchy |TRUE |BOOL= EAN|0x4001004F =20 gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AEventBlockAddress|0x1800|UINT16= |0x00010035 gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1BEventBlockAddress|0x0000|UINT16= |0x00010036 diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHie= rarchyLib/PeiDxeTpmPlatformHierarchyLib.inf b/Platform/Intel/MinPlatformPkg= /Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf index 7165cda31357..b7a7fb0a088d 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.inf +++ b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.inf @@ -26,14 +26,20 @@ [LibraryClasses] BaseMemoryLib DebugLib MemoryAllocationLib + PcdLib RngLib Tpm2CommandLib + Tpm2DeviceLib =20 [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec SecurityPkg/SecurityPkg.dec CryptoPkg/CryptoPkg.dec + MinPlatformPkg/MinPlatformPkg.dec =20 [Sources] PeiDxeTpmPlatformHierarchyLib.c + +[Pcd] + gMinPlatformPkgTokenSpaceGuid.PcdRandomizePlatformHierarchy --=20 2.28.0.windows.1 -=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 (#76145): https://edk2.groups.io/g/devel/message/76145 Mute This Topic: https://groups.io/mt/83373868/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-