]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg SmmTcg2PhysicalPresenceLib: Enable Storage actions.
authorEric Dong <eric.dong@intel.com>
Wed, 16 Nov 2016 05:45:21 +0000 (13:45 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 21 Nov 2016 07:37:55 +0000 (15:37 +0800)
After enable storage related actions in the
TcgPhysicalPresenceStorageLib, use this library to support
storage related actions in this library.

Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf

index 039bca1293921a3b426569acc9530ba365641909..e3f7150ee0fcda915a1194243035f19ec6ecc315 100644 (file)
@@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/Tcg2PpVendorLib.h>\r
 #include <Library/SmmServicesTableLib.h>\r
+#include <Library/TcgPhysicalPresenceStorageLib.h>\r
 \r
 EFI_SMM_VARIABLE_PROTOCOL  *mTcg2PpSmmVariable;\r
 \r
@@ -129,8 +130,10 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (
     goto EXIT;\r
   }\r
 \r
-  if ((*OperationRequest > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) &&\r
-      (*OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) ) {\r
+  if (((*OperationRequest > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) &&\r
+       (*OperationRequest < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN))||\r
+      ((*OperationRequest > TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_FALSE) &&\r
+       (*OperationRequest < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN))) {\r
     //\r
     // This command requires UI to prompt user for Auth data.\r
     //\r
@@ -244,12 +247,13 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
   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
+  EFI_STATUS                               Status;\r
+  UINTN                                    DataSize;\r
+  EFI_TCG2_PHYSICAL_PRESENCE               PpData;\r
+  EFI_TCG2_PHYSICAL_PRESENCE_FLAGS         Flags;\r
+  UINT32                                   StorageFlags;\r
+  BOOLEAN                                  RequestConfirmed;\r
+\r
   DEBUG ((EFI_D_INFO, "[TPM2] GetUserConfirmationStatusFunction, Request = %x\n", OperationRequest));\r
 \r
   //\r
@@ -283,6 +287,11 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
     return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
   }\r
 \r
+  //\r
+  // Get the Physical Presence storage flags\r
+  //\r
+  StorageFlags = TcgPhysicalPresenceStorageLibReturnStorageFlags();\r
+\r
   RequestConfirmed = FALSE;\r
 \r
   switch (OperationRequest) {\r
@@ -318,6 +327,22 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
       RequestConfirmed = TRUE;\r
       break;\r
 \r
+    case TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID:\r
+      if ((StorageFlags & TCG_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 ((StorageFlags & TCG_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
+      break;\r
+\r
     default:\r
       if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {\r
         RequestConfirmed = TRUE;\r
index 5fa84b10244c081ece6d4aa952e5800b5b65347d..9c80ac1ad707530b51ebb3a0904a7bfa805b7d70 100644 (file)
@@ -46,6 +46,7 @@
   Tcg2PpVendorLib\r
   SmmServicesTableLib\r
   BaseMemoryLib\r
+  TcgPhysicalPresenceStorageLib\r
 \r
 [Guids]\r
   ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"\r