]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: Tcg2Smm: Make TCG2 PP version configurable
authorZhang, Chao B <chao.b.zhang@intel.com>
Wed, 8 Jun 2016 07:35:16 +0000 (15:35 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Sun, 12 Jun 2016 01:22:38 +0000 (09:22 +0800)
Make TCG2 PP version configurable to meet different request. Current default version is 1.3.
http://www.trustedcomputinggroup.org/physical-presence-interface_1-30_0-52/

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
SecurityPkg/SecurityPkg.dec
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
SecurityPkg/Tcg/Tcg2Smm/Tpm.asl

index f4f3174c5384cca55353bad7b32ea3d2382f2daf..a9da5a6847823cb1323c408622fed992ac6470d9 100644 (file)
   # @ValidList  0x80000003 | 0x010D0000\r
   gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice|0x010D0000|UINT32|0x00000007\r
 \r
+  ## Null-terminated string of the Version of Physical Presence interface supported by platform.\r
+  # @Prompt Version of Physical Presence interface supported by platform.\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|"1.3"|VOID*|0x00000008\r
+\r
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]\r
   ## Indicates the presence or absence of the platform operator during firmware booting.\r
   #  If platform operator is not physical presence during boot. TPM will be locked and the TPM commands \r
index dab1f532cc9a68b9d77d32dc2c49cbded6171f42..b4974755b2bda32518e7af05ac619004124b840f 100644 (file)
@@ -250,6 +250,41 @@ AssignOpRegion (
   return (VOID *) (UINTN) MemoryAddress;\r
 }\r
 \r
+/**\r
+  Patch version string of Physical Presence interface supported by platform. The initial string tag in TPM \r
+ACPI table is "$PV".\r
+\r
+  @param[in, out] Table          The TPM item in ACPI table.\r
+  @param[in]      PPVer          Version string of Physical Presence interface supported by platform.\r
+\r
+  @return                        The allocated address for the found region.\r
+\r
+**/\r
+EFI_STATUS\r
+UpdatePPVersion (\r
+  EFI_ACPI_DESCRIPTION_HEADER    *Table,\r
+  CHAR8                          *PPVer\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+  UINT8       *DataPtr;\r
+\r
+  //\r
+  // Patch some pointers for the ASL code before loading the SSDT.\r
+  //\r
+  for (DataPtr  = (UINT8 *)(Table + 1);\r
+       DataPtr <= (UINT8 *) ((UINT8 *) Table + Table->Length - PHYSICAL_PRESENCE_VERSION_SIZE);\r
+       DataPtr += 1) {\r
+    if (AsciiStrCmp(DataPtr,  PHYSICAL_PRESENCE_VERSION_TAG) == 0) {\r
+      Status = AsciiStrCpyS(DataPtr, PHYSICAL_PRESENCE_VERSION_SIZE, PPVer);\r
+      DEBUG((EFI_D_INFO, "TPM2 Physical Presence Interface Version update status 0x%x\n", Status));\r
+      return Status;\r
+    }\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
+\r
 /**\r
   Initialize and publish TPM items in ACPI table.\r
 \r
@@ -277,6 +312,11 @@ PublishAcpiTable (
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  //\r
+  // Update Table version before measuring it to PCR\r
+  //\r
+  Status = UpdatePPVersion(Table, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer));\r
+  ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
   // Measure to PCR[0] with event EV_POST_CODE ACPI DATA\r
@@ -297,7 +337,7 @@ PublishAcpiTable (
   ASSERT (mTcgNvs != NULL);\r
 \r
   //\r
-  // Publish the TPM ACPI table\r
+  // Publish the TPM ACPI table. Table is re-checksumed.\r
   //\r
   Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);\r
   ASSERT_EFI_ERROR (Status);\r
index 62374a2ee5354aec55ed3ea320ad163d693745e2..fa77c9a89cb8a8f839a840970a94cbe7f96d7d6c 100644 (file)
@@ -87,4 +87,10 @@ typedef struct {
 #define MOR_REQUEST_SUCCESS                                        0\r
 #define MOR_REQUEST_GENERAL_FAILURE                                1\r
 \r
+//\r
+// Physical Presence Interface Version supported by Platform\r
+//\r
+#define PHYSICAL_PRESENCE_VERSION_TAG                              "$PV"\r
+#define PHYSICAL_PRESENCE_VERSION_SIZE                             4\r
+\r
 #endif  // __TCG_SMM_H__\r
index 0cc0cc689d6a3a253d165d3633984a6c6e38f9b0..0de4fcee045390282906182af4d6b54201418b16 100644 (file)
@@ -72,6 +72,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## SOMETIMES_CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress               ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer  ## CONSUMES\r
 \r
 [Depex]\r
   gEfiAcpiTableProtocolGuid AND\r
index ba316cfc22d7bc115dfe7f24a56391b4ee289f23..9ff74f76e3150d3152d62a1f109b6a76076691b0 100644 (file)
@@ -2,7 +2,7 @@
   The TPM2 definition block in ACPI table for TCG2 physical presence  \r
   and MemoryClear.\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 (c)Copyright 2016 HP Development Company, L.P.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
@@ -188,7 +188,7 @@ DefinitionBlock (
             //\r
             // a) Get Physical Presence Interface Version\r
             //\r
-            Return ("1.3")\r
+            Return ("$PV")\r
           }\r
           Case (2)\r
           {\r