From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 7B26381F43 for ; Thu, 17 Nov 2016 00:06:21 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 17 Nov 2016 00:06:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,504,1473145200"; d="scan'208";a="1060561146" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 17 Nov 2016 00:06:26 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 00:06:26 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.138]) with mapi id 14.03.0248.002; Thu, 17 Nov 2016 16:06:24 +0800 From: "Zeng, Star" To: "Zhang, Chao B" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zeng, Star" Thread-Topic: [PATCH] SecurityPkg TPM2: Assign real copied count in CopyDigestListToBuffer() Thread-Index: AQHSQBF2uceDHIOcF0u+LvZ+88oq9aDb/GGAgADWSaA= Date: Thu, 17 Nov 2016 08:06:23 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB048310395B6CAF@shsmsx102.ccr.corp.intel.com> References: <1479304666-51108-1-git-send-email-star.zeng@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] SecurityPkg TPM2: Assign real copied count in CopyDigestListToBuffer() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 08:06:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Chao, Great comments, just sent out V2 patch, please help review it. Thanks, Star -----Original Message----- From: Zhang, Chao B=20 Sent: Thursday, November 17, 2016 11:19 AM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Yao, Jiewen Subject: RE: [PATCH] SecurityPkg TPM2: Assign real copied count in CopyDige= stListToBuffer() Hi Star: Please use WtiteUnaligned32 to update hash count. Others are good to me. Thanks & Best regards Chao Zhang -----Original Message----- From: Zeng, Star Sent: Wednesday, November 16, 2016 9:58 PM To: edk2-devel@lists.01.org Cc: Zeng, Star; Yao, Jiewen; Zhang, Chao B Subject: [PATCH] SecurityPkg TPM2: Assign real copied count in CopyDigestLi= stToBuffer() In CopyDigestListToBuffer() of Tpm2CommandLib, the count in returned Buffer= should be real copied DigestList count. Cc: Jiewen Yao Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c b/SecurityPkg/Li= brary/Tpm2CommandLib/Tpm2Help.c index 43574a246829..caa370c94381 100644 --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c @@ -230,8 +230,10 @@ CopyDigestListToBuffer ( { UINTN Index; UINT16 DigestSize; + UINT32 *DigestListCount; =20 - CopyMem (Buffer, &DigestList->count, sizeof(DigestList->count)); + DigestListCount =3D (UINT32 *) Buffer; + *DigestListCount =3D 0; Buffer =3D (UINT8 *)Buffer + sizeof(DigestList->count); for (Index =3D 0; Index < DigestList->count; Index++) { if (!IsHashAlgSupportedInHashAlgorithmMask(DigestList->digests[Index].= hashAlg, HashAlgorithmMask)) { @@ -243,6 +245,7 @@ CopyDigestListToBuffer ( DigestSize =3D GetHashSizeFromAlgo (DigestList->digests[Index].hashAlg= ); CopyMem (Buffer, &DigestList->digests[Index].digest, DigestSize); Buffer =3D (UINT8 *)Buffer + DigestSize; + (*DigestListCount)++; } =20 return Buffer; -- 2.7.0.windows.1