From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mx.groups.io with SMTP id smtpd.web11.30260.1631542875870151941 for ; Mon, 13 Sep 2021 07:21:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KA7di9Sa; spf=none, err=permanent DNS error (domain: linux.vnet.ibm.com, ip: 148.163.156.1, mailfrom: stefanb@linux.vnet.ibm.com) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 18DD5kxl018915; Mon, 13 Sep 2021 10:21:15 -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=KA7di9SaPVgo6F95NXeJ5GY54/ExDM7CO3DIYcC2muE2JOONIQmQNiZ/IsGxVByenl9f qLLCGg12QjxptMbmv9BqHWy++cdP2ilyC0IUUuelCEOlQAD/lcvh7oJ2ftP3Y/fb3Ceh VK+5F2TwweoMZZqCan4vrv1gAXvg4i4xuHXObfB5o3uDDPi27hxnkeyN36+Umvb8Zrov M7l6pBeHoRgfB9nGK4xTx2WSevvCJmU3DYO2YJXptZo4xmgZtZeSmgcFxW4L16SJK8dz nrihmng07+rwa+DGMSnMQnuqqeipRsPiw2tSnYh5TERh0Jvp2gfKgh9bfToXUVVR3NC5 5A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b232ah77m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 10:21:15 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 18DDtkl7011623; Mon, 13 Sep 2021 10:21:14 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b232ah770-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 10:21:14 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18DEDgOT009406; Mon, 13 Sep 2021 14:21:13 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma02wdc.us.ibm.com with ESMTP id 3b0m3aa10r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 14:21:13 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18DELCh825952668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Sep 2021 14:21:12 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 188D513604F; Mon, 13 Sep 2021 14:21:12 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BB91136055; Mon, 13 Sep 2021 14:21:11 +0000 (GMT) Received: from sbct-2.pok.ibm.com (unknown [9.47.158.152]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 13 Sep 2021 14:21:11 +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 v8 03/10] SecrutiyPkg/Tcg: Import Tcg2PlatformDxe from edk2-platforms Date: Mon, 13 Sep 2021 10:20:59 -0400 Message-Id: <20210913142106.2526997-4-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913142106.2526997-1-stefanb@linux.vnet.ibm.com> References: <20210913142106.2526997-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fQq66BRZFZbdUzxZQXTa19fh087KoK9b X-Proofpoint-ORIG-GUID: noENRjMCWGj-k8QaqXO2LBnpj0m5_w-o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109130046 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