From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=qin.long@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 B0AFB225E966E for ; Tue, 20 Mar 2018 19:51:54 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 19:58:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,338,1517904000"; d="scan'208";a="35517394" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 20 Mar 2018 19:58:24 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Mar 2018 19:58:24 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Mar 2018 19:58:24 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.108]) with mapi id 14.03.0319.002; Wed, 21 Mar 2018 10:58:20 +0800 From: "Long, Qin" To: "Zhang, Chao B" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zhang, Chao B" Thread-Topic: [edk2] [Patch] SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error Thread-Index: AQHTwF3iCKzQPKJ8dUa5yYc8YPmXNKPaABRw Date: Wed, 21 Mar 2018 02:58:19 +0000 Message-ID: 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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTNmMmMwMGQtNGI3ZS00NTQyLTk0OGQtMWM0M2RkMTljZjBjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJydjlMenpFYVk5WEhaMTJBY1k3MXNnSVZzbHlNamZ4ME5xdUZoc1pra09WZ0R5RUcwSFhRWXF6bFpHbUdxbjYwIn0= 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 02:51:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Long Qin Best Regards & Thanks, LONG, Qin -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhan= g, 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 GetCapabilit= y response error TPM12 command lib doesn't convert Response Size before using. Add logic to = fix the issue. 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(-) diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c b/Sec= urityPkg/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 availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at http://opens= ource.org/licenses/bsd-license.php =20 @@ -83,11 +83,11 @@ Tpm12GetCapabilityFlagPermanent ( DEBUG ((DEBUG_ERROR, "Tpm12GetCapabilityFlagPermanent: Response Code e= rror! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode))); return EFI_DEVICE_ERROR; } =20 ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags)); - CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentF= lags), Response.ResponseSize)); + CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof=20 + (*TpmPermanentFlags), SwapBytes32(Response.ResponseSize))); =20 return Status; } =20 /** @@ -129,9 +129,9 @@ Tpm12GetCapabilityFlagVolatile ( DEBUG ((DEBUG_ERROR, "Tpm12GetCapabilityFlagVolatile: Response Code er= ror! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode))); return EFI_DEVICE_ERROR; } =20 ZeroMem (VolatileFlags, sizeof (*VolatileFlags)); - CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), R= esponse.ResponseSize)); + CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof=20 + (*VolatileFlags), SwapBytes32(Response.ResponseSize))); =20 return Status; } -- 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel