From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 3BE5181E97 for ; Thu, 17 Nov 2016 18:20:52 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 17 Nov 2016 18:20:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,655,1473145200"; d="scan'208,217";a="192813216" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 17 Nov 2016 18:20:57 -0800 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 18:20:56 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 18:20:56 -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; Fri, 18 Nov 2016 10:20:54 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Zhang, Chao B" Thread-Topic: [edk2] [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size Thread-Index: AQHSQLTBOFODlNSLpUmTr3sz7vV1FKDdG1qAgABIzICAAJ6PYA== Date: Fri, 18 Nov 2016 02:20:53 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386D70A4@shsmsx102.ccr.corp.intel.com> References: <1479374806-60448-1-git-send-email-star.zeng@intel.com> <74D8A39837DF1E4DA445A8C0B3885C50386D695D@shsmsx102.ccr.corp.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 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size 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: Fri, 18 Nov 2016 02:20:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, that is correct. I misunderstand the patch. Reviewed-by: Jiewen.yao@intel.com At same time, I would recommend we update PEI with comment on why we can us= e GetDigestListSize (DigestList) in PEI, but not use GetDigestListSize in D= XE, because people may compare these 2 version. Thank you Yao Jiewen From: Zeng, Star Sent: Friday, November 18, 2016 8:51 AM To: Yao, Jiewen ; edk2-devel@lists.01.org Cc: Zhang, Chao B Subject: Re: [edk2] [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list si= ze On 2016/11/17 20:32, Yao, Jiewen wrote: > Hi star > I am sorry that I am confused on this patch. > > 1) Below update is not related to the GIT message. > I think there is nothing wrong with previous code. May I know if you obse= rve something? The following GetDigestListBinSize (DigestBuffer) needs *DigestBuffer points to real digest buffer*. > >> - DigestBuffer =3D CopyDigestListToBuffer (DigestBuffer, DigestLi= st, >> mTcgDxeData.BsCap.ActivePcrBanks); >> - CopyMem (DigestBuffer, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); >> - DigestBuffer =3D DigestBuffer + sizeof(NewEventHdr->EventSize); >> + EventSizePtr =3D CopyDigestListToBuffer (DigestBuffer, DigestLi= st, >> mTcgDxeData.BsCap.ActivePcrBanks); >> + CopyMem (EventSizePtr, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); > > 2) I believe "GetDigestListSize (DigestList)" should be same as "GetDiges= tListBinSize (DigestBuffer)" > May I know how did you observe such error? DigestList points to the original full un-compacted digest list, DigestBuffer points to the copied partial compacted digest list. Thanks, Star > > > Thank you > Yao Jiewen > > > >> -----Original Message----- >> From: Zeng, Star >> Sent: Thursday, November 17, 2016 5:27 PM >> To: edk2-devel@lists.01.org >> Cc: Zeng, Star >; Yao, J= iewen >; >> Zhang, Chao B > >> Subject: [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size >> >> Current code uses GetDigestListSize(DigestList) to get >> digest list size, that is incorrect. >> The code should get digest list size of digests copied >> into event2 log, those digests are compacted, so >> GetDigestListBinSize() should be used. >> >> Cc: Jiewen Yao > >> Cc: Chao Zhang > >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Star Zeng > >> --- >> SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c >> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c >> index d5a32307db6e..f4740a34444c 100644 >> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c >> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c >> @@ -970,6 +970,7 @@ TcgDxeLogHashEvent ( >> EFI_STATUS RetStatus; >> TCG_PCR_EVENT2 TcgPcrEvent2; >> UINT8 *DigestBuffer; >> + UINT32 *EventSizePtr; >> >> DEBUG ((EFI_D_INFO, "SupportedEventLogs - 0x%08x\n", >> mTcgDxeData.BsCap.SupportedEventLogs)); >> >> @@ -1006,9 +1007,8 @@ TcgDxeLogHashEvent ( >> TcgPcrEvent2.PCRIndex =3D NewEventHdr->PCRIndex; >> TcgPcrEvent2.EventType =3D NewEventHdr->EventType; >> DigestBuffer =3D (UINT8 *)&TcgPcrEvent2.Digest; >> - DigestBuffer =3D CopyDigestListToBuffer (DigestBuffer, DigestLi= st, >> mTcgDxeData.BsCap.ActivePcrBanks); >> - CopyMem (DigestBuffer, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); >> - DigestBuffer =3D DigestBuffer + sizeof(NewEventHdr->EventSize); >> + EventSizePtr =3D CopyDigestListToBuffer (DigestBuffer, DigestLi= st, >> mTcgDxeData.BsCap.ActivePcrBanks); >> + CopyMem (EventSizePtr, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); >> >> // >> // Enter critical region >> @@ -1017,7 +1017,7 @@ TcgDxeLogHashEvent ( >> Status =3D TcgDxeLogEvent ( >> mTcg2EventInfo[Index].LogFormat, >> &TcgPcrEvent2, >> - sizeof(TcgPcrEvent2.PCRIndex) + >> sizeof(TcgPcrEvent2.EventType) + GetDigestListSize (DigestList) + >> sizeof(TcgPcrEvent2.EventSize), >> + sizeof(TcgPcrEvent2.PCRIndex) + >> sizeof(TcgPcrEvent2.EventType) + GetDigestListBinSize (DigestBuffer) + >> sizeof(TcgPcrEvent2.EventSize), >> NewEventData, >> NewEventHdr->EventSize >> ); >> -- >> 2.7.0.windows.1