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 061A281F1B for ; Thu, 17 Nov 2016 04:09:04 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 17 Nov 2016 04:09:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,653,1473145200"; d="scan'208,217";a="1086536687" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 17 Nov 2016 04:09:08 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 04:09:08 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.96]) with mapi id 14.03.0248.002; Thu, 17 Nov 2016 20:09:06 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Zhang, Chao B" Thread-Topic: [PATCH V2] SecurityPkg TPM2: Assign real copied count in CopyDigestListToBuffer() Thread-Index: AQHSQKlx4yIS8zT5PkWf1ZyX09KshKDdFUnA Date: Thu, 17 Nov 2016 12:09:05 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386D68FB@shsmsx102.ccr.corp.intel.com> References: <1479369936-63064-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1479369936-63064-1-git-send-email-star.zeng@intel.com> 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 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [PATCH V2] 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 12:09:04 -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: Zeng, Star > Sent: Thursday, November 17, 2016 4:06 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Yao, Jiewen ; > Zhang, Chao B > Subject: [PATCH V2] SecurityPkg TPM2: Assign real copied count in > CopyDigestListToBuffer() > > 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 | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c > b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c > index 43574a246829..be95fd69b3dd 100644 > --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c > +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c > @@ -230,8 +230,11 @@ CopyDigestListToBuffer ( > { > UINTN Index; > UINT16 DigestSize; > + UINT32 DigestListCount; > + UINT32 *DigestListCountPtr; > > - CopyMem (Buffer, &DigestList->count, sizeof(DigestList->count)); > + DigestListCountPtr =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].hashA > lg, HashAlgorithmMask)) { > @@ -243,7 +246,9 @@ CopyDigestListToBuffer ( > DigestSize =3D GetHashSizeFromAlgo > (DigestList->digests[Index].hashAlg); > CopyMem (Buffer, &DigestList->digests[Index].digest, DigestSize); > Buffer =3D (UINT8 *)Buffer + DigestSize; > + DigestListCount++; > } > + WriteUnaligned32 (DigestListCountPtr, DigestListCount); > > return Buffer; > } > -- > 2.7.0.windows.1