]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
SecurityPkg/TPM2: Extract GetSupportedAndActivePcrs to Tpm2CommandLib
[mirror_edk2.git] / SecurityPkg / Library / DxeTcg2PhysicalPresenceLib / DxeTcg2PhysicalPresenceLib.c
index d1ed7e83c7ae84174ef0d367fbc9f0a7bba72591..4cec0f75278bcdeac4f5fdd956d69abed63ae28e 100644 (file)
@@ -160,17 +160,10 @@ Tcg2ExecutePhysicalPresence (
   )\r
 {\r
   EFI_STATUS                        Status;\r
-  EFI_TCG2_PROTOCOL                 *Tcg2Protocol;\r
-  EFI_TCG2_BOOT_SERVICE_CAPABILITY  ProtocolCapability;\r
-\r
-  Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **) &Tcg2Protocol);\r
-  ASSERT_EFI_ERROR (Status);\r
+  EFI_TCG2_EVENT_ALGORITHM_BITMAP   TpmHashAlgorithmBitmap;\r
+  UINT32                            ActivePcrBanks;\r
 \r
-  ProtocolCapability.Size = sizeof(ProtocolCapability);\r
-  Status = Tcg2Protocol->GetCapability (\r
-                           Tcg2Protocol,\r
-                           &ProtocolCapability\r
-                           );\r
+  Status = Tpm2GetCapabilitySupportedAndActivePcrs (&TpmHashAlgorithmBitmap, &ActivePcrBanks);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   switch (CommandCode) {\r
@@ -194,7 +187,7 @@ Tcg2ExecutePhysicalPresence (
       return TCG_PP_OPERATION_RESPONSE_SUCCESS;\r
 \r
     case TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS:\r
-      Status = Tpm2PcrAllocateBanks (PlatformAuth, ProtocolCapability.HashAlgorithmBitmap, CommandParameter);\r
+      Status = Tpm2PcrAllocateBanks (PlatformAuth, TpmHashAlgorithmBitmap, CommandParameter);\r
       if (EFI_ERROR (Status)) {\r
         return TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE;\r
       } else {\r
@@ -210,7 +203,7 @@ Tcg2ExecutePhysicalPresence (
       }\r
 \r
     case TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS:\r
-      Status = Tpm2PcrAllocateBanks (PlatformAuth, ProtocolCapability.HashAlgorithmBitmap, ProtocolCapability.HashAlgorithmBitmap);\r
+      Status = Tpm2PcrAllocateBanks (PlatformAuth, TpmHashAlgorithmBitmap, TpmHashAlgorithmBitmap);\r
       if (EFI_ERROR (Status)) {\r
         return TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE;\r
       } else {\r