From 053f31e3d025f535af0626538f3d1a2415c67d2d Mon Sep 17 00:00:00 2001 From: "Zhang, Chao B" Date: Mon, 26 Sep 2016 10:31:15 +0800 Subject: [PATCH 1/1] SecurityPkg: Tcg: New field for User Confirmation Status Add a new field in TcgNVS for PP operation user confirmation status, instead of previous logic overriding Request. Previous logic causes Get Pending TPM Operation Requested sub function return wrong value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang Reviewed-by: Yao Jiewen Reviewed-by: Long Qin --- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 4 ++-- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h | 1 + SecurityPkg/Tcg/Tcg2Smm/Tpm.asl | 5 +++-- SecurityPkg/Tcg/TcgSmm/TcgSmm.c | 4 ++-- SecurityPkg/Tcg/TcgSmm/TcgSmm.h | 3 ++- SecurityPkg/Tcg/TcgSmm/Tpm.asl | 7 ++++--- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c index 19d9b489fe..f3b76418a2 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -135,8 +135,8 @@ PhysicalPresenceCallback ( mTcgNvs->PhysicalPresence.RequestParameter ); } else if (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) { - mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (mTcgNvs->PhysicalPresence.Request); - } + mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (mTcgNvs->PPRequestUserConfirm); + } return EFI_SUCCESS; } diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h index fa77c9a89c..0b09032d63 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h @@ -62,6 +62,7 @@ typedef struct { typedef struct { PHYSICAL_PRESENCE_NVS PhysicalPresence; MEMORY_CLEAR_NVS MemoryClear; + UINT32 PPRequestUserConfirm; } TCG_NVS; typedef struct { diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl index 9ff74f76e3..84143cfce9 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl @@ -79,7 +79,8 @@ DefinitionBlock ( MCIN, 8, // Software SMI for Memory Clear Interface MCIP, 32, // Used for save the Mor paramter MORD, 32, // Memory Overwrite Request Data - MRET, 32 // Memory Overwrite function return code + MRET, 32, // Memory Overwrite function return code + UCRQ, 32 // Phyical Presence request operation to Get User Confirmation Status } Method (PTS, 1, Serialized) @@ -274,7 +275,7 @@ DefinitionBlock ( // e) Get User Confirmation Status for Operation // Store (8, PPIP) - Store (DerefOf (Index (Arg2, 0x00)), PPRQ) + Store (DerefOf (Index (Arg2, 0x00)), UCRQ) // // Triggle the SMI interrupt diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c index 96fb456ccd..589bab694b 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c @@ -8,7 +8,7 @@ PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check. -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -152,7 +152,7 @@ PhysicalPresenceCallback ( RequestConfirmed = FALSE; - switch (mTcgNvs->PhysicalPresence.Request) { + switch (mTcgNvs->PPRequestUserConfirm) { case PHYSICAL_PRESENCE_ENABLE: case PHYSICAL_PRESENCE_DISABLE: case PHYSICAL_PRESENCE_ACTIVATE: diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.h b/SecurityPkg/Tcg/TcgSmm/TcgSmm.h index d8eb82fac7..21e4ad96d2 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.h +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.h @@ -1,7 +1,7 @@ /** @file The header file for TCG SMM driver. -Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -58,6 +58,7 @@ typedef struct { typedef struct { PHYSICAL_PRESENCE_NVS PhysicalPresence; MEMORY_CLEAR_NVS MemoryClear; + UINT32 PPRequestUserConfirm; } TCG_NVS; typedef struct { diff --git a/SecurityPkg/Tcg/TcgSmm/Tpm.asl b/SecurityPkg/Tcg/TcgSmm/Tpm.asl index 087ff9f792..b5449d98b4 100644 --- a/SecurityPkg/Tcg/TcgSmm/Tpm.asl +++ b/SecurityPkg/Tcg/TcgSmm/Tpm.asl @@ -2,7 +2,7 @@ The TPM definition block in ACPI table for physical presence and MemoryClear. -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -78,7 +78,8 @@ DefinitionBlock ( MCIN, 8, // Software SMI for Memory Clear Interface MCIP, 32, // Used for save the Mor paramter MORD, 32, // Memory Overwrite Request Data - MRET, 32 // Memory Overwrite function return code + MRET, 32, // Memory Overwrite function return code + UCRQ, 32 // Phyical Presence request operation to Get User Confirmation Status } Method (PTS, 1, Serialized) @@ -269,7 +270,7 @@ DefinitionBlock ( // e) Get User Confirmation Status for Operation // Store (8, PPIP) - Store (DerefOf (Index (Arg2, 0x00)), PPRQ) + Store (DerefOf (Index (Arg2, 0x00)), UCRQ) // // Triggle the SMI interrupt -- 2.39.2