From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 48C6381EF5 for ; Thu, 17 Nov 2016 04:32:56 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 17 Nov 2016 04:33:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,653,1473145200"; d="scan'208";a="1060639577" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 17 Nov 2016 04:33:00 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 04:33:00 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 04:33:00 -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:32:58 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Zhang, Chao B" Thread-Topic: [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size Thread-Index: AQHSQLTBOFODlNSLpUmTr3sz7vV1FKDdG1qA Date: Thu, 17 Nov 2016 12:32:57 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386D695D@shsmsx102.ccr.corp.intel.com> References: <1479374806-60448-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1479374806-60448-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 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: Thu, 17 Nov 2016 12:32:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 observ= e something? > - DigestBuffer =3D CopyDigestListToBuffer (DigestBuffer, DigestLis= t, > mTcgDxeData.BsCap.ActivePcrBanks); > - CopyMem (DigestBuffer, &NewEventHdr->EventSize, > sizeof(NewEventHdr->EventSize)); > - DigestBuffer =3D DigestBuffer + sizeof(NewEventHdr->EventSize); > + EventSizePtr =3D CopyDigestListToBuffer (DigestBuffer, DigestLis= t, > mTcgDxeData.BsCap.ActivePcrBanks); > + CopyMem (EventSizePtr, &NewEventHdr->EventSize, > sizeof(NewEventHdr->EventSize)); 2) I believe "GetDigestListSize (DigestList)" should be same as "GetDigestL= istBinSize (DigestBuffer)" May I know how did you observe such error? 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, Jiewen ; > Zhang, Chao B > Subject: [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size >=20 > 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. >=20 > 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(-) >=20 > 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; >=20 > DEBUG ((EFI_D_INFO, "SupportedEventLogs - 0x%08x\n", > mTcgDxeData.BsCap.SupportedEventLogs)); >=20 > @@ -1006,9 +1007,8 @@ TcgDxeLogHashEvent ( > TcgPcrEvent2.PCRIndex =3D NewEventHdr->PCRIndex; > TcgPcrEvent2.EventType =3D NewEventHdr->EventType; > DigestBuffer =3D (UINT8 *)&TcgPcrEvent2.Digest; > - DigestBuffer =3D CopyDigestListToBuffer (DigestBuffer, DigestLis= t, > mTcgDxeData.BsCap.ActivePcrBanks); > - CopyMem (DigestBuffer, &NewEventHdr->EventSize, > sizeof(NewEventHdr->EventSize)); > - DigestBuffer =3D DigestBuffer + sizeof(NewEventHdr->EventSize); > + EventSizePtr =3D CopyDigestListToBuffer (DigestBuffer, DigestLis= t, > mTcgDxeData.BsCap.ActivePcrBanks); > + CopyMem (EventSizePtr, &NewEventHdr->EventSize, > sizeof(NewEventHdr->EventSize)); >=20 > // > // 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