]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error
authorZhang, Chao B <chao.b.zhang@intel.com>
Tue, 20 Mar 2018 15:10:26 +0000 (23:10 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Wed, 21 Mar 2018 08:43:35 +0000 (16:43 +0800)
TPM12 command lib doesn't convert Response Size before using. Add logic
to fix the issue.

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/Tpm12CommandLib/Tpm12GetCapability.c

index c6eb9e1050d446258a2ed98103e022fa5f0c29ae..29d7a13edb159fe8deecce0253648f09985feead 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implement TPM1.2 Get Capabilities related commands.\r
 \r
 /** @file\r
   Implement TPM1.2 Get Capabilities related commands.\r
 \r
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved. <BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -85,7 +85,7 @@ Tpm12GetCapabilityFlagPermanent (
   }\r
 \r
   ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags));\r
   }\r
 \r
   ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags));\r
-  CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), Response.ResponseSize));\r
+  CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), SwapBytes32(Response.ResponseSize)));\r
 \r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
@@ -131,7 +131,7 @@ Tpm12GetCapabilityFlagVolatile (
   }\r
 \r
   ZeroMem (VolatileFlags, sizeof (*VolatileFlags));\r
   }\r
 \r
   ZeroMem (VolatileFlags, sizeof (*VolatileFlags));\r
-  CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), Response.ResponseSize));\r
+  CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), SwapBytes32(Response.ResponseSize)));\r
 \r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r