From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 20CC381F20 for ; Wed, 16 Nov 2016 19:18:48 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 16 Nov 2016 19:18:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,651,1473145200"; d="scan'208";a="1060479631" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 16 Nov 2016 19:18:53 -0800 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 16 Nov 2016 19:18:52 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 16 Nov 2016 19:18:52 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.239]) with mapi id 14.03.0248.002; Thu, 17 Nov 2016 11:18:50 +0800 From: "Zhang, Chao B" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [PATCH] SecurityPkg TPM2: Assign real copied count in CopyDigestListToBuffer() Thread-Index: AQHSQBF2nM8tpG94/0qilMgy2W0qX6Dcf+HA Date: Thu, 17 Nov 2016 03:18:49 +0000 Message-ID: References: <1479304666-51108-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1479304666-51108-1-git-send-email-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGZiZjFhMTUtZDA1Yi00NjM5LWIxNDktZmY5YjRhYTI5MzY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IktMYVlseDgrbmRZbFI5eEVTaUwrbU9UMzB0aDdxRXJEd0x5NkJ5QzF5NDA9In0= 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 03:18:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Star: Please use WtiteUnaligned32 to update hash count. Others are good to me. Thanks & Best regards Chao Zhang -----Original Message----- From: Zeng, Star=20 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; --=20 2.7.0.windows.1