]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/PhysicalPresenceLib: Reject illegal PCR bank allocation
authorZhang, Chao B <chao.b.zhang@intel.com>
Sat, 13 Jan 2018 08:52:48 +0000 (16:52 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Mon, 15 Jan 2018 08:40:11 +0000 (16:40 +0800)
According to TCG PP1.3 spec, error PCR bank allocation input should be
rejected by Physical Presence. Firmware has to ensure that at least one
PCR banks is active.

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c

index 5bf95a18fc409ea1eb6c20d43d931fe6191d97ea..5ece8e513abc5921095c583b326d587c013ed2a9 100644 (file)
@@ -186,6 +186,18 @@ Tcg2ExecutePhysicalPresence (
     case TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS:\r
       Status = Tpm2GetCapabilitySupportedAndActivePcrs (&TpmHashAlgorithmBitmap, &ActivePcrBanks);\r
       ASSERT_EFI_ERROR (Status);\r
+\r
+      //\r
+      // PP spec requirements:\r
+      //    Firmware should check that all requested (set) hashing algorithms are supported with respective PCR banks.\r
+      //    Firmware has to ensure that at least one PCR banks is active.\r
+      // If not, an error is returned and no action is taken.\r
+      //\r
+      if (CommandParameter == 0 || (CommandParameter & (~TpmHashAlgorithmBitmap)) != 0) {\r
+        DEBUG((DEBUG_ERROR, "PCR banks %x to allocate are not supported by TPM. Skip operation\n", CommandParameter));\r
+        return TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE;\r
+      }\r
+\r
       Status = Tpm2PcrAllocateBanks (PlatformAuth, TpmHashAlgorithmBitmap, CommandParameter);\r
       if (EFI_ERROR (Status)) {\r
         return TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE;\r