public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Long, Qin" <qin.long@intel.com>
To: "Zhang, Chao B" <chao.b.zhang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>,
	"Zhang, Chao B" <chao.b.zhang@intel.com>
Subject: Re: [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error
Date: Wed, 21 Mar 2018 02:58:19 +0000	[thread overview]
Message-ID: <BF2CCE9263284D428840004653A28B6E540861B5@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20180320151211.27896-1-chao.b.zhang@intel.com>

Reviewed-by: Long Qin <qin.long@intel.com>

Best Regards & Thanks,
LONG, Qin

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhang, Chao B
Sent: Tuesday, March 20, 2018 11:12 PM
To: edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>; Long, Qin <qin.long@intel.com>
Subject: [edk2] [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error

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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-03-21  2:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 15:12 [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error Zhang, Chao B
2018-03-21  2:58 ` Long, Qin [this message]
2018-03-21  6:42 ` Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BF2CCE9263284D428840004653A28B6E540861B5@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox