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.web08.1663.1635868155609967955 for ; Tue, 02 Nov 2021 08:49:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ADk9ejDc; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: stefanb@linux.ibm.com) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1A2FLM4H023289; Tue, 2 Nov 2021 15:49:14 GMT 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-type : content-transfer-encoding; s=pp1; bh=WGuaVixOtGqgIy+duO7Z/Jfej5o1tIQNv0U3dz7dA5k=; b=ADk9ejDco/lCsemW8F9o9hYvolSGXCAaCU4Quo7bvAXwGWb6XZZ4EzpZSxWwGDLmhWvG MQGM9ZcVU014vvOLijlJUQgdElxKkY08GebHkW8hVMJa8Wspd/QRRVeInVHm6TMj2TEz u9ygKymTN5IZ92A1H8nb57SBlJXS1v6IA/dBm/vMQIhz9+4W8h58CVY0dsmxuaaXSZVO RhBCM0wKRZ0Ug+spNSNp479V9KyXExYIQUGvTOJRsSTXvQo2fT8n152vQOhTqrsfjVeV T5jdaLOMWD+lrocoBJsI97GBjrfodXjI82XTQZE0t+vmjAGxtbkyq80Vay6vh07rq6Px rA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3c34d3xju4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Nov 2021 15:49:14 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1A2FlgPh025036; Tue, 2 Nov 2021 15:49:14 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 3c34d3xjtn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Nov 2021 15:49:13 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1A2FcxEU008885; Tue, 2 Nov 2021 15:49:12 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma01wdc.us.ibm.com with ESMTP id 3c0wpapkuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Nov 2021 15:49:12 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1A2FnCuh10551894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Nov 2021 15:49:12 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D39B8B2074; Tue, 2 Nov 2021 15:49:11 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8045B206A; Tue, 2 Nov 2021 15:49:11 +0000 (GMT) Received: from sbct-2.pok.ibm.com (unknown [9.47.158.152]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 2 Nov 2021 15:49:11 +0000 (GMT) From: "Stefan Berger" To: devel@edk2.groups.io, kraxel@redhat.com, marcandre.lureau@redhat.com Cc: Stefan Berger , Jiewen Yao , Jian J Wang , Ard Biesheuvel , Jordan Justen Subject: [PATCH v2 3/4] OvmfPkg: Enable physical presence interface for TPM 1.2 Date: Tue, 2 Nov 2021 11:49:09 -0400 Message-Id: <20211102154910.2715495-4-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102154910.2715495-1-stefanb@linux.ibm.com> References: <20211102154910.2715495-1-stefanb@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 7r-wzh7KjVyUMEtaJjBzM6d1vaOTRM8h X-Proofpoint-GUID: JBkUE-NUY4x48GEgXeRoOlRt0eSGGx2Z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-02_08,2021-11-02_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 bulkscore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111020091 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Enable the physical presence interface for TPM 1.2. It is required for the TPM 1.2 menu to work. The changes to DxeTcgPhysicalPresenceLib.c are due to the device we are usi= ng in QEMU for presenting the supported PPI commands and results to the OS via ACPI as well as to store the PPI opcode to execute. Cc: Jiewen Yao Cc: Jian J Wang Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Signed-off-by: Stefan Berger --- .../PlatformBootManagerLib/BdsPlatform.c | 2 + .../PlatformBootManagerLib.inf | 1 + .../DxeTcgPhysicalPresenceLib.c | 22 + .../DxeTcgPhysicalPresenceLib.inf | 27 + .../DxeTcgPhysicalPresenceLib.c | 466 +++++++++--------- .../DxeTcgPhysicalPresenceLib.inf | 14 +- OvmfPkg/OvmfTpmLibs.dsc.inc | 4 + .../Include/Library/TcgPhysicalPresenceLib.h | 39 ++ SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf | 1 + 9 files changed, 343 insertions(+), 233 deletions(-) create mode 100644 OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysic= alPresenceLib.c create mode 100644 OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysic= alPresenceLib.inf diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 9b21ba2bd6..f56aff2ec5 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -12,6 +12,7 @@ #include =0D #include =0D #include =0D +#include =0D #include =0D =0D =0D @@ -396,6 +397,7 @@ PlatformBootManagerBeforeConsole ( //=0D // Process TPM PPI request; this may require keyboard input=0D //=0D + TcgPhysicalPresenceLibProcessRequest ();=0D Tcg2PhysicalPresenceLibProcessRequest (NULL);=0D =0D //=0D diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index c249a3cf1e..f12975d065 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -54,6 +54,7 @@ ReportStatusCodeLib=0D UefiLib=0D PlatformBmPrintScLib=0D + TcgPhysicalPresenceLib=0D Tcg2PhysicalPresenceLib=0D XenPlatformLib=0D =0D diff --git a/OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysicalPrese= nceLib.c b/OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysicalPresenc= eLib.c new file mode 100644 index 0000000000..d434175717 --- /dev/null +++ b/OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysicalPresenceLib.c @@ -0,0 +1,22 @@ +/** @file=0D + NULL TcgPhysicalPresenceLib library instance=0D +=0D + Copyright (C) 2021, IBM Corporation=0D + Copyright (c) 2018, Red Hat, Inc.=0D + Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +=0D +VOID=0D +EFIAPI=0D +TcgPhysicalPresenceLibProcessRequest (=0D + VOID=0D + )=0D +{=0D + //=0D + // do nothing=0D + //=0D +}=0D diff --git a/OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysicalPrese= nceLib.inf b/OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysicalPrese= nceLib.inf new file mode 100644 index 0000000000..4421c6c5b0 --- /dev/null +++ b/OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcgPhysicalPresenceLib.= inf @@ -0,0 +1,27 @@ +# NULL TcgPhysicalPresenceLib library instance=0D +#=0D +# Under SecurityPkg, the corresponding library instance will check and=0D +# execute TPM 1.2 request from OS or BIOS; the request may ask for user=0D +# confirmation before execution. This Null instance implements a no-op=0D +# Tcg2PhysicalPresenceLibProcessRequest(), without user interaction.=0D +#=0D +# Copyright (C) 2018, Red Hat, Inc.=0D +# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D DxeTcgPhysicalPresenceLibNull=0D + FILE_GUID =3D B648575C-ED00-4C0D-BD7F-B705B9B0CC93= =0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D TcgPhysicalPresenceLib|DXE_DRIVER DXE= _RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER=0D +=0D +[Sources]=0D + DxeTcgPhysicalPresenceLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + SecurityPkg/SecurityPkg.dec=0D diff --git a/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPrese= nceLib.c b/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPresenc= eLib.c index 8a3ae95012..9e489623c3 100644 --- a/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPresenceLib.c +++ b/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPresenceLib.c @@ -15,18 +15,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =0D #include =0D =0D +#include =0D +#include =0D +=0D #include =0D #include =0D +#include =0D #include =0D #include =0D +#include =0D #include =0D #include =0D #include =0D +#include =0D #include =0D #include =0D #include =0D +#include =0D #include =0D -#include =0D #include =0D #include =0D =0D @@ -34,6 +40,168 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =0D EFI_HII_HANDLE mPpStringPackHandle;=0D =0D +STATIC volatile QEMU_TPM_PPI *mPpi;=0D +=0D +#define TPM_PPI_PROVISION_FLAGS(PpiFlags) \=0D + ((PpiFlags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_PROVISION) !=3D= 0) \=0D + ? QEMU_TPM_PPI_FUNC_ALLOWED_USR_NOT_REQ \=0D + : QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ=0D +=0D +#define TPM_PPI_CLEAR_FLAGS(PpiFlags) \=0D + ((PpiFlags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_CLEAR) !=3D 0) = \=0D + ? QEMU_TPM_PPI_FUNC_ALLOWED_USR_NOT_REQ \=0D + : QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ=0D +=0D +#define TPM_PPI_CLEAR_MAINT_FLAGS(PpiFlags) \=0D + ((PpiFlags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_CLEAR) !=3D 0 &= & \=0D + (PpiFlags.PPFlags & TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_MAINTENANCE) != =3D 0) \=0D + ? QEMU_TPM_PPI_FUNC_ALLOWED_USR_NOT_REQ \=0D + : QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ=0D +=0D +/**=0D + Reads QEMU PPI config from fw_cfg.=0D +=0D + @param[out] The Config structure to read to.=0D +=0D + @retval EFI_SUCCESS Operation completed successfully.=0D + @retval EFI_PROTOCOL_ERROR Invalid fw_cfg entry size.=0D +**/=0D +STATIC=0D +EFI_STATUS=0D +QemuTpmReadConfig (=0D + OUT QEMU_FWCFG_TPM_CONFIG *Config=0D + )=0D +{=0D + EFI_STATUS Status;=0D + FIRMWARE_CONFIG_ITEM FwCfgItem;=0D + UINTN FwCfgSize;=0D +=0D + Status =3D QemuFwCfgFindFile ("etc/tpm/config", &FwCfgItem, &FwCfgSize);= =0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + if (FwCfgSize !=3D sizeof (*Config)) {=0D + return EFI_PROTOCOL_ERROR;=0D + }=0D +=0D + QemuFwCfgSelectItem (FwCfgItem);=0D + QemuFwCfgReadBytes (sizeof (*Config), Config);=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +/**=0D + Initilalize the QEMU PPI memory region's function array=0D +**/=0D +STATIC=0D +VOID=0D +QemuTpmInitPPIFunc(=0D + EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags=0D + )=0D +{=0D + ZeroMem ((void *)mPpi->Func, sizeof(mPpi->Func));=0D +=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ENABLE] =3D TPM_PPI_PROVISION_FLAGS(Ppi= Flags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_DISABLE] =3D TPM_PPI_PROVISION_FLAGS(Pp= iFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ACTIVATE] =3D TPM_PPI_PROVISION_FLAGS(P= piFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_DEACTIVATE] =3D TPM_PPI_PROVISION_FLAGS= (PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_CLEAR] =3D TPM_PPI_CLEAR_FLAGS(PpiFlags= );=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE] =3D TPM_PPI_PROVISION_= FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_DEACTIVATE_DISABLE] =3D TPM_PPI_PROVISI= ON_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_OWNER_INSTALL_TRUE] =3D TPM_PPI_PRO= VISION_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_OWNER_INSTALL_FALSE] =3D TPM_PPI_PR= OVISION_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_OWNER_TRUE] =3D TPM_PPI= _PROVISION_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE] =3D TPM= _PPI_PROVISION_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_OPERATOR_AUTH] =3D TPM_PPI_PROVISIO= N_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE] =3D TPM_PPI_CLEA= R_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_NO_PPI_PROVISION_FALSE] =3D QEMU_TP= M_PPI_FUNC_ALLOWED_USR_NOT_REQ;=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_NO_PPI_PROVISION_TRUE] =3D QEMU_TPM= _PPI_FUNC_ALLOWED_USR_REQ;=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_FALSE] =3D QEMU_TPM_PP= I_FUNC_ALLOWED_USR_NOT_REQ;=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_TRUE] =3D QEMU_TPM_PPI= _FUNC_ALLOWED_USR_REQ;=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_NO_PPI_MAINTENANCE_FALSE] =3D QEMU_= TPM_PPI_FUNC_ALLOWED_USR_NOT_REQ;=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_SET_NO_PPI_MAINTENANCE_TRUE] =3D QEMU_T= PM_PPI_FUNC_ALLOWED_USR_REQ;=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR] =3D TPM_PPI_CLEA= R_MAINT_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE] = =3D TPM_PPI_CLEAR_MAINT_FLAGS(PpiFlags);=0D + mPpi->Func[TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR] =3D TPM_PPI_CLEA= R_MAINT_FLAGS(PpiFlags);=0D +}=0D +=0D +=0D +/**=0D + Initializes QEMU PPI memory region.=0D +=0D + @retval EFI_SUCCESS Operation completed successfully.=0D + @retval EFI_PROTOCOL_ERROR PPI address is invalid.=0D +**/=0D +STATIC=0D +EFI_STATUS=0D +QemuTpmInitPPI (=0D + VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + QEMU_FWCFG_TPM_CONFIG Config;=0D + EFI_PHYSICAL_ADDRESS PpiAddress64;=0D + EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;=0D + EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags;=0D +=0D + if (mPpi !=3D NULL) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + Status =3D QemuTpmReadConfig (&Config);=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + if (Config.TpmVersion !=3D QEMU_TPM_VERSION_1_2) {=0D + DEBUG ((DEBUG_ERROR, "[TPM] Not setting up PPI. This is not a TPM 1.2.= \n"));=0D + return EFI_PROTOCOL_ERROR;=0D + }=0D +=0D + mPpi =3D (QEMU_TPM_PPI *)(UINTN)Config.PpiAddress;=0D + if (mPpi =3D=3D NULL) {=0D + return EFI_PROTOCOL_ERROR;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "[TPM] mPpi=3D%p version=3D%d\n", mPpi, Config.TpmVe= rsion));=0D +=0D + PpiAddress64 =3D (UINTN)mPpi;=0D + if ((PpiAddress64 & ~(UINT64)EFI_PAGE_MASK) !=3D=0D + ((PpiAddress64 + sizeof *mPpi - 1) & ~(UINT64)EFI_PAGE_MASK)) {=0D + DEBUG ((DEBUG_ERROR, "[TPM] mPpi crosses a page boundary\n"));=0D + goto InvalidPpiAddress;=0D + }=0D +=0D + Status =3D gDS->GetMemorySpaceDescriptor (PpiAddress64, &Descriptor);=0D + if (EFI_ERROR (Status) && Status !=3D EFI_NOT_FOUND) {=0D + ASSERT_EFI_ERROR (Status);=0D + goto InvalidPpiAddress;=0D + }=0D + if (!EFI_ERROR (Status) &&=0D + (Descriptor.GcdMemoryType !=3D EfiGcdMemoryTypeMemoryMappedIo &&=0D + Descriptor.GcdMemoryType !=3D EfiGcdMemoryTypeNonExistent)) {=0D + DEBUG ((DEBUG_ERROR, "[TPM] mPpi has an invalid memory type\n"));=0D + goto InvalidPpiAddress;=0D + }=0D +=0D + PpiFlags.PPFlags =3D 0;=0D + QemuTpmInitPPIFunc(PpiFlags);=0D +=0D + if (mPpi->In =3D=3D 0) {=0D + mPpi->In =3D 1;=0D + mPpi->Request =3D PHYSICAL_PRESENCE_NO_ACTION;=0D + mPpi->LastRequest =3D PHYSICAL_PRESENCE_NO_ACTION;=0D + mPpi->NextStep =3D PHYSICAL_PRESENCE_NO_ACTION;=0D + }=0D +=0D + return EFI_SUCCESS;=0D +=0D +InvalidPpiAddress:=0D + mPpi =3D NULL;=0D + return EFI_PROTOCOL_ERROR;=0D +}=0D +=0D /**=0D Get string by string id from HII Interface.=0D =0D @@ -506,7 +674,7 @@ TcgPhysicalPresenceLibConstructor ( IN EFI_SYSTEM_TABLE *SystemTable=0D )=0D {=0D - mPpStringPackHandle =3D HiiAddPackages (&gEfiPhysicalPresenceGuid, Image= Handle, DxeTcgPhysicalPresenceLibStrings, NULL);=0D + mPpStringPackHandle =3D HiiAddPackages (&gEfiPhysicalPresenceGuid, Image= Handle, TcgPhysicalPresenceLibQemuStrings, NULL);=0D ASSERT (mPpStringPackHandle !=3D NULL);=0D =0D return EFI_SUCCESS;=0D @@ -875,6 +1043,10 @@ UserConfirm ( return FALSE;=0D }=0D =0D + // Console for user interaction=0D + // We need to connect all trusted consoles for TCG PP. Here we treat all= consoles in OVMF to be trusted consoles.=0D + EfiBootManagerConnectAllDefaultConsoles ();=0D +=0D TmpStr1 =3D PhysicalPresenceGetStringById (STRING_TOKEN (TPM_REJECT_KEY)= );=0D BufSize -=3D StrSize (ConfirmText);=0D UnicodeSPrint (ConfirmText + StrLen (ConfirmText), BufSize, TmpStr1, Tmp= Str2);=0D @@ -975,7 +1147,7 @@ HaveValidTpmRequest ( =0D default:=0D if (TcgPpData->PPRequest >=3D TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_= OPERATION) {=0D - IsRequestValid =3D TcgPpVendorLibHasValidRequest (TcgPpData->PPReq= uest, Flags.PPFlags, RequestConfirmed);=0D + IsRequestValid =3D FALSE; // vendor-specifc commands are not suppo= rted=0D if (!IsRequestValid) {=0D return FALSE;=0D } else {=0D @@ -1015,60 +1187,47 @@ HaveValidTpmRequest ( @param[in] Flags The physical presence interface flags.=0D =0D **/=0D +STATIC=0D VOID=0D ExecutePendingTpmRequest (=0D IN EFI_TCG_PROTOCOL *TcgProtocol,=0D - IN EFI_PHYSICAL_PRESENCE *TcgPpData,=0D IN EFI_PHYSICAL_PRESENCE_FLAGS Flags=0D )=0D {=0D EFI_STATUS Status;=0D - UINTN DataSize;=0D BOOLEAN RequestConfirmed;=0D + EFI_PHYSICAL_PRESENCE TcgPpData;=0D EFI_PHYSICAL_PRESENCE_FLAGS NewFlags;=0D - BOOLEAN ResetRequired;=0D - UINT32 NewPPFlags;=0D =0D - if (!HaveValidTpmRequest(TcgPpData, Flags, &RequestConfirmed)) {=0D + DEBUG ((DEBUG_INFO, "[TPM] Flags=3D%x, PPRequest=3D%x\n", Flags.PPFlags,= mPpi->Request));=0D +=0D + TcgPpData.PPRequest =3D (UINT8)mPpi->Request;=0D +=0D + if (!HaveValidTpmRequest(&TcgPpData, Flags, &RequestConfirmed)) {=0D //=0D // Invalid operation request.=0D //=0D - TcgPpData->PPResponse =3D TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE;=0D - TcgPpData->LastPPRequest =3D TcgPpData->PPRequest;=0D - TcgPpData->PPRequest =3D PHYSICAL_PRESENCE_NO_ACTION;=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE);=0D - Status =3D gRT->SetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS | EFI_VARIABLE_RUNTIME_ACCESS,=0D - DataSize,=0D - TcgPpData=0D - );=0D + mPpi->Response =3D TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE;=0D + mPpi->LastRequest =3D mPpi->Request;=0D + mPpi->Request =3D TCG_PHYSICAL_PRESENCE_NO_ACTION;=0D + mPpi->RequestParameter =3D 0;=0D return;=0D }=0D =0D - ResetRequired =3D FALSE;=0D - if (TcgPpData->PPRequest >=3D TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPER= ATION) {=0D - NewFlags =3D Flags;=0D - NewPPFlags =3D NewFlags.PPFlags;=0D - TcgPpData->PPResponse =3D TcgPpVendorLibExecutePendingRequest (TcgPpDa= ta->PPRequest, &NewPPFlags, &ResetRequired);=0D - NewFlags.PPFlags =3D (UINT8)NewPPFlags;=0D - } else {=0D - if (!RequestConfirmed) {=0D - //=0D - // Print confirm text and wait for approval.=0D - //=0D - RequestConfirmed =3D UserConfirm (TcgPpData->PPRequest);=0D - }=0D -=0D + if (!RequestConfirmed) {=0D //=0D - // Execute requested physical presence command=0D + // Print confirm text and wait for approval.=0D //=0D - TcgPpData->PPResponse =3D TCG_PP_OPERATION_RESPONSE_USER_ABORT;=0D - NewFlags =3D Flags;=0D - if (RequestConfirmed) {=0D - TcgPpData->PPResponse =3D ExecutePhysicalPresence (TcgProtocol, TcgP= pData->PPRequest, &NewFlags);=0D - }=0D + RequestConfirmed =3D UserConfirm (mPpi->Request);=0D + }=0D +=0D + //=0D + // Execute requested physical presence command=0D + //=0D + mPpi->Response =3D TCG_PP_OPERATION_RESPONSE_USER_ABORT;=0D + NewFlags =3D Flags;=0D + if (RequestConfirmed) {=0D + mPpi->Response =3D ExecutePhysicalPresence (TcgProtocol, mPpi->Request= , &NewFlags);=0D }=0D =0D //=0D @@ -1085,39 +1244,32 @@ ExecutePendingTpmRequest ( if (EFI_ERROR (Status)) {=0D return;=0D }=0D +=0D + //=0D + // Update the flags for the commands following PPFlags changes=0D + //=0D + QemuTpmInitPPIFunc(NewFlags);=0D +=0D + DEBUG ((DEBUG_INFO, "[TPM] New PPFlags =3D %x\n", NewFlags.PPFlags));= =0D }=0D =0D //=0D // Clear request=0D //=0D if ((NewFlags.PPFlags & TCG_VENDOR_LIB_FLAG_RESET_TRACK) =3D=3D 0) {=0D - TcgPpData->LastPPRequest =3D TcgPpData->PPRequest;=0D - TcgPpData->PPRequest =3D PHYSICAL_PRESENCE_NO_ACTION;=0D + mPpi->LastRequest =3D mPpi->Request;=0D + mPpi->Request =3D PHYSICAL_PRESENCE_NO_ACTION;=0D + mPpi->RequestParameter =3D 0;=0D }=0D =0D - //=0D - // Save changes=0D - //=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE);=0D - Status =3D gRT->SetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACC= ESS | EFI_VARIABLE_RUNTIME_ACCESS,=0D - DataSize,=0D - TcgPpData=0D - );=0D - if (EFI_ERROR (Status)) {=0D - return;=0D - }=0D -=0D - if (TcgPpData->PPResponse =3D=3D TCG_PP_OPERATION_RESPONSE_USER_ABORT) {= =0D + if (mPpi->Response =3D=3D TCG_PP_OPERATION_RESPONSE_USER_ABORT) {=0D return;=0D }=0D =0D //=0D // Reset system to make new TPM settings in effect=0D //=0D - switch (TcgPpData->LastPPRequest) {=0D + switch (mPpi->LastRequest) {=0D case PHYSICAL_PRESENCE_ACTIVATE:=0D case PHYSICAL_PRESENCE_DEACTIVATE:=0D case PHYSICAL_PRESENCE_CLEAR:=0D @@ -1131,17 +1283,10 @@ ExecutePendingTpmRequest ( case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE:=0D break;=0D default:=0D - if (TcgPpData->LastPPRequest >=3D TCG_PHYSICAL_PRESENCE_VENDOR_SPECI= FIC_OPERATION) {=0D - if (ResetRequired) {=0D - break;=0D - } else {=0D - return ;=0D - }=0D - }=0D - if (TcgPpData->PPRequest !=3D PHYSICAL_PRESENCE_NO_ACTION) {=0D - break;=0D - }=0D - return;=0D + if (mPpi->Request !=3D TCG_PHYSICAL_PRESENCE_NO_ACTION) {=0D + break;=0D + }=0D + return;=0D }=0D =0D Print (L"Rebooting system to make TPM settings in effect\n");=0D @@ -1172,11 +1317,25 @@ TcgPhysicalPresenceLibProcessRequest ( BOOLEAN LifetimeLock;=0D BOOLEAN CmdEnable;=0D UINTN DataSize;=0D - EFI_PHYSICAL_PRESENCE TcgPpData;=0D EFI_TCG_PROTOCOL *TcgProtocol;=0D - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLockProtocol;=0D +// EDKII_VARIABLE_LOCK_PROTOCOL *VariableLockProtocol;=0D EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags;=0D =0D + Status =3D QemuTpmInitPPI ();=0D + if (EFI_ERROR (Status)) {=0D + return ;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "[TPM] Detected a TPM 1.2\n"));=0D +=0D + //=0D + // Check S4 resume=0D + //=0D + if (GetBootModeHob () =3D=3D BOOT_ON_S4_RESUME) {=0D + DEBUG ((DEBUG_INFO, "S4 Resume, Skip TPM PP process!\n"));=0D + return ;=0D + }=0D +=0D Status =3D gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&Tc= gProtocol);=0D if (EFI_ERROR (Status)) {=0D return ;=0D @@ -1213,6 +1372,7 @@ TcgPhysicalPresenceLibProcessRequest ( // This flags variable controls whether physical presence is required fo= r TPM command.=0D // It should be protected from malicious software. We set it as read-onl= y variable here.=0D //=0D +#if 0=0D Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (= VOID **)&VariableLockProtocol);=0D if (!EFI_ERROR (Status)) {=0D Status =3D VariableLockProtocol->RequestToLock (=0D @@ -1225,37 +1385,13 @@ TcgPhysicalPresenceLibProcessRequest ( ASSERT_EFI_ERROR (Status);=0D }=0D }=0D +#endif=0D =0D - //=0D - // Initialize physical presence variable.=0D - //=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE);=0D - Status =3D gRT->GetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - NULL,=0D - &DataSize,=0D - &TcgPpData=0D - );=0D - if (EFI_ERROR (Status)) {=0D - ZeroMem ((VOID*)&TcgPpData, sizeof (TcgPpData));=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE);=0D - Status =3D gRT->SetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE= _ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,=0D - DataSize,=0D - &TcgPpData=0D - );=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "[TPM] Set physical presence variable failed, S= tatus =3D %r\n", Status));=0D - return;=0D - }=0D - }=0D + QemuTpmInitPPIFunc(PpiFlags);=0D =0D - DEBUG ((DEBUG_INFO, "[TPM] Flags=3D%x, PPRequest=3D%x\n", PpiFlags.PPFla= gs, TcgPpData.PPRequest));=0D + DEBUG ((DEBUG_INFO, "[TPM] Flags=3D%x, PPRequest=3D%x\n", PpiFlags.PPFla= gs, mPpi->Request));=0D =0D - if (TcgPpData.PPRequest =3D=3D PHYSICAL_PRESENCE_NO_ACTION) {=0D + if (mPpi->Request =3D=3D PHYSICAL_PRESENCE_NO_ACTION) {=0D //=0D // No operation request=0D //=0D @@ -1291,8 +1427,8 @@ TcgPhysicalPresenceLibProcessRequest ( //=0D // Execute pending TPM request.=0D //=0D - ExecutePendingTpmRequest (TcgProtocol, &TcgPpData, PpiFlags);=0D - DEBUG ((DEBUG_INFO, "[TPM] PPResponse =3D %x\n", TcgPpData.PPResponse));= =0D + ExecutePendingTpmRequest (TcgProtocol, PpiFlags);=0D + DEBUG ((DEBUG_INFO, "[TPM] PPResponse =3D %x\n", mPpi->Response));=0D =0D //=0D // Lock physical presence.=0D @@ -1300,104 +1436,6 @@ TcgPhysicalPresenceLibProcessRequest ( TpmPhysicalPresence (TcgProtocol, TPM_PHYSICAL_PRESENCE_NOTPRESENT | TPM= _PHYSICAL_PRESENCE_LOCK);=0D }=0D =0D -/**=0D - Check if the pending TPM request needs user input to confirm.=0D -=0D - The TPM request may come from OS. This API will check if TPM request exi= sts and need user=0D - input to confirmation.=0D -=0D - @retval TRUE TPM needs input to confirm user physical presence= .=0D - @retval FALSE TPM doesn't need input to confirm user physical p= resence.=0D -=0D -**/=0D -BOOLEAN=0D -EFIAPI=0D -TcgPhysicalPresenceLibNeedUserConfirm(=0D - VOID=0D - )=0D -{=0D - EFI_STATUS Status;=0D - EFI_PHYSICAL_PRESENCE TcgPpData;=0D - UINTN DataSize;=0D - BOOLEAN RequestConfirmed;=0D - BOOLEAN LifetimeLock;=0D - BOOLEAN CmdEnable;=0D - EFI_TCG_PROTOCOL *TcgProtocol;=0D - EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags;=0D -=0D - Status =3D gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&Tc= gProtocol);=0D - if (EFI_ERROR (Status)) {=0D - return FALSE;=0D - }=0D -=0D - //=0D - // Check Tpm requests=0D - //=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE);=0D - Status =3D gRT->GetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - NULL,=0D - &DataSize,=0D - &TcgPpData=0D - );=0D - if (EFI_ERROR (Status)) {=0D - return FALSE;=0D - }=0D -=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE_FLAGS);=0D - Status =3D gRT->GetVariable (=0D - PHYSICAL_PRESENCE_FLAGS_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - NULL,=0D - &DataSize,=0D - &PpiFlags=0D - );=0D - if (EFI_ERROR (Status)) {=0D - return FALSE;=0D - }=0D -=0D - if (TcgPpData.PPRequest =3D=3D PHYSICAL_PRESENCE_NO_ACTION) {=0D - //=0D - // No operation request=0D - //=0D - return FALSE;=0D - }=0D -=0D - if (!HaveValidTpmRequest(&TcgPpData, PpiFlags, &RequestConfirmed)) {=0D - //=0D - // Invalid operation request.=0D - //=0D - return FALSE;=0D - }=0D -=0D - //=0D - // Check Tpm Capability=0D - //=0D - Status =3D GetTpmCapability (TcgProtocol, &LifetimeLock, &CmdEnable);=0D - if (EFI_ERROR (Status)) {=0D - return FALSE;=0D - }=0D -=0D - if (!CmdEnable) {=0D - if (LifetimeLock) {=0D - //=0D - // physicalPresenceCMDEnable is locked, can't execute physical prese= nce command.=0D - //=0D - return FALSE;=0D - }=0D - }=0D -=0D - if (!RequestConfirmed) {=0D - //=0D - // Need UI to confirm=0D - //=0D - return TRUE;=0D - }=0D -=0D - return FALSE;=0D -}=0D -=0D /**=0D The handler for TPM physical presence function:=0D Submit TPM Operation Request to Pre-OS Environment and=0D @@ -1416,40 +1454,16 @@ TcgPhysicalPresenceLibSubmitRequestToPreOSFunction ( IN UINT32 OperationRequest=0D )=0D {=0D - EFI_STATUS Status;=0D - UINTN DataSize;=0D - EFI_PHYSICAL_PRESENCE PpData;=0D + EFI_STATUS Status;=0D =0D DEBUG ((DEBUG_INFO, "[TPM] SubmitRequestToPreOSFunction, Request =3D %x\= n", OperationRequest));=0D =0D - //=0D - // Get the Physical Presence variable=0D - //=0D - DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE);=0D - Status =3D gRT->GetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - NULL,=0D - &DataSize,=0D - &PpData=0D - );=0D + Status =3D QemuTpmInitPPI ();=0D if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "[TPM] Get PP variable failure! Status =3D %r\n",= Status));=0D return TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;=0D }=0D =0D - PpData.PPRequest =3D (UINT8)OperationRequest;=0D - Status =3D gRT->SetVariable (=0D - PHYSICAL_PRESENCE_VARIABLE,=0D - &gEfiPhysicalPresenceGuid,=0D - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS | EFI_VARIABLE_RUNTIME_ACCESS,=0D - DataSize,=0D - &PpData=0D - );=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "[TPM] Set PP variable failure! Status =3D %r\n",= Status));=0D - return TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;=0D - }=0D + mPpi->Request =3D OperationRequest;=0D =0D return TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS;=0D }=0D diff --git a/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPrese= nceLib.inf b/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPrese= nceLib.inf index cfe14f20ca..a7f76d5918 100644 --- a/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPresenceLib.= inf +++ b/OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcgPhysicalPresenceLib.= inf @@ -16,9 +16,8 @@ =0D [Defines]=0D INF_VERSION =3D 0x00010005=0D - BASE_NAME =3D DxeTcgPhysicalPresenceLib=0D - MODULE_UNI_FILE =3D DxeTcgPhysicalPresenceLib.uni=0D - FILE_GUID =3D EBC43A46-34AC-4F07-A7F5-A5394619361C= =0D + BASE_NAME =3D TcgPhysicalPresenceLibQemu=0D + FILE_GUID =3D DA5A2055-ACD6-49A1-8277-857f3A47BB0C= =0D MODULE_TYPE =3D DXE_DRIVER=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D TcgPhysicalPresenceLib|DXE_DRIVER DXE= _RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER=0D @@ -37,19 +36,22 @@ [Packages]=0D MdePkg/MdePkg.dec=0D MdeModulePkg/MdeModulePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D SecurityPkg/SecurityPkg.dec=0D =0D [LibraryClasses]=0D MemoryAllocationLib=0D + DxeServicesTableLib=0D + HobLib=0D + QemuFwCfgLib=0D + UefiBootManagerLib=0D UefiLib=0D UefiBootServicesTableLib=0D - UefiDriverEntryPoint=0D UefiRuntimeServicesTableLib=0D BaseMemoryLib=0D DebugLib=0D PrintLib=0D HiiLib=0D - TcgPpVendorLib=0D =0D [Protocols]=0D gEfiTcgProtocolGuid ## SOMETIMES_CONSUMES=0D @@ -57,8 +59,6 @@ =0D [Guids]=0D ## SOMETIMES_CONSUMES ## HII=0D - ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"=0D - ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"=0D ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresenceFlags"=0D ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"=0D gEfiPhysicalPresenceGuid=0D diff --git a/OvmfPkg/OvmfTpmLibs.dsc.inc b/OvmfPkg/OvmfTpmLibs.dsc.inc index 418747b134..24b54861ed 100644 --- a/OvmfPkg/OvmfTpmLibs.dsc.inc +++ b/OvmfPkg/OvmfTpmLibs.dsc.inc @@ -5,6 +5,9 @@ !if $(TPM2_ENABLE) =3D=3D TRUE=0D !if $(TPM1_ENABLE) =3D=3D TRUE=0D Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf= =0D + TcgPhysicalPresenceLib|OvmfPkg/Library/TcgPhysicalPresenceLibQemu/DxeTcg= PhysicalPresenceLib.inf=0D +!else=0D + TcgPhysicalPresenceLib|OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcg= PhysicalPresenceLib.inf=0D !endif=0D Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf=0D Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeT= cg2PhysicalPresenceLib.inf=0D @@ -13,4 +16,5 @@ !else=0D Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeT= cg2PhysicalPresenceLib.inf=0D TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf=0D + TcgPhysicalPresenceLib|OvmfPkg/Library/TcgPhysicalPresenceLibNull/DxeTcg= PhysicalPresenceLib.inf=0D !endif=0D diff --git a/SecurityPkg/Include/Library/TcgPhysicalPresenceLib.h b/Securit= yPkg/Include/Library/TcgPhysicalPresenceLib.h index 9826a79742..6877c08e74 100644 --- a/SecurityPkg/Include/Library/TcgPhysicalPresenceLib.h +++ b/SecurityPkg/Include/Library/TcgPhysicalPresenceLib.h @@ -45,4 +45,43 @@ TcgPhysicalPresenceLibNeedUserConfirm( VOID=0D );=0D =0D +/**=0D + The handler for TPM physical presence function:=0D + Return TPM Operation Response to OS Environment.=0D +=0D + This API should be invoked in OS runtime phase to interface with ACPI me= thod.=0D +=0D + @param[out] MostRecentRequest Most recent operation request.=0D + @param[out] Response Response to the most recent operation = request.=0D +=0D + @return Return Code for Return TPM Operation Response to OS Environment.= =0D +**/=0D +UINT32=0D +EFIAPI=0D +Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (=0D + OUT UINT32 *MostRecentRequest,=0D + OUT UINT32 *Response=0D + );=0D +=0D +/**=0D + The handler for TPM physical presence function:=0D + Submit TPM Operation Request to Pre-OS Environment and=0D + Submit TPM Operation Request to Pre-OS Environment 2.=0D +=0D + This API should be invoked in OS runtime phase to interface with ACPI me= thod.=0D +=0D + Caution: This function may receive untrusted input.=0D +=0D + @param[in] OperationRequest TPM physical presence operation request= .=0D + @param[in] RequestParameter TPM physical presence operation request= parameter.=0D +=0D + @return Return Code for Submit TPM Operation Request to Pre-OS Environme= nt and=0D + Submit TPM Operation Request to Pre-OS Environment 2.=0D +**/=0D +UINT32=0D +EFIAPI=0D +TcgPhysicalPresenceLibSubmitRequestToPreOSFunction (=0D + IN UINT32 OperationRequest=0D + );=0D +=0D #endif=0D diff --git a/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf b/SecurityPkg/Tc= g/TcgConfigDxe/TcgConfigDxe.inf index 24428e050c..b2f36fdbb2 100644 --- a/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf +++ b/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf @@ -47,6 +47,7 @@ HiiLib=0D PcdLib=0D PrintLib=0D + TcgPhysicalPresenceLib=0D Tpm12DeviceLib=0D =0D [Guids]=0D --=20 2.31.1