From edb0fda25ea9b2ef73db18bf5cf0798340209f28 Mon Sep 17 00:00:00 2001 From: "Zhang, Chao B" Date: Tue, 27 Sep 2016 09:46:40 +0800 Subject: SecurityPkg: Tcg2: Fix TCG2 PP issues Several issues exist in TCG2 PP 1. TCG2 PP use NVS PPRQ/PPRM as PP parameter as well as current PP state cache. But it doesn't handle PP set failure case 2. TCG2 PP Submit TPM Operation Request to Pre-OS Environment forgets to clean PPRM 3. Potential alignment issue Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang Reviewed-by: Qin Long --- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 14 +++++++++++--- SecurityPkg/Tcg/Tcg2Smm/Tpm.asl | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'SecurityPkg/Tcg') diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c index f3b76418a2..d02123dfa6 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -119,6 +119,9 @@ PhysicalPresenceCallback ( { UINT32 MostRecentRequest; UINT32 Response; + UINT32 OperationRequest; + UINT32 RequestParameter; + if (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS) { mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( @@ -130,10 +133,15 @@ PhysicalPresenceCallback ( return EFI_SUCCESS; } else if ((mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS) || (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) { - mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction ( - mTcgNvs->PhysicalPresence.Request, - mTcgNvs->PhysicalPresence.RequestParameter + + OperationRequest = mTcgNvs->PhysicalPresence.Request; + RequestParameter = mTcgNvs->PhysicalPresence.RequestParameter; + mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( + &OperationRequest, + &RequestParameter ); + mTcgNvs->PhysicalPresence.Request = OperationRequest; + mTcgNvs->PhysicalPresence.RequestParameter = RequestParameter; } else if (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) { mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (mTcgNvs->PPRequestUserConfirm); } diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl index 84143cfce9..2083a3e2ce 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl @@ -198,6 +198,7 @@ DefinitionBlock ( // Store (DerefOf (Index (Arg2, 0x00)), PPRQ) + Store (0, PPRM) Store (0x02, PPIP) // -- cgit v1.2.3