From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AZ1gnJUp; spf=none, err=permanent DNS error (domain: linux.vnet.ibm.com, ip: 148.163.158.5, mailfrom: stefanb@linux.vnet.ibm.com) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=bHy6Wwl0KhtVufJJZ/2bXQYdj/LjioCd3Lh+65SXe7s=; b=AZ1gnJUpAo0DZP4vc5LIdkdfI4qrtbljLcToFV8cX8eiwSHYAzrwTbjnV+3Clwbicgkb PpmwIDWJ1WYi8SANXkAWb2BwwnjBKfg6jain3/fE6zxjV3U76wqFKGbHu/fHUnvmfbD0 aZSTzvZc2H99QAh0t8KMih1OXpJaADT3mX+x59eHK6ULV5XWVgagd69Qwu4lkcBcSI7L SnE/hgtNnwJCrgy15Q5Ov2b3MZy8lnTiUDKwpMuCANExqQIobwyET/IUHEvxMyeBX0Nm wW9/EC24N5RCwZriYuNLLKbAookBAlh8o3p4X7PuwLkmkKjMK5x0NCASbElFBEiyMJb7 Pg== 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 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 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 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 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 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 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) 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) 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: [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> X-Mailer: git-send-email 2.31.1 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 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-09_06:2021-09-09,2021-09-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 mlxscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109090107 Content-Transfer-Encoding: quoted-printable 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=0D + Platform specific TPM2 component for configuring the Platform Hierarchy.= =0D +=0D + Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + This callback function will run at the SmmReadyToLock event.=0D +=0D + Configuration of the TPM's Platform Hierarchy Authorization Value (plat= formAuth)=0D + and Platform Hierarchy Authorization Policy (platformPolicy) can be def= ined through this function.=0D +=0D + @param Event Pointer to this event=0D + @param Context Event hanlder private data=0D + **/=0D +VOID=0D +EFIAPI=0D +SmmReadyToLockEventCallBack (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_STATUS Status;=0D + VOID *Interface;=0D +=0D + //=0D + // Try to locate it because EfiCreateProtocolNotifyEvent will trigger it= once when registration.=0D + // Just return if it is not found.=0D + //=0D + Status =3D gBS->LocateProtocol (=0D + &gEfiDxeSmmReadyToLockProtocolGuid,=0D + NULL,=0D + &Interface=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return ;=0D + }=0D +=0D + ConfigureTpmPlatformHierarchy ();=0D +=0D + gBS->CloseEvent (Event);=0D +}=0D +=0D +/**=0D + The driver's entry point. Will register a function for callback during = SmmReadyToLock event to=0D + configure the TPM's platform authorization.=0D +=0D + @param[in] ImageHandle The firmware allocated handle for the EFI image= .=0D + @param[in] SystemTable A pointer to the EFI System Table.=0D +=0D + @retval EFI_SUCCESS The entry point is executed successfully.=0D + @retval other Some error occurs when executing this entry poi= nt.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Tcg2PlatformDxeEntryPoint (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + VOID *Registration;=0D + EFI_EVENT Event;=0D +=0D + Event =3D EfiCreateProtocolNotifyEvent (=0D + &gEfiDxeSmmReadyToLockProtocolGuid,=0D + TPL_CALLBACK,=0D + SmmReadyToLockEventCallBack,=0D + NULL,=0D + &Registration=0D + );=0D +=0D + ASSERT (Event !=3D NULL);=0D +=0D + return EFI_SUCCESS;=0D +}=0D 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=0D +# Platform specific TPM2 component.=0D +#=0D +# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +###=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010017=0D + BASE_NAME =3D Tcg2PlatformDxe=0D + FILE_GUID =3D 5CAB08D5-AD8F-4d8b-B828-D17A8D9FE977= =0D + VERSION_STRING =3D 1.0=0D + MODULE_TYPE =3D DXE_DRIVER=0D + ENTRY_POINT =3D Tcg2PlatformDxeEntryPoint=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF=0D +#=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + UefiBootServicesTableLib=0D + UefiDriverEntryPoint=0D + DebugLib=0D + UefiLib=0D + TpmPlatformHierarchyLib=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + MinPlatformPkg/MinPlatformPkg.dec=0D + SecurityPkg/SecurityPkg.dec=0D +=0D +[Sources]=0D + Tcg2PlatformDxe.c=0D +=0D +[Protocols]=0D + gEfiDxeSmmReadyToLockProtocolGuid ## SOMETIMES_CONSUMES ## N= OTIFY=0D +=0D +[Depex]=0D + gEfiTcg2ProtocolGuid=0D --=20 2.31.1