]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/TcgSmm/TcgSmm.c
Enhance TPM driver to protect TPM physical presence flags.
[mirror_edk2.git] / SecurityPkg / Tcg / TcgSmm / TcgSmm.c
index 7a16b9ca26278adedd2a3598c89adad2c1d7c723..97cd916d0711f5d1768e946b48e48e621e3c667e 100644 (file)
@@ -8,7 +8,7 @@
 \r
   PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.\r
 \r
 \r
   PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.\r
 \r
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
@@ -103,7 +103,22 @@ PhysicalPresenceCallback (
     }\r
     mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_SUCCESS;\r
   } else if (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) {\r
     }\r
     mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_SUCCESS;\r
   } else if (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) {\r
-    Flags = PpData.Flags;  \r
+    //\r
+    // Get the Physical Presence flags\r
+    //\r
+    DataSize = sizeof (UINT8);\r
+    Status = mSmmVariable->SmmGetVariable (\r
+                             PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
+                             &gEfiPhysicalPresenceGuid,\r
+                             NULL,\r
+                             &DataSize,\r
+                             &Flags\r
+                             );\r
+    if (EFI_ERROR (Status)) {\r
+      mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_GENERAL_FAILURE;\r
+      return EFI_SUCCESS;\r
+    }\r
+\r
     RequestConfirmed = FALSE;\r
 \r
     switch (mTcgNvs->PhysicalPresence.Request) {\r
     RequestConfirmed = FALSE;\r
 \r
     switch (mTcgNvs->PhysicalPresence.Request) {\r