From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web12.30409.1631542878629486183 for ; Mon, 13 Sep 2021 07:21:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=XOLzPq79; 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 (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 18DD5PhO033085; Mon, 13 Sep 2021 10:21:17 -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=BznH+zk4Cfm2W7MUEeHjtF4xg1Dbp29EVrmhMGaB7Lo=; b=XOLzPq79ZJwjyTFBzUIbUKQR2YDrkIn66VgK+zeJ/yEl4l/ekEebInn10W0i79KGLpqL F5xf4+qI01p+g8FnGYQikCylj4vFl4SdRmjBKvcPjaiXUzf5qMwCDEYenglWPT+Z2D5B Mjff92d5IGB6tWs7ICbLaajDZ6lPPYQFd1fFGqTmVk2K0f8kZNwX6LuMsBta2oDGvBwi Y1VT9sAZ/3gj7SOSvLee0EdcKe6+eCXdcbWYRgnM6jp3yOq3+imHUsWCciYULSE1Uv+P xPQUdEYGDDOrYeKPkYgQOlZ9oTkTc6YrWCHx6agpwpQBE/ye+ttIqinABTwPwNZJGJnG Xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b232j0u5p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 10:21:17 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 18DBkeDO022617; Mon, 13 Sep 2021 10:21:16 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b232j0u5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 10:21:16 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18DEDi2v018642; Mon, 13 Sep 2021 14:21:16 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma03dal.us.ibm.com with ESMTP id 3b0m3a29jk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Sep 2021 14:21:15 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18DELEI125559356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Sep 2021 14:21:14 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7199B13605E; Mon, 13 Sep 2021 14:21:14 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0163F13604F; Mon, 13 Sep 2021 14:21:14 +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:13 +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 07/10] SecurityPkg/Tcg: Import Tcg2PlatformPei from edk2-platforms Date: Mon, 13 Sep 2021 10:21:03 -0400 Message-Id: <20210913142106.2526997-8-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: LZTpqLcyYjLXqtdyRcuUQoxeNi-16hE_ X-Proofpoint-ORIG-GUID: bjErFKD88OrG4wCs6xi328oeD418lNMR 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 priorityscore=1501 adultscore=0 bulkscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109130046 Content-Transfer-Encoding: quoted-printable Import Tcg2PlatformPei from edk2-platforms without any modifications. Signed-off-by: Stefan Berger --- .../Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c | 107 ++++++++++++++++++ .../Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf | 52 +++++++++ 2 files changed, 159 insertions(+) create mode 100644 SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c create mode 100644 SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf diff --git a/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c b/SecurityPk= g/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c new file mode 100644 index 0000000000..66ec75ad0e --- /dev/null +++ b/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c @@ -0,0 +1,107 @@ +/** @file=0D +=0D +Copyright (c) 2017, Intel Corporation. All rights reserved.
=0D +Copyright (c) Microsoft Corporation.
=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +#define MAX_NEW_AUTHORIZATION_SIZE SHA512_DIGEST_SIZE=0D +=0D +/**=0D + This function handles PlatformInit task at the end of PEI=0D +=0D + @param[in] PeiServices Pointer to PEI Services Table.=0D + @param[in] NotifyDesc Pointer to the descriptor for the Notification = event that=0D + caused this function to execute.=0D + @param[in] Ppi Pointer to the PPI data associated with this fu= nction.=0D +=0D + @retval EFI_SUCCESS The function completes successfully=0D + @retval others=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +PlatformInitEndOfPei (=0D + IN CONST EFI_PEI_SERVICES **PeiServices,=0D + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,=0D + IN VOID *Ppi=0D + )=0D +{=0D + VOID *TcgEventLog;=0D +=0D + //=0D + // Try to get TcgEventLog in S3 to see if S3 error is reported.=0D + //=0D + TcgEventLog =3D GetFirstGuidHob(&gTcgEventEntryHobGuid);=0D + if (TcgEventLog =3D=3D NULL) {=0D + TcgEventLog =3D GetFirstGuidHob(&gTcgEvent2EntryHobGuid);=0D + }=0D +=0D + if (TcgEventLog =3D=3D NULL) {=0D + //=0D + // no S3 error reported=0D + //=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // If there is S3 error on TPM_SU_STATE and success on TPM_SU_CLEAR,=0D + // configure the TPM Platform Hierarchy.=0D + //=0D + ConfigureTpmPlatformHierarchy ();=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +static EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiNotifyList =3D {=0D + (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINA= TE_LIST),=0D + &gEfiEndOfPeiSignalPpiGuid,=0D + (EFI_PEIM_NOTIFY_ENTRY_POINT)PlatformInitEndOfPei=0D +};=0D +=0D +/**=0D + Main entry=0D +=0D + @param[in] FileHandle Handle of the file being invoked.=0D + @param[in] PeiServices Pointer to PEI Services table.=0D +=0D + @retval EFI_SUCCESS Install function successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Tcg2PlatformPeiEntryPoint (=0D + IN EFI_PEI_FILE_HANDLE FileHandle,=0D + IN CONST EFI_PEI_SERVICES **PeiServices=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_BOOT_MODE BootMode;=0D +=0D + Status =3D PeiServicesGetBootMode (&BootMode);=0D + ASSERT_EFI_ERROR(Status);=0D +=0D + if (BootMode !=3D BOOT_ON_S3_RESUME) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Performing PlatformInitEndOfPei after EndOfPei PPI produced=0D + //=0D + Status =3D PeiServicesNotifyPpi (&mEndOfPeiNotifyList);=0D +=0D + return Status;=0D +}=0D diff --git a/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf b/Security= Pkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf new file mode 100644 index 0000000000..579f09b940 --- /dev/null +++ b/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf @@ -0,0 +1,52 @@ +### @file=0D +#=0D +# Copyright (c) 2017, 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 Tcg2PlatformPei=0D + FILE_GUID =3D 47727552-A54B-4A84-8CC1-BFF23E239636= =0D + VERSION_STRING =3D 1.0=0D + MODULE_TYPE =3D PEIM=0D + ENTRY_POINT =3D Tcg2PlatformPeiEntryPoint=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC=0D +#=0D +=0D +[LibraryClasses]=0D + PcdLib=0D + BaseMemoryLib=0D + MemoryAllocationLib=0D + PeiServicesLib=0D + PeimEntryPoint=0D + DebugLib=0D + Tpm2DeviceLib=0D + Tpm2CommandLib=0D + TpmPlatformHierarchyLib=0D + RngLib=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + SecurityPkg/SecurityPkg.dec=0D + MinPlatformPkg/MinPlatformPkg.dec=0D +=0D +[Sources]=0D + Tcg2PlatformPei.c=0D +=0D +[Guids]=0D + gTcgEventEntryHobGuid=0D + gTcgEvent2EntryHobGuid=0D +=0D +[Ppis]=0D + gEfiEndOfPeiSignalPpiGuid=0D +=0D +[Depex]=0D + gEfiTpmDeviceSelectedGuid=0D +=0D --=20 2.31.1