]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: Tcg2PhysicalPresenceLib: Introduce StandaloneMm instance
authorKun Qin <kun.q@outlook.com>
Thu, 17 Dec 2020 23:24:08 +0000 (15:24 -0800)
committerKun Qin <kun.q@outlook.com>
Mon, 1 Feb 2021 18:03:35 +0000 (10:03 -0800)
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.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Qi Zhang <qi1.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenceLibCommon.c [new file with mode: 0644]
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenceLibCommon.h [new file with mode: 0644]
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.c [new file with mode: 0644]
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.inf [new file with mode: 0644]
SecurityPkg/SecurityPkg.dsc

diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenceLibCommon.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenceLibCommon.c
new file mode 100644 (file)
index 0000000..3788537
--- /dev/null
@@ -0,0 +1,398 @@
+/** @file\r
+  Handle TPM 2.0 physical presence requests from OS.\r
+\r
+  This library will handle TPM 2.0 physical presence request from OS.\r
+\r
+  Caution: This module requires additional review when modified.\r
+  This driver will have external input - variable.\r
+  This external input must be validated carefully to avoid security issue.\r
+\r
+  Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()\r
+  will receive untrusted input and do validation.\r
+\r
+Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <PiMm.h>\r
+\r
+#include <Guid/Tcg2PhysicalPresenceData.h>\r
+\r
+#include <Protocol/SmmVariable.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/Tcg2PpVendorLib.h>\r
+#include <Library/MmServicesTableLib.h>\r
+\r
+#define     PP_INF_VERSION_1_2    "1.2"\r
+\r
+EFI_SMM_VARIABLE_PROTOCOL  *mTcg2PpSmmVariable;\r
+BOOLEAN                    mIsTcg2PPVerLowerThan_1_3 = FALSE;\r
+UINT32                     mTcg2PhysicalPresenceFlags;\r
+\r
+/**\r
+  The handler for TPM physical presence function:\r
+  Return TPM Operation Response to OS Environment.\r
+\r
+  This API should be invoked in OS runtime phase to interface with ACPI method.\r
+\r
+  @param[out]     MostRecentRequest Most recent operation request.\r
+  @param[out]     Response          Response to the most recent operation request.\r
+\r
+  @return Return Code for Return TPM Operation Response to OS Environment.\r
+**/\r
+UINT32\r
+EFIAPI\r
+Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (\r
+  OUT UINT32                *MostRecentRequest,\r
+  OUT UINT32                *Response\r
+  )\r
+{\r
+  EFI_STATUS                        Status;\r
+  UINTN                             DataSize;\r
+  EFI_TCG2_PHYSICAL_PRESENCE        PpData;\r
+\r
+  DEBUG ((DEBUG_INFO, "[TPM2] ReturnOperationResponseToOsFunction\n"));\r
+\r
+  //\r
+  // Get the Physical Presence variable\r
+  //\r
+  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
+  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+                                 TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+                                 &gEfiTcg2PhysicalPresenceGuid,\r
+                                 NULL,\r
+                                 &DataSize,\r
+                                 &PpData\r
+                                 );\r
+  if (EFI_ERROR (Status)) {\r
+    *MostRecentRequest = 0;\r
+    *Response          = 0;\r
+    DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
+    return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE;\r
+  }\r
+\r
+  *MostRecentRequest = PpData.LastPPRequest;\r
+  *Response          = PpData.PPResponse;\r
+\r
+  return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;\r
+}\r
+\r
+/**\r
+  The handler for TPM physical presence function:\r
+  Submit TPM Operation Request to Pre-OS Environment and\r
+  Submit TPM Operation Request to Pre-OS Environment 2.\r
+\r
+  This API should be invoked in OS runtime phase to interface with ACPI method.\r
+\r
+  Caution: This function may receive untrusted input.\r
+\r
+  @param[in, out]  Pointer to OperationRequest TPM physical presence operation request.\r
+  @param[in, out]  Pointer to RequestParameter TPM physical presence operation request parameter.\r
+\r
+  @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
+        Submit TPM Operation Request to Pre-OS Environment 2.\r
+  **/\r
+UINT32\r
+Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (\r
+  IN OUT UINT32               *OperationRequest,\r
+  IN OUT UINT32               *RequestParameter\r
+  )\r
+{\r
+  EFI_STATUS                        Status;\r
+  UINT32                            ReturnCode;\r
+  UINTN                             DataSize;\r
+  EFI_TCG2_PHYSICAL_PRESENCE        PpData;\r
+  EFI_TCG2_PHYSICAL_PRESENCE_FLAGS  Flags;\r
+\r
+  DEBUG ((DEBUG_INFO, "[TPM2] SubmitRequestToPreOSFunction, Request = %x, %x\n", *OperationRequest, *RequestParameter));\r
+  ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS;\r
+\r
+  //\r
+  // Get the Physical Presence variable\r
+  //\r
+  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
+  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+                                 TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+                                 &gEfiTcg2PhysicalPresenceGuid,\r
+                                 NULL,\r
+                                 &DataSize,\r
+                                 &PpData\r
+                                 );\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
+    ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;\r
+    goto EXIT;\r
+  }\r
+\r
+  if ((*OperationRequest > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) &&\r
+      (*OperationRequest < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN) ) {\r
+    ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED;\r
+    goto EXIT;\r
+  }\r
+\r
+  if ((PpData.PPRequest != *OperationRequest) ||\r
+      (PpData.PPRequestParameter != *RequestParameter)) {\r
+    PpData.PPRequest = (UINT8)*OperationRequest;\r
+    PpData.PPRequestParameter = *RequestParameter;\r
+    DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
+    Status = mTcg2PpSmmVariable->SmmSetVariable (\r
+                                   TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+                                   &gEfiTcg2PhysicalPresenceGuid,\r
+                                   EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                                   DataSize,\r
+                                   &PpData\r
+                                   );\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((DEBUG_ERROR, "[TPM2] Set PP variable failure! Status = %r\n", Status));\r
+      ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;\r
+      goto EXIT;\r
+    }\r
+  }\r
+\r
+  if (*OperationRequest >= TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+    DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
+    Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+                                   TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
+                                   &gEfiTcg2PhysicalPresenceGuid,\r
+                                   NULL,\r
+                                   &DataSize,\r
+                                   &Flags\r
+                                   );\r
+    if (EFI_ERROR (Status)) {\r
+      Flags.PPFlags = mTcg2PhysicalPresenceFlags;\r
+    }\r
+    ReturnCode = Tcg2PpVendorLibSubmitRequestToPreOSFunction (*OperationRequest, Flags.PPFlags, *RequestParameter);\r
+  }\r
+\r
+EXIT:\r
+  //\r
+  // Sync PPRQ/PPRM from PP Variable if PP submission fails\r
+  //\r
+  if (ReturnCode != TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {\r
+    DEBUG ((DEBUG_ERROR, "[TPM2] Submit PP Request failure! Sync PPRQ/PPRM with PP variable.\n", Status));\r
+    DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
+    ZeroMem(&PpData, DataSize);\r
+    Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+                                   TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+                                   &gEfiTcg2PhysicalPresenceGuid,\r
+                                   NULL,\r
+                                   &DataSize,\r
+                                   &PpData\r
+                                   );\r
+    *OperationRequest = (UINT32)PpData.PPRequest;\r
+    *RequestParameter = PpData.PPRequestParameter;\r
+  }\r
+\r
+  return ReturnCode;\r
+}\r
+\r
+/**\r
+  The handler for TPM physical presence function:\r
+  Submit TPM Operation Request to Pre-OS Environment and\r
+  Submit TPM Operation Request to Pre-OS Environment 2.\r
+\r
+  This API should be invoked in OS runtime phase to interface with ACPI method.\r
+\r
+  Caution: This function may receive untrusted input.\r
+\r
+  @param[in]      OperationRequest TPM physical presence operation request.\r
+  @param[in]      RequestParameter TPM physical presence operation request parameter.\r
+\r
+  @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
+          Submit TPM Operation Request to Pre-OS Environment 2.\r
+**/\r
+UINT32\r
+EFIAPI\r
+Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (\r
+  IN UINT32                 OperationRequest,\r
+  IN UINT32                 RequestParameter\r
+  )\r
+{\r
+  UINT32                 TempOperationRequest;\r
+  UINT32                 TempRequestParameter;\r
+\r
+  TempOperationRequest = OperationRequest;\r
+  TempRequestParameter = RequestParameter;\r
+\r
+  return Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx(&TempOperationRequest, &TempRequestParameter);\r
+}\r
+\r
+/**\r
+  The handler for TPM physical presence function:\r
+  Get User Confirmation Status for Operation.\r
+\r
+  This API should be invoked in OS runtime phase to interface with ACPI method.\r
+\r
+  Caution: This function may receive untrusted input.\r
+\r
+  @param[in]      OperationRequest TPM physical presence operation request.\r
+\r
+  @return Return Code for Get User Confirmation Status for Operation.\r
+**/\r
+UINT32\r
+EFIAPI\r
+Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (\r
+  IN UINT32                 OperationRequest\r
+  )\r
+{\r
+  EFI_STATUS                        Status;\r
+  UINTN                             DataSize;\r
+  EFI_TCG2_PHYSICAL_PRESENCE        PpData;\r
+  EFI_TCG2_PHYSICAL_PRESENCE_FLAGS  Flags;\r
+  BOOLEAN                           RequestConfirmed;\r
+\r
+  DEBUG ((DEBUG_INFO, "[TPM2] GetUserConfirmationStatusFunction, Request = %x\n", OperationRequest));\r
+\r
+  //\r
+  // Get the Physical Presence variable\r
+  //\r
+  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
+  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+                                 TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+                                 &gEfiTcg2PhysicalPresenceGuid,\r
+                                 NULL,\r
+                                 &DataSize,\r
+                                 &PpData\r
+                                 );\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
+    return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
+  }\r
+  //\r
+  // Get the Physical Presence flags\r
+  //\r
+  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
+  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+                                 TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
+                                 &gEfiTcg2PhysicalPresenceGuid,\r
+                                 NULL,\r
+                                 &DataSize,\r
+                                 &Flags\r
+                                 );\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_ERROR, "[TPM2] Get PP flags failure! Status = %r\n", Status));\r
+    return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
+  }\r
+\r
+  RequestConfirmed = FALSE;\r
+\r
+  switch (OperationRequest) {\r
+    case TCG2_PHYSICAL_PRESENCE_CLEAR:\r
+    case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR:\r
+    case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_2:\r
+    case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_3:\r
+      if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR) == 0) {\r
+        RequestConfirmed = TRUE;\r
+      }\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_NO_ACTION:\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_TRUE:\r
+      RequestConfirmed = TRUE;\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_FALSE:\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS:\r
+      if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS) == 0) {\r
+        RequestConfirmed = TRUE;\r
+      }\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_CHANGE_EPS:\r
+      if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS) == 0) {\r
+        RequestConfirmed = TRUE;\r
+      }\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS:\r
+      RequestConfirmed = TRUE;\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID:\r
+      if ((Flags.PPFlags & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID) == 0) {\r
+        RequestConfirmed = TRUE;\r
+      }\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID:\r
+      if ((Flags.PPFlags & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID) == 0) {\r
+        RequestConfirmed = TRUE;\r
+      }\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_TRUE:\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_TRUE:\r
+      RequestConfirmed = TRUE;\r
+      break;\r
+\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_FALSE:\r
+    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_FALSE:\r
+      break;\r
+\r
+    default:\r
+      if (!mIsTcg2PPVerLowerThan_1_3) {\r
+        if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+          //\r
+          // TCG2 PP1.3 spec defined operations that are reserved or un-implemented\r
+          //\r
+          return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
+        }\r
+      } else {\r
+       //\r
+       // TCG PP lower than 1.3. (1.0, 1.1, 1.2)\r
+       //\r
+       if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {\r
+         RequestConfirmed = TRUE;\r
+       } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+         return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
+       }\r
+      }\r
+      break;\r
+  }\r
+\r
+  if (OperationRequest >= TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+    return Tcg2PpVendorLibGetUserConfirmationStatusFunction (OperationRequest, Flags.PPFlags);\r
+  }\r
+\r
+  if (RequestConfirmed) {\r
+    return TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_NOT_REQUIRED;\r
+  } else {\r
+    return TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED;\r
+  }\r
+}\r
+\r
+/**\r
+  The constructor function locates SmmVariable protocol.\r
+\r
+  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS   The constructor successfully added string package.\r
+  @retval Other value   The constructor can't add string package.\r
+**/\r
+EFI_STATUS\r
+Tcg2PhysicalPresenceLibCommonConstructor (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), sizeof(PP_INF_VERSION_1_2) - 1) >= 0) {\r
+    mIsTcg2PPVerLowerThan_1_3 = TRUE;\r
+  }\r
+\r
+  //\r
+  // Locate SmmVariableProtocol.\r
+  //\r
+  Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mTcg2PpSmmVariable);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  mTcg2PhysicalPresenceFlags = PcdGet32(PcdTcg2PhysicalPresenceFlags);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenceLibCommon.h b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/MmTcg2PhysicalPresenceLibCommon.h
new file mode 100644 (file)
index 0000000..a018273
--- /dev/null
@@ -0,0 +1,34 @@
+/** @file\r
+  Handle TPM 2.0 physical presence requests from OS.\r
+\r
+  This library will handle TPM 2.0 physical presence request from OS.\r
+\r
+  Caution: This module requires additional review when modified.\r
+  This driver will have external input - variable.\r
+  This external input must be validated carefully to avoid security issue.\r
+\r
+  Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()\r
+  will receive untrusted input and do validation.\r
+\r
+Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_\r
+#define _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_\r
+\r
+/**\r
+  The constructor function locates MmVariable protocol.\r
+\r
+  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS   The constructor successfully added string package.\r
+  @retval Other value   The constructor can't add string package.\r
+**/\r
+EFI_STATUS\r
+Tcg2PhysicalPresenceLibCommonConstructor (\r
+  VOID\r
+  );\r
+\r
+#endif\r
index 8afaa0a7857d1816fd5240b8f78308f9a70699bb..36d8b89dcdd93aec7e76da74fcbeaeaeacce68a0 100644 (file)
@@ -17,355 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 #include <PiSmm.h>\r
 \r
-#include <Guid/Tcg2PhysicalPresenceData.h>\r
-\r
-#include <Protocol/SmmVariable.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/Tcg2PpVendorLib.h>\r
-#include <Library/SmmServicesTableLib.h>\r
-\r
-#define     PP_INF_VERSION_1_2    "1.2"\r
-\r
-EFI_SMM_VARIABLE_PROTOCOL  *mTcg2PpSmmVariable;\r
-BOOLEAN                    mIsTcg2PPVerLowerThan_1_3 = FALSE;\r
-UINT32                     mTcg2PhysicalPresenceFlags;\r
-\r
-/**\r
-  The handler for TPM physical presence function:\r
-  Return TPM Operation Response to OS Environment.\r
-\r
-  This API should be invoked in OS runtime phase to interface with ACPI method.\r
-\r
-  @param[out]     MostRecentRequest Most recent operation request.\r
-  @param[out]     Response          Response to the most recent operation request.\r
-\r
-  @return Return Code for Return TPM Operation Response to OS Environment.\r
-**/\r
-UINT32\r
-EFIAPI\r
-Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (\r
-  OUT UINT32                *MostRecentRequest,\r
-  OUT UINT32                *Response\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  UINTN                             DataSize;\r
-  EFI_TCG2_PHYSICAL_PRESENCE        PpData;\r
-\r
-  DEBUG ((EFI_D_INFO, "[TPM2] ReturnOperationResponseToOsFunction\n"));\r
-\r
-  //\r
-  // Get the Physical Presence variable\r
-  //\r
-  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
-  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
-                                 TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
-                                 &gEfiTcg2PhysicalPresenceGuid,\r
-                                 NULL,\r
-                                 &DataSize,\r
-                                 &PpData\r
-                                 );\r
-  if (EFI_ERROR (Status)) {\r
-    *MostRecentRequest = 0;\r
-    *Response          = 0;\r
-    DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
-    return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE;\r
-  }\r
-\r
-  *MostRecentRequest = PpData.LastPPRequest;\r
-  *Response          = PpData.PPResponse;\r
-\r
-  return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;\r
-}\r
-\r
-/**\r
-  The handler for TPM physical presence function:\r
-  Submit TPM Operation Request to Pre-OS Environment and\r
-  Submit TPM Operation Request to Pre-OS Environment 2.\r
-\r
-  This API should be invoked in OS runtime phase to interface with ACPI method.\r
-\r
-  Caution: This function may receive untrusted input.\r
-\r
-  @param[in, out]  Pointer to OperationRequest TPM physical presence operation request.\r
-  @param[in, out]  Pointer to RequestParameter TPM physical presence operation request parameter.\r
-\r
-  @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
-        Submit TPM Operation Request to Pre-OS Environment 2.\r
-  **/\r
-UINT32\r
-Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (\r
-  IN OUT UINT32               *OperationRequest,\r
-  IN OUT UINT32               *RequestParameter\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  UINT32                            ReturnCode;\r
-  UINTN                             DataSize;\r
-  EFI_TCG2_PHYSICAL_PRESENCE        PpData;\r
-  EFI_TCG2_PHYSICAL_PRESENCE_FLAGS  Flags;\r
-\r
-  DEBUG ((EFI_D_INFO, "[TPM2] SubmitRequestToPreOSFunction, Request = %x, %x\n", *OperationRequest, *RequestParameter));\r
-  ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS;\r
-\r
-  //\r
-  // Get the Physical Presence variable\r
-  //\r
-  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
-  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
-                                 TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
-                                 &gEfiTcg2PhysicalPresenceGuid,\r
-                                 NULL,\r
-                                 &DataSize,\r
-                                 &PpData\r
-                                 );\r
-  if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
-    ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;\r
-    goto EXIT;\r
-  }\r
-\r
-  if ((*OperationRequest > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) &&\r
-      (*OperationRequest < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN) ) {\r
-    ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED;\r
-    goto EXIT;\r
-  }\r
-\r
-  if ((PpData.PPRequest != *OperationRequest) ||\r
-      (PpData.PPRequestParameter != *RequestParameter)) {\r
-    PpData.PPRequest = (UINT8)*OperationRequest;\r
-    PpData.PPRequestParameter = *RequestParameter;\r
-    DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
-    Status = mTcg2PpSmmVariable->SmmSetVariable (\r
-                                   TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
-                                   &gEfiTcg2PhysicalPresenceGuid,\r
-                                   EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                                   DataSize,\r
-                                   &PpData\r
-                                   );\r
-    if (EFI_ERROR (Status)) {\r
-      DEBUG ((EFI_D_ERROR, "[TPM2] Set PP variable failure! Status = %r\n", Status));\r
-      ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;\r
-      goto EXIT;\r
-    }\r
-  }\r
-\r
-  if (*OperationRequest >= TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
-    DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
-    Status = mTcg2PpSmmVariable->SmmGetVariable (\r
-                                   TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
-                                   &gEfiTcg2PhysicalPresenceGuid,\r
-                                   NULL,\r
-                                   &DataSize,\r
-                                   &Flags\r
-                                   );\r
-    if (EFI_ERROR (Status)) {\r
-      Flags.PPFlags = mTcg2PhysicalPresenceFlags;\r
-    }\r
-    ReturnCode = Tcg2PpVendorLibSubmitRequestToPreOSFunction (*OperationRequest, Flags.PPFlags, *RequestParameter);\r
-  }\r
-\r
-EXIT:\r
-  //\r
-  // Sync PPRQ/PPRM from PP Variable if PP submission fails\r
-  //\r
-  if (ReturnCode != TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {\r
-    DEBUG ((EFI_D_ERROR, "[TPM2] Submit PP Request failure! Sync PPRQ/PPRM with PP variable.\n", Status));\r
-    DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
-    ZeroMem(&PpData, DataSize);\r
-    Status = mTcg2PpSmmVariable->SmmGetVariable (\r
-                                   TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
-                                   &gEfiTcg2PhysicalPresenceGuid,\r
-                                   NULL,\r
-                                   &DataSize,\r
-                                   &PpData\r
-                                   );\r
-    *OperationRequest = (UINT32)PpData.PPRequest;\r
-    *RequestParameter = PpData.PPRequestParameter;\r
-  }\r
-\r
-  return ReturnCode;\r
-}\r
-\r
-/**\r
-  The handler for TPM physical presence function:\r
-  Submit TPM Operation Request to Pre-OS Environment and\r
-  Submit TPM Operation Request to Pre-OS Environment 2.\r
-\r
-  This API should be invoked in OS runtime phase to interface with ACPI method.\r
-\r
-  Caution: This function may receive untrusted input.\r
-\r
-  @param[in]      OperationRequest TPM physical presence operation request.\r
-  @param[in]      RequestParameter TPM physical presence operation request parameter.\r
-\r
-  @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
-          Submit TPM Operation Request to Pre-OS Environment 2.\r
-**/\r
-UINT32\r
-EFIAPI\r
-Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (\r
-  IN UINT32                 OperationRequest,\r
-  IN UINT32                 RequestParameter\r
-  )\r
-{\r
-  UINT32                 TempOperationRequest;\r
-  UINT32                 TempRequestParameter;\r
-\r
-  TempOperationRequest = OperationRequest;\r
-  TempRequestParameter = RequestParameter;\r
-\r
-  return Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx(&TempOperationRequest, &TempRequestParameter);\r
-}\r
-\r
-/**\r
-  The handler for TPM physical presence function:\r
-  Get User Confirmation Status for Operation.\r
-\r
-  This API should be invoked in OS runtime phase to interface with ACPI method.\r
-\r
-  Caution: This function may receive untrusted input.\r
-\r
-  @param[in]      OperationRequest TPM physical presence operation request.\r
-\r
-  @return Return Code for Get User Confirmation Status for Operation.\r
-**/\r
-UINT32\r
-EFIAPI\r
-Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (\r
-  IN UINT32                 OperationRequest\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  UINTN                             DataSize;\r
-  EFI_TCG2_PHYSICAL_PRESENCE        PpData;\r
-  EFI_TCG2_PHYSICAL_PRESENCE_FLAGS  Flags;\r
-  BOOLEAN                           RequestConfirmed;\r
-\r
-  DEBUG ((EFI_D_INFO, "[TPM2] GetUserConfirmationStatusFunction, Request = %x\n", OperationRequest));\r
-\r
-  //\r
-  // Get the Physical Presence variable\r
-  //\r
-  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
-  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
-                                 TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
-                                 &gEfiTcg2PhysicalPresenceGuid,\r
-                                 NULL,\r
-                                 &DataSize,\r
-                                 &PpData\r
-                                 );\r
-  if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
-    return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
-  }\r
-  //\r
-  // Get the Physical Presence flags\r
-  //\r
-  DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
-  Status = mTcg2PpSmmVariable->SmmGetVariable (\r
-                                 TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
-                                 &gEfiTcg2PhysicalPresenceGuid,\r
-                                 NULL,\r
-                                 &DataSize,\r
-                                 &Flags\r
-                                 );\r
-  if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "[TPM2] Get PP flags failure! Status = %r\n", Status));\r
-    return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
-  }\r
-\r
-  RequestConfirmed = FALSE;\r
-\r
-  switch (OperationRequest) {\r
-    case TCG2_PHYSICAL_PRESENCE_CLEAR:\r
-    case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR:\r
-    case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_2:\r
-    case TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_3:\r
-      if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR) == 0) {\r
-        RequestConfirmed = TRUE;\r
-      }\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_NO_ACTION:\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_TRUE:\r
-      RequestConfirmed = TRUE;\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_FALSE:\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS:\r
-      if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS) == 0) {\r
-        RequestConfirmed = TRUE;\r
-      }\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_CHANGE_EPS:\r
-      if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS) == 0) {\r
-        RequestConfirmed = TRUE;\r
-      }\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS:\r
-      RequestConfirmed = TRUE;\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID:\r
-      if ((Flags.PPFlags & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID) == 0) {\r
-        RequestConfirmed = TRUE;\r
-      }\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID:\r
-      if ((Flags.PPFlags & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID) == 0) {\r
-        RequestConfirmed = TRUE;\r
-      }\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_TRUE:\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_TRUE:\r
-      RequestConfirmed = TRUE;\r
-      break;\r
-\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_FALSE:\r
-    case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_FALSE:\r
-      break;\r
-\r
-    default:\r
-      if (!mIsTcg2PPVerLowerThan_1_3) {\r
-        if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
-          //\r
-          // TCG2 PP1.3 spec defined operations that are reserved or un-implemented\r
-          //\r
-          return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
-        }\r
-      } else {\r
-       //\r
-       // TCG PP lower than 1.3. (1.0, 1.1, 1.2)\r
-       //\r
-       if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {\r
-         RequestConfirmed = TRUE;\r
-       } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
-         return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
-       }\r
-      }\r
-      break;\r
-  }\r
-\r
-  if (OperationRequest >= TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
-    return Tcg2PpVendorLibGetUserConfirmationStatusFunction (OperationRequest, Flags.PPFlags);\r
-  }\r
-\r
-  if (RequestConfirmed) {\r
-    return TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_NOT_REQUIRED;\r
-  } else {\r
-    return TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED;\r
-  }\r
-}\r
+#include "MmTcg2PhysicalPresenceLibCommon.h"\r
 \r
 /**\r
   The constructor function locates SmmVariable protocol.\r
@@ -380,24 +32,10 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-Tcg2PhysicalPresenceLibConstructor (\r
+Tcg2PhysicalPresenceLibTraditionalConstructor (\r
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
-\r
-  if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), sizeof(PP_INF_VERSION_1_2) - 1) >= 0) {\r
-    mIsTcg2PPVerLowerThan_1_3 = TRUE;\r
-  }\r
-\r
-  //\r
-  // Locate SmmVariableProtocol.\r
-  //\r
-  Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mTcg2PpSmmVariable);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  mTcg2PhysicalPresenceFlags = PcdGet32(PcdTcg2PhysicalPresenceFlags);\r
-\r
-  return EFI_SUCCESS;\r
+  return Tcg2PhysicalPresenceLibCommonConstructor ();\r
 }\r
index 6a9bdf66f0a6b66c1212620ca239655d28ba2425..d911adbdb6483776dfb6b1c1ba162f19060eae28 100644 (file)
@@ -20,7 +20,7 @@
   MODULE_TYPE                    = DXE_SMM_DRIVER\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = Tcg2PhysicalPresenceLib|DXE_SMM_DRIVER\r
-  CONSTRUCTOR                    = Tcg2PhysicalPresenceLibConstructor\r
+  CONSTRUCTOR                    = Tcg2PhysicalPresenceLibTraditionalConstructor\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
@@ -30,6 +30,8 @@
 \r
 [Sources]\r
   SmmTcg2PhysicalPresenceLib.c\r
+  MmTcg2PhysicalPresenceLibCommon.c\r
+  MmTcg2PhysicalPresenceLibCommon.h\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
@@ -39,7 +41,7 @@
 [LibraryClasses]\r
   DebugLib\r
   Tcg2PpVendorLib\r
-  SmmServicesTableLib\r
+  MmServicesTableLib\r
   BaseMemoryLib\r
 \r
 [Guids]\r
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.c
new file mode 100644 (file)
index 0000000..5c298a8
--- /dev/null
@@ -0,0 +1,42 @@
+/** @file\r
+  Handle TPM 2.0 physical presence requests from OS.\r
+\r
+  This library will handle TPM 2.0 physical presence request from OS.\r
+\r
+  Caution: This module requires additional review when modified.\r
+  This driver will have external input - variable.\r
+  This external input must be validated carefully to avoid security issue.\r
+\r
+  Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()\r
+  will receive untrusted input and do validation.\r
+\r
+Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <PiMm.h>\r
+\r
+#include "MmTcg2PhysicalPresenceLibCommon.h"\r
+\r
+/**\r
+  The constructor function locates SmmVariable protocol.\r
+\r
+  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
+\r
+  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param  SystemTable   A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS   The constructor successfully added string package.\r
+  @retval Other value   The constructor can't add string package.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcg2PhysicalPresenceLibStandaloneMmConstructor (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_MM_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  return Tcg2PhysicalPresenceLibCommonConstructor ();\r
+}\r
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.inf b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.inf
new file mode 100644 (file)
index 0000000..6d11b6b
--- /dev/null
@@ -0,0 +1,62 @@
+## @file\r
+#  Handle TPM 2.0 physical presence requests from OS.\r
+#\r
+#  This library will handle TPM 2.0 physical presence request from OS.\r
+#\r
+#  Caution: This module requires additional review when modified.\r
+#  This driver will have external input - variable.\r
+#  This external input must be validated carefully to avoid security issue.\r
+#\r
+# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = StandaloneMmTcg2PhysicalPresenceLib\r
+  FILE_GUID                      = 75E3D07B-689C-4F42-A8A0-46AFAE868A6F\r
+  MODULE_TYPE                    = MM_STANDALONE\r
+  PI_SPECIFICATION_VERSION       = 0x00010032\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = Tcg2PhysicalPresenceLib|MM_STANDALONE\r
+  CONSTRUCTOR                    = Tcg2PhysicalPresenceLibStandaloneMmConstructor\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 EBC\r
+#\r
+\r
+[Sources]\r
+  StandaloneMmTcg2PhysicalPresenceLib.c\r
+  MmTcg2PhysicalPresenceLibCommon.c\r
+  MmTcg2PhysicalPresenceLibCommon.h\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+  SecurityPkg/SecurityPkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
+  Tcg2PpVendorLib\r
+  MmServicesTableLib\r
+  BaseMemoryLib\r
+\r
+[Guids]\r
+  ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"\r
+  ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"\r
+  ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"\r
+  gEfiTcg2PhysicalPresenceGuid\r
+\r
+[Protocols]\r
+  gEfiSmmVariableProtocolGuid                                       ## CONSUMES\r
+\r
+[Pcd]\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer  ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags        ## SOMETIMES_CONSUMES\r
+\r
+[Depex]\r
+  gEfiSmmVariableProtocolGuid\r
index 36d15b79f92823a48741d03a94b98f282f4ff195..7240b2573e4e67ac66c3a8f8799a2dfcce2fcf71 100644 (file)
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
   SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf\r
+  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf\r
   MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf\r
   ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf\r
   SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf\r
   SecurityPkg/Tcg/TcgSmm/TcgSmm.inf\r
   SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf\r
   SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf\r
+  SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.inf\r
 \r
   #\r
   # Random Number Generator\r