From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 78BFA225E965A for ; Tue, 20 Mar 2018 23:35:36 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 23:42:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,338,1517904000"; d="scan'208";a="43936869" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 20 Mar 2018 23:42:06 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Mar 2018 23:42:06 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Mar 2018 23:42:05 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.80]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.129]) with mapi id 14.03.0319.002; Wed, 21 Mar 2018 14:42:04 +0800 From: "Yao, Jiewen" To: "Zhang, Chao B" , "edk2-devel@lists.01.org" CC: "Zhang, Chao B" , "Long, Qin" Thread-Topic: [edk2] [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error Thread-Index: AQHTwF3imeEJKxwYK0uJo3HpMOrDbaPaPqZQ Date: Wed, 21 Mar 2018 06:42:02 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AB09A3C@shsmsx102.ccr.corp.intel.com> References: <20180320151211.27896-1-chao.b.zhang@intel.com> In-Reply-To: <20180320151211.27896-1-chao.b.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWQxNjJmYzYtN2ZlOC00NDhlLTk4NDQtYTc2MzM0OGY2OTJkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiIyVWl5dVJ0SHhWWHdnMGxTNnpjeUdlR0wydDZSNnhvV2VtQXV6MnBcL2wxZzdVNlM4RlU5bTdWd0tlUXpUMzJHXC8ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 06:35:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zh= ang, > Chao B > Sent: Tuesday, March 20, 2018 11:12 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Zhang, Chao B > ; Long, Qin > Subject: [edk2] [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 > GetCapability response error >=20 > TPM12 command lib doesn't convert Response Size before using. Add logic > to fix the issue. >=20 > Cc: Long Qin > Cc: Yao Jiewen > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chao Zhang > Signed-off-by: Zhang, Chao B > --- > SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > 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. >=20 > -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e found > at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -83,11 +83,11 @@ Tpm12GetCapabilityFlagPermanent ( > DEBUG ((DEBUG_ERROR, "Tpm12GetCapabilityFlagPermanent: Response > Code error! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode))); > return EFI_DEVICE_ERROR; > } >=20 > ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags)); > - CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof > (*TpmPermanentFlags), Response.ResponseSize)); > + CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof > (*TpmPermanentFlags), SwapBytes32(Response.ResponseSize))); >=20 > return Status; > } >=20 > /** > @@ -129,9 +129,9 @@ Tpm12GetCapabilityFlagVolatile ( > DEBUG ((DEBUG_ERROR, "Tpm12GetCapabilityFlagVolatile: Response Code > error! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode))); > return EFI_DEVICE_ERROR; > } >=20 > ZeroMem (VolatileFlags, sizeof (*VolatileFlags)); > - CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), > Response.ResponseSize)); > + CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), > SwapBytes32(Response.ResponseSize))); >=20 > return Status; > } > -- > 2.16.2.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel