From nobody Sun Feb 8 23:05:21 2026 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+80460+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+80460+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1631231250; cv=none; d=zohomail.com; s=zohoarc; b=gKHSAqzKkc4ZpAb5SVVgyGd1tGMBxFZWb+sCih0ZpVI2adRWW4Q+BTd3DSV1sdT+I00kTRRR1KE/XUCsrntnf/TwTqhiZ8d8D8tJrS0/CKy7x9od/W+HMPRaIX66I7dhpjsrrl3e88CIl8UnLalho0v/++Skty+IRowDqsBRc/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631231250; 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=mAsAnR68tNaa1rFEVTsmpRogHqwlluXilLcL766HDqw=; b=dryp5lug/CZ7rOuQ3oNAOXS2FmhSU/dXWBJxdl1M2J6nEFqVlW1c9J24rBuCK8l++lhHmcZDSdfkEF1bv00Dcp3FUtZf1xkRW5ysmw81q6GgEnS9oxADD49N45RePsQtxisL/ExyOw9iN12D/W2eXNPIc4JKD/1TD8HneIu/Y00= 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+80460+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631231250169965.1975644770961; Thu, 9 Sep 2021 16:47:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id SbJlYY1788612xXMKuvKBPWU; Thu, 09 Sep 2021 16:47:29 -0700 X-Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web11.2556.1631208943105387542 for ; Thu, 09 Sep 2021 10:35:43 -0700 X-Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 189HXmnD125061; Thu, 9 Sep 2021 13:35:42 -0400 X-Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ayndpt0jq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Sep 2021 13:35:42 -0400 X-Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 189HYsqr129080; Thu, 9 Sep 2021 13:35:41 -0400 X-Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ayndpt0je-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Sep 2021 13:35:41 -0400 X-Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 189HMAxY026995; Thu, 9 Sep 2021 17:35:41 GMT X-Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma04dal.us.ibm.com with ESMTP id 3axcnk71v8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Sep 2021 17:35:41 +0000 X-Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 189HZd9338076874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Sep 2021 17:35:40 GMT X-Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD3C0AC06B; Thu, 9 Sep 2021 17:35:39 +0000 (GMT) X-Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEA7BAC065; Thu, 9 Sep 2021 17:35:39 +0000 (GMT) X-Received: from sbct-2.pok.ibm.com (unknown [9.47.158.152]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 9 Sep 2021 17:35:39 +0000 (GMT) From: Stefan Berger To: devel@edk2.groups.io Cc: mhaeuser@posteo.de, spbrogan@outlook.com, marcandre.lureau@redhat.com, kraxel@redhat.com, jiewen.yao@intel.com, Stefan Berger , Stefan Berger Subject: [edk2-devel] [PATCH v7 3/9] SecrutiyPkg/Tcg: Import Tcg2PlatformDxe from edk2-platforms Date: Thu, 9 Sep 2021 13:35:32 -0400 Message-Id: <20210909173538.2380673-4-stefanb@linux.vnet.ibm.com> In-Reply-To: <20210909173538.2380673-1-stefanb@linux.vnet.ibm.com> References: <20210909173538.2380673-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: or2FaSCgQ-YWLC6TlH3GPycFYwCNoN0o X-Proofpoint-GUID: m4PV97BdOOYyxmy5DNUZJlkj2R4GUfxc 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,stefanb@linux.vnet.ibm.com X-Gm-Message-State: j4ohxVdIvYRVyG1dSX50dQLex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631231249; bh=R1nPfLc+gm0v8g0ndtGTfl7CG0B+hfAbGuvlYl8Ayn8=; h=Cc:Date:From:Reply-To:Subject:To; b=WZeR6AERiB5ll/4uTNkjWIX42FWqGqZLgFW38uh+VnHjjI+s/tyqgZdi08PBmaGVgvw bbcgyKTDqptjll5r3PHqeRbDoVr3cDG4Nb8DV93sg0YDSVZLoblZrc2YMsspf8m9uw0fu g+8qcQWOwlgYVCczUS6TkgaVIGygnjDEMUk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631231251686100011 Content-Type: text/plain; charset="utf-8" Import Tcg2PlatformDxe from edk2-platforms without any modifications. Signed-off-by: Stefan Berger --- .../Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c | 85 +++++++++++++++++++ .../Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf | 44 ++++++++++ 2 files changed, 129 insertions(+) create mode 100644 SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c create mode 100644 SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf diff --git a/SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c b/SecurityPk= g/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c new file mode 100644 index 0000000000..150cf748ff --- /dev/null +++ b/SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c @@ -0,0 +1,85 @@ +/** @file + Platform specific TPM2 component for configuring the Platform Hierarchy. + + Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include + +/** + This callback function will run at the SmmReadyToLock event. + + Configuration of the TPM's Platform Hierarchy Authorization Value (plat= formAuth) + and Platform Hierarchy Authorization Policy (platformPolicy) can be def= ined through this function. + + @param Event Pointer to this event + @param Context Event hanlder private data + **/ +VOID +EFIAPI +SmmReadyToLockEventCallBack ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + VOID *Interface; + + // + // Try to locate it because EfiCreateProtocolNotifyEvent will trigger it= once when registration. + // Just return if it is not found. + // + Status =3D gBS->LocateProtocol ( + &gEfiDxeSmmReadyToLockProtocolGuid, + NULL, + &Interface + ); + if (EFI_ERROR (Status)) { + return ; + } + + ConfigureTpmPlatformHierarchy (); + + gBS->CloseEvent (Event); +} + +/** + The driver's entry point. Will register a function for callback during = SmmReadyToLock event to + configure the TPM's platform authorization. + + @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry poi= nt. +**/ +EFI_STATUS +EFIAPI +Tcg2PlatformDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + VOID *Registration; + EFI_EVENT Event; + + Event =3D EfiCreateProtocolNotifyEvent ( + &gEfiDxeSmmReadyToLockProtocolGuid, + TPL_CALLBACK, + SmmReadyToLockEventCallBack, + NULL, + &Registration + ); + + ASSERT (Event !=3D NULL); + + return EFI_SUCCESS; +} diff --git a/SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf b/Security= Pkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf new file mode 100644 index 0000000000..af29c1cd98 --- /dev/null +++ b/SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf @@ -0,0 +1,44 @@ +### @file +# Platform specific TPM2 component. +# +# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010017 + BASE_NAME =3D Tcg2PlatformDxe + FILE_GUID =3D 5CAB08D5-AD8F-4d8b-B828-D17A8D9FE977 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D DXE_DRIVER + ENTRY_POINT =3D Tcg2PlatformDxeEntryPoint +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF +# + +[LibraryClasses] + BaseLib + UefiBootServicesTableLib + UefiDriverEntryPoint + DebugLib + UefiLib + TpmPlatformHierarchyLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MinPlatformPkg/MinPlatformPkg.dec + SecurityPkg/SecurityPkg.dec + +[Sources] + Tcg2PlatformDxe.c + +[Protocols] + gEfiDxeSmmReadyToLockProtocolGuid ## SOMETIMES_CONSUMES ## N= OTIFY + +[Depex] + gEfiTcg2ProtocolGuid --=20 2.31.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 (#80460): https://edk2.groups.io/g/devel/message/80460 Mute This Topic: https://groups.io/mt/85498439/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-