From nobody Thu May 2 21:34:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521558738153873.5444974172443; Tue, 20 Mar 2018 08:12:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7E9972253FB4B; Tue, 20 Mar 2018 08:05:46 -0700 (PDT) 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 B89582246803D for ; Tue, 20 Mar 2018 08:05:44 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 08:12:14 -0700 Received: from czhan46-mobl1.ccr.corp.intel.com ([10.254.211.248]) by fmsmga004.fm.intel.com with ESMTP; 20 Mar 2018 08:12:13 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=chao.b.zhang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,336,1517904000"; d="scan'208";a="39066135" From: "Zhang, Chao B" To: edk2-devel@lists.01.org Date: Tue, 20 Mar 2018 23:12:11 +0800 Message-Id: <20180320151211.27896-1-chao.b.zhang@intel.com> X-Mailer: git-send-email 2.11.0.windows.1 Subject: [edk2] [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: , Cc: Yao Jiewen , Chao Zhang , Long Qin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Jiewen.yao@intel.com Reviewed-by: Long Qin --- 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 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 =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 (*TpmPermanentF= lags), 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 (*VolatileFlags), S= wapBytes32(Response.ResponseSize))); =20 return Status; } --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel