public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error
@ 2018-03-20 15:12 Zhang, Chao B
  2018-03-21  2:58 ` Long, Qin
  2018-03-21  6:42 ` Yao, Jiewen
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang, Chao B @ 2018-03-20 15:12 UTC (permalink / raw)
  To: edk2-devel; +Cc: Long Qin, Yao Jiewen, Chao Zhang

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>
Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
---
 SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c b/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c
index c6eb9e1050..29d7a13edb 100644
--- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c
+++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c
@@ -1,9 +1,9 @@
 /** @file
   Implement TPM1.2 Get Capabilities related commands.
 
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved. <BR>
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved. <BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -83,11 +83,11 @@ Tpm12GetCapabilityFlagPermanent (
     DEBUG ((DEBUG_ERROR, "Tpm12GetCapabilityFlagPermanent: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode)));
     return EFI_DEVICE_ERROR;
   }
 
   ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags));
-  CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), Response.ResponseSize));
+  CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), SwapBytes32(Response.ResponseSize)));
 
   return Status;
 }
 
 /**
@@ -129,9 +129,9 @@ Tpm12GetCapabilityFlagVolatile (
     DEBUG ((DEBUG_ERROR, "Tpm12GetCapabilityFlagVolatile: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode)));
     return EFI_DEVICE_ERROR;
   }
 
   ZeroMem (VolatileFlags, sizeof (*VolatileFlags));
-  CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), Response.ResponseSize));
+  CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), SwapBytes32(Response.ResponseSize)));
 
   return Status;
 }
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-21  6:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-20 15:12 [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error Zhang, Chao B
2018-03-21  2:58 ` Long, Qin
2018-03-21  6:42 ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox