From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web08.39458.1609114108710212681 for ; Sun, 27 Dec 2020 16:08:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Pp05ZDJR; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: jiewen.yao@intel.com) IronPort-SDR: h2up0bdnAoHdzitMjNudNbiJ/LHYJyBcJIjG1vTcfJ/Ass1B4uUx367pPKwFtPx8w1pma+H/sY lwwG9PfpfedA== X-IronPort-AV: E=McAfee;i="6000,8403,9847"; a="240414667" X-IronPort-AV: E=Sophos;i="5.78,453,1599548400"; d="scan'208";a="240414667" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2020 16:08:27 -0800 IronPort-SDR: MEEYSW/FpE83YlWYxgrgIZ/T4tRiaKR4XXWea9fsi9JbEIhcRaKuKUkqe9Mj5sTOseI1fV5Y8a +V0nD5aBBWEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,453,1599548400"; d="scan'208";a="346760025" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 27 Dec 2020 16:08:27 -0800 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 27 Dec 2020 16:08:26 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 27 Dec 2020 16:08:26 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Sun, 27 Dec 2020 16:08:26 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R7iraa1aF4anKNqN3gaJ4uZEK+8M+8ITPDM1qFyHtt7OL+PY7swgXR1iNAVncYwdb+taxStqP0tw2/yzQN7UkLlQz+Sd+tXKouhMYBsZ8DmIZxeDfpWRcqVpGzRb/hr64IREHMc0tL1Gh7nqXVScC1TSUR7okW25+FZZoOI2RS8ReljUkKOJM3qFZyr8Werk09XIpEmKxrIsOMjBzYQnGMF8Ptafz3+zNEiDkMfmDDzfraf12H5rWsQepnAqZqoyZRK+qRKP5uKcoNp6M3MJKHqrkfnf7RUdWMLHn/04lDBI+x/Eejh18mPWKcaX3J6EWzXS1EuUEyABtq9axOjhwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F4cCLcA5aR/NrFQSu8gTjfj3MeDzB+lPTkgoJ1oj/oM=; b=hB0ehMROOhyGI7OTVyxMLTRmxQMQ/eYmTP0x7LhV25xTmFLmiDTAyIAafu7uJFCcVRjXNGY11EDktfTBT88OrGUqmq2b0YonqhStfFO6DGgfgND9tNltfsWP+dmuPPxMP9x6wW+ekYxozXaQBhoIkrTPCSPk9cHZvQDsa2QrdAUKxEgn83LS/JnKtcTeFyUP4815k3n7n/xiUjeofPd5zkYHNVzDknLn4h3xm/enRER/Z/QdsZhox8OYO16KytSalmbHmBvo/nqHTWpjimRiQ58TdxxLPYhSP39Ug14hWjND9Is/MBv7ZFkjlzESRTogET9v1ooK+gK4CBaFiybctw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F4cCLcA5aR/NrFQSu8gTjfj3MeDzB+lPTkgoJ1oj/oM=; b=Pp05ZDJR8farc+48IRga/6lxTuLtQ8+9I9LR3s7pgCSRcB0oSV4vsAFy9eJfTQvX3qxOnfhkDSeiLuxf89KoWvdoVKy/4uWjTP03Xc+hPM1hh8gQakDnOJyL06K1czgI76J4KLT+xEblT/ShyBZuPlhR7HTboi6rHqBi9WUjTxA= Received: from CY4PR11MB1288.namprd11.prod.outlook.com (2603:10b6:903:23::8) by CY4PR11MB0054.namprd11.prod.outlook.com (2603:10b6:910:79::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Mon, 28 Dec 2020 00:08:22 +0000 Received: from CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::e058:fd5a:28d8:2b17]) by CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::e058:fd5a:28d8:2b17%12]) with mapi id 15.20.3700.031; Mon, 28 Dec 2020 00:08:22 +0000 From: "Yao, Jiewen" To: Kun Qin , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Zhang, Qi1" , "Kumar, Rahul1" Subject: Re: [PATCH v1 11/15] SecurityPkg: Tcg2PhysicalPresenceLib: Introduce StandaloneMm instance Thread-Topic: [PATCH v1 11/15] SecurityPkg: Tcg2PhysicalPresenceLib: Introduce StandaloneMm instance Thread-Index: AQHW1W69xAf2CkW9REWpjyszAv3VD6oLr8/w Date: Mon, 28 Dec 2020 00:08:21 +0000 Message-ID: References: <20201218185011.1366-1-kun.q@outlook.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: outlook.com; dkim=none (message not signed) header.d=none;outlook.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cbe3c0e8-a2aa-4655-88a4-08d8aac4b0a4 x-ms-traffictypediagnostic: CY4PR11MB0054: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2276; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: k8BGEQdkc062KoapVotB6yyHqSPfSBENeTsc8ZF/VoLerjnzMT3gUSpDkb8bkvm72Re48Olwen2YPO+gN/aRdIgjBMXsBU0oxKAsw6H0OqV6Sr8IVAz6t/BqPYs+3zOLXmlIZlQ0NeVFULSobu2w9bsFmxEmVJHceNMgSqwYfdyNRi4lNRrhm+2SaQHiyDVJNeNV5hU19VCuDjILFaZ6Qy1bQyyBP3M2BpH0MXG5D14YHae3OOSmskMkli7e2GlkbSAaqy7tNr9NuoIrvqQBlwEQ3+tvJNY6X6o0fD0AGLOvmPoQ2EjN4lQCKV2bBwfrcNKZef1oxlODd/qnpVinQA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1288.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(346002)(376002)(136003)(366004)(396003)(15650500001)(66476007)(4326008)(66446008)(26005)(54906003)(110136005)(5660300002)(2906002)(83380400001)(45080400002)(64756008)(52536014)(76116006)(86362001)(66946007)(8676002)(6506007)(107886003)(19627235002)(8936002)(9686003)(316002)(7696005)(53546011)(71200400001)(55016002)(66556008)(30864003)(33656002)(478600001)(186003)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?AIyzc7f2I+vm+8i3tT6QOb8PoJwC+I2eLv+GPZiPvjkI+h6rU6imFz+iwtDL?= =?us-ascii?Q?ANKm6ZHLCfuVAb6aPoQGSazAVf3UwHPb2zdvj8YW8368Nzd9/adIp7SmYy/3?= =?us-ascii?Q?hvAk2PsR3uv8JGYeauGMvPzpv7c7gLXqX1pYsgLPb8SSMlXueykvHdTctqLR?= =?us-ascii?Q?oJk8qNGw9+lysJwBc6oA0HMKViNfk8c3sW9I9BiG0RBQqc/ne4ApdMGDtd+T?= =?us-ascii?Q?y+YpGQxJvvfaGtlC6Nh2jqaKLbKyIklJev2MKcPH4OY0AzNlywVPr+7GclWs?= =?us-ascii?Q?5FHXwtTipDcGSR0hagT7227E1cioajZfdcaJtaVmsnj6XPAZM7uz9IsIDowZ?= =?us-ascii?Q?xkTwd2IYikibB1B/QNtuvqZy1nON4WX1cXhZZERyQ4BjtNtMAKzwcvlG531f?= =?us-ascii?Q?Xa8cn99RFwzxchC7JDbRn4PDxAGQLPsPNQJNukodU9zZycxcOq2mxdw/HfdY?= =?us-ascii?Q?QhKE2H71SJLxevMusn9j8OVxZveDjkJ0pwiPDqoLrusWLL7GDDIroy/ppd31?= =?us-ascii?Q?THGmDFUHz34x6X6muZhpbxt3CRtaII02x8QKT/3+c2zxN2NH8toH+UGlzcOc?= =?us-ascii?Q?qYJuoYgZ2czbVtegJWJTRU2Ldx3eUXe5wHZ+vgsFzJU/O98VMCoghCl71j/7?= =?us-ascii?Q?cVTBByasqoZJ9y8vK3MvlMtD+GU8Je6FrD0X7p9WIlOMo6MlG44ER9wjuck8?= =?us-ascii?Q?vmNl1HMd9Lyddy3h70+RyTlR5Ip0FJ2SZ2X4A3jRm8aMHt2vrerwY7pRIt23?= =?us-ascii?Q?3/C8bszz71/Djr7Pp8ukhwURP8rY6JAXlqw78hCZQyG2ztsuBGifguutg3S0?= =?us-ascii?Q?W5+wEZRVXPo32B6Zrj4meTqs60emObzRKLELYcjacGwxAZtKDaf2Ocle6pUo?= =?us-ascii?Q?1FWB17yD+a+9zoUrmA4gLeAxZ7bbsyqHDDhMwB2jYpp+/Tfzh8EeS0TwoSVZ?= =?us-ascii?Q?i3qgvgUKL35uhIeagsXjQfbvUv4fE3mLtW6DXbe6gsA=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1288.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbe3c0e8-a2aa-4655-88a4-08d8aac4b0a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Dec 2020 00:08:22.0242 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Q4DJxlouMp2SyMFXheJ6gvTx0fZHtWb53hVcIj7c7BI05HRldAQ6zAn/C0awVoab9YTRlhhsbZJ7kZLNrofVYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB0054 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen Yao > -----Original Message----- > From: Kun Qin > Sent: Saturday, December 19, 2020 2:50 AM > To: devel@edk2.groups.io > Cc: Yao, Jiewen ; Wang, Jian J > ; Zhang, Qi1 ; Kumar, > Rahul1 > Subject: [PATCH v1 11/15] SecurityPkg: Tcg2PhysicalPresenceLib: Introduce > StandaloneMm instance >=20 > This change added a new instance of Tcg2PhysicalPresenceLib to support > MM_STANDALONE type drivers. It centralizes the common routines into > shared files and abstract the library constructor into corresponding > files to implement each constructor function prototypes. >=20 > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Qi Zhang > Cc: Rahul Kumar >=20 > Signed-off-by: Kun Qin > --- >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/{SmmTcg2PhysicalPrese > nceLib.c =3D> MmTcg2PhysicalPresenceLibCommon.c} | 29 +- >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen > ceLib.c | 368 +-----------= -------- >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Phys > icalPresenceLib.c | 42 +++ >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenc > eLibCommon.h | 35 ++ >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen > ceLib.inf | 6 +- >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/{SmmTcg2PhysicalPrese > nceLib.inf =3D> StandaloneMmTcg2PhysicalPresenceLib.inf} | 22 +- > SecurityPkg/SecurityPkg.dsc > | 2 + > 7 files changed, 114 insertions(+), 390 deletions(-) >=20 > diff --git > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.c > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPrese > nceLibCommon.c > similarity index 91% > copy from > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen > ceLib.c > copy to > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenc > eLibCommon.c > index 8afaa0a7857d..90023f09a042 100644 > --- > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.c > +++ > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPrese > nceLibCommon.c > @@ -15,7 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > -#include > +#include >=20 > #include >=20 > @@ -25,7 +25,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include > #include > #include > -#include > +#include >=20 > #define PP_INF_VERSION_1_2 "1.2" >=20 > @@ -55,7 +55,7 @@ > Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( > UINTN DataSize; > EFI_TCG2_PHYSICAL_PRESENCE PpData; >=20 > - DEBUG ((EFI_D_INFO, "[TPM2] > ReturnOperationResponseToOsFunction\n")); > + DEBUG ((DEBUG_INFO, "[TPM2] > ReturnOperationResponseToOsFunction\n")); >=20 > // > // Get the Physical Presence variable > @@ -71,7 +71,7 @@ > Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( > if (EFI_ERROR (Status)) { > *MostRecentRequest =3D 0; > *Response =3D 0; > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > + DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE; > } >=20 > @@ -108,7 +108,7 @@ > Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( > EFI_TCG2_PHYSICAL_PRESENCE PpData; > EFI_TCG2_PHYSICAL_PRESENCE_FLAGS Flags; >=20 > - DEBUG ((EFI_D_INFO, "[TPM2] SubmitRequestToPreOSFunction, Request > =3D %x, %x\n", *OperationRequest, *RequestParameter)); > + DEBUG ((DEBUG_INFO, "[TPM2] SubmitRequestToPreOSFunction, > Request =3D %x, %x\n", *OperationRequest, *RequestParameter)); > ReturnCode =3D TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS; >=20 > // > @@ -123,7 +123,7 @@ > Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( > &PpData > ); > if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > + DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > ReturnCode =3D > TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE; > goto EXIT; > } > @@ -147,7 +147,7 @@ > Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( > &PpData > ); > if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Set PP variable failure! Status =3D %= r\n", > Status)); > + DEBUG ((DEBUG_ERROR, "[TPM2] Set PP variable failure! Status > =3D %r\n", Status)); > ReturnCode =3D > TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE; > goto EXIT; > } > @@ -173,7 +173,7 @@ > Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( > // Sync PPRQ/PPRM from PP Variable if PP submission fails > // > if (ReturnCode !=3D TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Submit PP Request failure! Sync > PPRQ/PPRM with PP variable.\n", Status)); > + DEBUG ((DEBUG_ERROR, "[TPM2] Submit PP Request failure! Sync > PPRQ/PPRM with PP variable.\n", Status)); > DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE); > ZeroMem(&PpData, DataSize); > Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > @@ -245,7 +245,7 @@ > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction ( > EFI_TCG2_PHYSICAL_PRESENCE_FLAGS Flags; > BOOLEAN RequestConfirmed; >=20 > - DEBUG ((EFI_D_INFO, "[TPM2] GetUserConfirmationStatusFunction, > Request =3D %x\n", OperationRequest)); > + DEBUG ((DEBUG_INFO, "[TPM2] GetUserConfirmationStatusFunction, > Request =3D %x\n", OperationRequest)); >=20 > // > // Get the Physical Presence variable > @@ -259,7 +259,7 @@ > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction ( > &PpData > ); > if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > + DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > return > TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION; > } > // > @@ -274,7 +274,7 @@ > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction ( > &Flags > ); > if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP flags failure! Status =3D %r\n", > Status)); > + DEBUG ((DEBUG_ERROR, "[TPM2] Get PP flags failure! Status =3D %r\n", > Status)); > return > TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION; > } >=20 > @@ -380,9 +380,8 @@ > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction ( > **/ > EFI_STATUS > EFIAPI > -Tcg2PhysicalPresenceLibConstructor ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > +Tcg2PhysicalPresenceLibCommonConstructor ( > + VOID > ) > { > EFI_STATUS Status; > @@ -394,7 +393,7 @@ Tcg2PhysicalPresenceLibConstructor ( > // > // Locate SmmVariableProtocol. > // > - Status =3D gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, > NULL, (VOID**)&mTcg2PpSmmVariable); > + Status =3D gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, > NULL, (VOID**)&mTcg2PpSmmVariable); > ASSERT_EFI_ERROR (Status); >=20 > mTcg2PhysicalPresenceFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags); > diff --git > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.c > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.c > index 8afaa0a7857d..36d8b89dcdd9 100644 > --- > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.c > +++ > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.c > @@ -17,355 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > #include >=20 > -#include > - > -#include > - > -#include > -#include > -#include > -#include > -#include > - > -#define PP_INF_VERSION_1_2 "1.2" > - > -EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable; > -BOOLEAN mIsTcg2PPVerLowerThan_1_3 =3D FALSE; > -UINT32 mTcg2PhysicalPresenceFlags; > - > -/** > - The handler for TPM physical presence function: > - Return TPM Operation Response to OS Environment. > - > - This API should be invoked in OS runtime phase to interface with ACPI > method. > - > - @param[out] MostRecentRequest Most recent operation request. > - @param[out] Response Response to the most recent operatio= n > request. > - > - @return Return Code for Return TPM Operation Response to OS > Environment. > -**/ > -UINT32 > -EFIAPI > -Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( > - OUT UINT32 *MostRecentRequest, > - OUT UINT32 *Response > - ) > -{ > - EFI_STATUS Status; > - UINTN DataSize; > - EFI_TCG2_PHYSICAL_PRESENCE PpData; > - > - DEBUG ((EFI_D_INFO, "[TPM2] > ReturnOperationResponseToOsFunction\n")); > - > - // > - // Get the Physical Presence variable > - // > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE); > - Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > - TCG2_PHYSICAL_PRESENCE_VARIABLE, > - &gEfiTcg2PhysicalPresenceGuid, > - NULL, > - &DataSize, > - &PpData > - ); > - if (EFI_ERROR (Status)) { > - *MostRecentRequest =3D 0; > - *Response =3D 0; > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > - return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE; > - } > - > - *MostRecentRequest =3D PpData.LastPPRequest; > - *Response =3D PpData.PPResponse; > - > - return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS; > -} > - > -/** > - The handler for TPM physical presence function: > - Submit TPM Operation Request to Pre-OS Environment and > - Submit TPM Operation Request to Pre-OS Environment 2. > - > - This API should be invoked in OS runtime phase to interface with ACPI > method. > - > - Caution: This function may receive untrusted input. > - > - @param[in, out] Pointer to OperationRequest TPM physical presence > operation request. > - @param[in, out] Pointer to RequestParameter TPM physical presence > operation request parameter. > - > - @return Return Code for Submit TPM Operation Request to Pre-OS > Environment and > - Submit TPM Operation Request to Pre-OS Environment 2. > - **/ > -UINT32 > -Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( > - IN OUT UINT32 *OperationRequest, > - IN OUT UINT32 *RequestParameter > - ) > -{ > - EFI_STATUS Status; > - UINT32 ReturnCode; > - UINTN DataSize; > - EFI_TCG2_PHYSICAL_PRESENCE PpData; > - EFI_TCG2_PHYSICAL_PRESENCE_FLAGS Flags; > - > - DEBUG ((EFI_D_INFO, "[TPM2] SubmitRequestToPreOSFunction, Request > =3D %x, %x\n", *OperationRequest, *RequestParameter)); > - ReturnCode =3D TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS; > - > - // > - // Get the Physical Presence variable > - // > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE); > - Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > - TCG2_PHYSICAL_PRESENCE_VARIABLE, > - &gEfiTcg2PhysicalPresenceGuid, > - NULL, > - &DataSize, > - &PpData > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > - ReturnCode =3D > TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE; > - goto EXIT; > - } > - > - if ((*OperationRequest > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) > && > - (*OperationRequest < > TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN) ) { > - ReturnCode =3D > TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED; > - goto EXIT; > - } > - > - if ((PpData.PPRequest !=3D *OperationRequest) || > - (PpData.PPRequestParameter !=3D *RequestParameter)) { > - PpData.PPRequest =3D (UINT8)*OperationRequest; > - PpData.PPRequestParameter =3D *RequestParameter; > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE); > - Status =3D mTcg2PpSmmVariable->SmmSetVariable ( > - TCG2_PHYSICAL_PRESENCE_VARIABLE, > - &gEfiTcg2PhysicalPresenceGuid, > - EFI_VARIABLE_NON_VOLATILE | > EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, > - DataSize, > - &PpData > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Set PP variable failure! Status =3D %= r\n", > Status)); > - ReturnCode =3D > TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE; > - goto EXIT; > - } > - } > - > - if (*OperationRequest >=3D > TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS); > - Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > - TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE= , > - &gEfiTcg2PhysicalPresenceGuid, > - NULL, > - &DataSize, > - &Flags > - ); > - if (EFI_ERROR (Status)) { > - Flags.PPFlags =3D mTcg2PhysicalPresenceFlags; > - } > - ReturnCode =3D Tcg2PpVendorLibSubmitRequestToPreOSFunction > (*OperationRequest, Flags.PPFlags, *RequestParameter); > - } > - > -EXIT: > - // > - // Sync PPRQ/PPRM from PP Variable if PP submission fails > - // > - if (ReturnCode !=3D TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Submit PP Request failure! Sync > PPRQ/PPRM with PP variable.\n", Status)); > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE); > - ZeroMem(&PpData, DataSize); > - Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > - TCG2_PHYSICAL_PRESENCE_VARIABLE, > - &gEfiTcg2PhysicalPresenceGuid, > - NULL, > - &DataSize, > - &PpData > - ); > - *OperationRequest =3D (UINT32)PpData.PPRequest; > - *RequestParameter =3D PpData.PPRequestParameter; > - } > - > - return ReturnCode; > -} > - > -/** > - The handler for TPM physical presence function: > - Submit TPM Operation Request to Pre-OS Environment and > - Submit TPM Operation Request to Pre-OS Environment 2. > - > - This API should be invoked in OS runtime phase to interface with ACPI > method. > - > - Caution: This function may receive untrusted input. > - > - @param[in] OperationRequest TPM physical presence operation > request. > - @param[in] RequestParameter TPM physical presence operation > request parameter. > - > - @return Return Code for Submit TPM Operation Request to Pre-OS > Environment and > - Submit TPM Operation Request to Pre-OS Environment 2. > -**/ > -UINT32 > -EFIAPI > -Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction ( > - IN UINT32 OperationRequest, > - IN UINT32 RequestParameter > - ) > -{ > - UINT32 TempOperationRequest; > - UINT32 TempRequestParameter; > - > - TempOperationRequest =3D OperationRequest; > - TempRequestParameter =3D RequestParameter; > - > - return > Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx(&TempOperatio > nRequest, &TempRequestParameter); > -} > - > -/** > - The handler for TPM physical presence function: > - Get User Confirmation Status for Operation. > - > - This API should be invoked in OS runtime phase to interface with ACPI > method. > - > - Caution: This function may receive untrusted input. > - > - @param[in] OperationRequest TPM physical presence operation > request. > - > - @return Return Code for Get User Confirmation Status for Operation. > -**/ > -UINT32 > -EFIAPI > -Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction ( > - IN UINT32 OperationRequest > - ) > -{ > - EFI_STATUS Status; > - UINTN DataSize; > - EFI_TCG2_PHYSICAL_PRESENCE PpData; > - EFI_TCG2_PHYSICAL_PRESENCE_FLAGS Flags; > - BOOLEAN RequestConfirmed; > - > - DEBUG ((EFI_D_INFO, "[TPM2] GetUserConfirmationStatusFunction, > Request =3D %x\n", OperationRequest)); > - > - // > - // Get the Physical Presence variable > - // > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE); > - Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > - TCG2_PHYSICAL_PRESENCE_VARIABLE, > - &gEfiTcg2PhysicalPresenceGuid, > - NULL, > - &DataSize, > - &PpData > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status =3D %r\= n", > Status)); > - return > TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION; > - } > - // > - // Get the Physical Presence flags > - // > - DataSize =3D sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS); > - Status =3D mTcg2PpSmmVariable->SmmGetVariable ( > - TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE, > - &gEfiTcg2PhysicalPresenceGuid, > - NULL, > - &DataSize, > - &Flags > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((EFI_D_ERROR, "[TPM2] Get PP flags failure! Status =3D %r\n", > Status)); > - return > TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION; > - } > - > - RequestConfirmed =3D FALSE; > - > - switch (OperationRequest) { > - case TCG2_PHYSICAL_PRESENCE_CLEAR: > - case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR: > - case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_2: > - case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_3: > - if ((Flags.PPFlags & > TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR) =3D=3D 0) { > - RequestConfirmed =3D TRUE; > - } > - break; > - > - case TCG2_PHYSICAL_PRESENCE_NO_ACTION: > - case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_TRUE: > - RequestConfirmed =3D TRUE; > - break; > - > - case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_FALSE: > - break; > - > - case TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS: > - if ((Flags.PPFlags & > TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCR > S) =3D=3D 0) { > - RequestConfirmed =3D TRUE; > - } > - break; > - > - case TCG2_PHYSICAL_PRESENCE_CHANGE_EPS: > - if ((Flags.PPFlags & > TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS) > =3D=3D 0) { > - RequestConfirmed =3D TRUE; > - } > - break; > - > - case TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS: > - RequestConfirmed =3D TRUE; > - break; > - > - case TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID: > - if ((Flags.PPFlags & > TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_ > BLOCK_SID) =3D=3D 0) { > - RequestConfirmed =3D TRUE; > - } > - break; > - > - case TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID: > - if ((Flags.PPFlags & > TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE > _BLOCK_SID) =3D=3D 0) { > - RequestConfirmed =3D TRUE; > - } > - break; > - > - case > TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_ > FUNC_TRUE: > - case > TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_ > FUNC_TRUE: > - RequestConfirmed =3D TRUE; > - break; > - > - case > TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_ > FUNC_FALSE: > - case > TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_ > FUNC_FALSE: > - break; > - > - default: > - if (!mIsTcg2PPVerLowerThan_1_3) { > - if (OperationRequest < > TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { > - // > - // TCG2 PP1.3 spec defined operations that are reserved or un- > implemented > - // > - return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; > - } > - } else { > - // > - // TCG PP lower than 1.3. (1.0, 1.1, 1.2) > - // > - if (OperationRequest <=3D > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) { > - RequestConfirmed =3D TRUE; > - } else if (OperationRequest < > TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { > - return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; > - } > - } > - break; > - } > - > - if (OperationRequest >=3D > TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { > - return Tcg2PpVendorLibGetUserConfirmationStatusFunction > (OperationRequest, Flags.PPFlags); > - } > - > - if (RequestConfirmed) { > - return > TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_NOT_REQUI > RED; > - } else { > - return > TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED; > - } > -} > +#include "MmTcg2PhysicalPresenceLibCommon.h" >=20 > /** > The constructor function locates SmmVariable protocol. > @@ -380,24 +32,10 @@ > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction ( > **/ > EFI_STATUS > EFIAPI > -Tcg2PhysicalPresenceLibConstructor ( > +Tcg2PhysicalPresenceLibTraditionalConstructor ( > IN EFI_HANDLE ImageHandle, > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - EFI_STATUS Status; > - > - if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 > *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), > sizeof(PP_INF_VERSION_1_2) - 1) >=3D 0) { > - mIsTcg2PPVerLowerThan_1_3 =3D TRUE; > - } > - > - // > - // Locate SmmVariableProtocol. > - // > - Status =3D gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, > NULL, (VOID**)&mTcg2PpSmmVariable); > - ASSERT_EFI_ERROR (Status); > - > - mTcg2PhysicalPresenceFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags); > - > - return EFI_SUCCESS; > + return Tcg2PhysicalPresenceLibCommonConstructor (); > } > diff --git > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Ph > ysicalPresenceLib.c > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Ph > ysicalPresenceLib.c > new file mode 100644 > index 000000000000..5c298a8d5720 > --- /dev/null > +++ > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Ph > ysicalPresenceLib.c > @@ -0,0 +1,42 @@ > +/** @file > + Handle TPM 2.0 physical presence requests from OS. > + > + This library will handle TPM 2.0 physical presence request from OS. > + > + Caution: This module requires additional review when modified. > + This driver will have external input - variable. > + This external input must be validated carefully to avoid security issu= e. > + > + Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction() > + will receive untrusted input and do validation. > + > +Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation. > +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include "MmTcg2PhysicalPresenceLibCommon.h" > + > +/** > + The constructor function locates SmmVariable protocol. > + > + It will ASSERT() if that operation fails and it will always return > EFI_SUCCESS. > + > + @param ImageHandle The firmware allocated handle for the EFI image. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The constructor successfully added string packag= e. > + @retval Other value The constructor can't add string package. > +**/ > +EFI_STATUS > +EFIAPI > +Tcg2PhysicalPresenceLibStandaloneMmConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *SystemTable > + ) > +{ > + return Tcg2PhysicalPresenceLibCommonConstructor (); > +} > diff --git > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPrese > nceLibCommon.h > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPrese > nceLibCommon.h > new file mode 100644 > index 000000000000..c53674d37f12 > --- /dev/null > +++ > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPrese > nceLibCommon.h > @@ -0,0 +1,35 @@ > +/** @file > + Handle TPM 2.0 physical presence requests from OS. > + > + This library will handle TPM 2.0 physical presence request from OS. > + > + Caution: This module requires additional review when modified. > + This driver will have external input - variable. > + This external input must be validated carefully to avoid security issu= e. > + > + Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and > Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction() > + will receive untrusted input and do validation. > + > +Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_ > +#define _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_ > + > +/** > + The constructor function locates MmVariable protocol. > + > + It will ASSERT() if that operation fails and it will always return > EFI_SUCCESS. > + > + @retval EFI_SUCCESS The constructor successfully added string packag= e. > + @retval Other value The constructor can't add string package. > +**/ > +EFI_STATUS > +EFIAPI > +Tcg2PhysicalPresenceLibCommonConstructor ( > + VOID > + ); > + > +#endif > diff --git > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.inf > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.inf > index 6a9bdf66f0a6..d911adbdb648 100644 > --- > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.inf > +++ > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.inf > @@ -20,7 +20,7 @@ [Defines] > MODULE_TYPE =3D DXE_SMM_DRIVER > VERSION_STRING =3D 1.0 > LIBRARY_CLASS =3D Tcg2PhysicalPresenceLib|DXE_SMM_DRI= VER > - CONSTRUCTOR =3D Tcg2PhysicalPresenceLibConstructor > + CONSTRUCTOR =3D > Tcg2PhysicalPresenceLibTraditionalConstructor >=20 > # > # The following information is for reference only and not required by th= e > build tools. > @@ -30,6 +30,8 @@ [Defines] >=20 > [Sources] > SmmTcg2PhysicalPresenceLib.c > + MmTcg2PhysicalPresenceLibCommon.c > + MmTcg2PhysicalPresenceLibCommon.h >=20 > [Packages] > MdePkg/MdePkg.dec > @@ -39,7 +41,7 @@ [Packages] > [LibraryClasses] > DebugLib > Tcg2PpVendorLib > - SmmServicesTableLib > + MmServicesTableLib > BaseMemoryLib >=20 > [Guids] > diff --git > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.inf > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Ph > ysicalPresenceLib.inf > similarity index 64% > copy from > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen > ceLib.inf > copy to > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Phys > icalPresenceLib.inf > index 6a9bdf66f0a6..6d11b6b9f198 100644 > --- > a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres > enceLib.inf > +++ > b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Ph > ysicalPresenceLib.inf > @@ -8,19 +8,20 @@ > # This external input must be validated carefully to avoid security iss= ue. > # > # Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> +# Copyright (c) Microsoft Corporation. > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## >=20 > [Defines] > INF_VERSION =3D 0x00010005 > - BASE_NAME =3D SmmTcg2PhysicalPresenceLib > - MODULE_UNI_FILE =3D SmmTcg2PhysicalPresenceLib.uni > - FILE_GUID =3D AAE02741-858B-4964-9887-CA870489D94= 4 > - MODULE_TYPE =3D DXE_SMM_DRIVER > + BASE_NAME =3D StandaloneMmTcg2PhysicalPresenceLib > + FILE_GUID =3D 75E3D07B-689C-4F42-A8A0-46AFAE868A6= F > + MODULE_TYPE =3D MM_STANDALONE > + PI_SPECIFICATION_VERSION =3D 0x00010032 > VERSION_STRING =3D 1.0 > - LIBRARY_CLASS =3D Tcg2PhysicalPresenceLib|DXE_SMM_DRI= VER > - CONSTRUCTOR =3D Tcg2PhysicalPresenceLibConstructor > + LIBRARY_CLASS =3D Tcg2PhysicalPresenceLib|MM_STANDALO= NE > + CONSTRUCTOR =3D > Tcg2PhysicalPresenceLibStandaloneMmConstructor >=20 > # > # The following information is for reference only and not required by th= e > build tools. > @@ -29,7 +30,9 @@ [Defines] > # >=20 > [Sources] > - SmmTcg2PhysicalPresenceLib.c > + StandaloneMmTcg2PhysicalPresenceLib.c > + MmTcg2PhysicalPresenceLibCommon.c > + MmTcg2PhysicalPresenceLibCommon.h >=20 > [Packages] > MdePkg/MdePkg.dec > @@ -39,7 +42,7 @@ [Packages] > [LibraryClasses] > DebugLib > Tcg2PpVendorLib > - SmmServicesTableLib > + MmServicesTableLib > BaseMemoryLib >=20 > [Guids] > @@ -48,6 +51,9 @@ [Guids] > ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags" > gEfiTcg2PhysicalPresenceGuid >=20 > +[Protocols] > + gEfiSmmVariableProtocolGuid ## C= ONSUMES > + > [Pcd] > gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## > CONSUMES > gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## > SOMETIMES_CONSUMES > diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc > index 36d15b79f928..7240b2573e4e 100644 > --- a/SecurityPkg/SecurityPkg.dsc > +++ b/SecurityPkg/SecurityPkg.dsc > @@ -150,6 +150,7 @@ [LibraryClasses.common.UEFI_DRIVER, > LibraryClasses.common.UEFI_APPLICATION] > [LibraryClasses.common.DXE_SMM_DRIVER] > HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServices > TableLib.inf > + > MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTab > leLib.inf >=20 > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe > moryAllocationLib.inf >=20 > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S > mmReportStatusCodeLib.inf > SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf > @@ -316,6 +317,7 @@ [Components.IA32, Components.X64] > SecurityPkg/Tcg/TcgSmm/TcgSmm.inf > SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf >=20 > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen > ceLib.inf > + > SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2Phys > icalPresenceLib.inf >=20 > # > # Random Number Generator > -- > 2.28.0.windows.1