]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg : Tpm12DeviceLibDTpm: Fix TPM12 wrong Response Tag check
authorZhang, Chao B <chao.b.zhang@intel.com>
Tue, 7 Jun 2016 02:15:07 +0000 (10:15 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Wed, 8 Jun 2016 07:14:56 +0000 (15:14 +0800)
TcgDxePassThroughToTpm should be able to handle all TPM12 Command & Response correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c

index 4e04299f2396b0993639d597a4f58be5a936db3e..c392b4b2150e8a63c16b436c78334ad50e8eacce 100644 (file)
@@ -267,6 +267,7 @@ Tpm12TisTpmCommand (
   UINT32                            TpmOutSize;\r
   UINT16                            Data16;\r
   UINT32                            Data32;\r
+  UINT16                            RspTag;\r
 \r
   DEBUG_CODE (\r
     UINTN  DebugSize;\r
@@ -364,11 +365,12 @@ Tpm12TisTpmCommand (
     DEBUG ((EFI_D_VERBOSE, "\n"));\r
   );\r
   //\r
-  // Check the reponse data header (tag,parasize and returncode )\r
+  // Check the response data header (tag, parasize and returncode)\r
   //\r
   CopyMem (&Data16, BufferOut, sizeof (UINT16));\r
-  if (SwapBytes16 (Data16) != TPM_TAG_RSP_COMMAND) {\r
-    DEBUG ((EFI_D_ERROR, "TPM12: TPM_ST_RSP error - %x\n", TPM_TAG_RSP_COMMAND));\r
+  RspTag = SwapBytes16 (Data16);\r
+  if (RspTag != TPM_TAG_RSP_COMMAND && RspTag != TPM_TAG_RSP_AUTH1_COMMAND && RspTag != TPM_TAG_RSP_AUTH2_COMMAND) {\r
+    DEBUG ((EFI_D_ERROR, "TPM12: Response tag error - current tag value is %x\n", RspTag));\r
     Status = EFI_UNSUPPORTED;\r
     goto Exit;\r
   }\r