From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 544C081E46 for ; Thu, 17 Nov 2016 16:51:29 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 17 Nov 2016 16:51:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,655,1473145200"; d="scan'208";a="902717502" Received: from shzintpr01.sh.intel.com (HELO [10.7.209.27]) ([10.239.4.80]) by orsmga003.jf.intel.com with ESMTP; 17 Nov 2016 16:51:33 -0800 To: "Yao, Jiewen" , "edk2-devel@lists.01.org" References: <1479374806-60448-1-git-send-email-star.zeng@intel.com> <74D8A39837DF1E4DA445A8C0B3885C50386D695D@shsmsx102.ccr.corp.intel.com> Cc: "Zhang, Chao B" From: "Zeng, Star" Message-ID: Date: Fri, 18 Nov 2016 08:51:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C50386D695D@shsmsx102.ccr.corp.intel.com> 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 00:51:29 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 observe something? The following GetDigestListBinSize (DigestBuffer) needs *DigestBuffer points to real digest buffer*. > >> - DigestBuffer = CopyDigestListToBuffer (DigestBuffer, DigestList, >> mTcgDxeData.BsCap.ActivePcrBanks); >> - CopyMem (DigestBuffer, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); >> - DigestBuffer = DigestBuffer + sizeof(NewEventHdr->EventSize); >> + EventSizePtr = CopyDigestListToBuffer (DigestBuffer, DigestList, >> mTcgDxeData.BsCap.ActivePcrBanks); >> + CopyMem (EventSizePtr, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); > > 2) I believe "GetDigestListSize (DigestList)" should be same as "GetDigestListBinSize (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, Jiewen ; >> 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 = NewEventHdr->PCRIndex; >> TcgPcrEvent2.EventType = NewEventHdr->EventType; >> DigestBuffer = (UINT8 *)&TcgPcrEvent2.Digest; >> - DigestBuffer = CopyDigestListToBuffer (DigestBuffer, DigestList, >> mTcgDxeData.BsCap.ActivePcrBanks); >> - CopyMem (DigestBuffer, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); >> - DigestBuffer = DigestBuffer + sizeof(NewEventHdr->EventSize); >> + EventSizePtr = CopyDigestListToBuffer (DigestBuffer, DigestList, >> mTcgDxeData.BsCap.ActivePcrBanks); >> + CopyMem (EventSizePtr, &NewEventHdr->EventSize, >> sizeof(NewEventHdr->EventSize)); >> >> // >> // Enter critical region >> @@ -1017,7 +1017,7 @@ TcgDxeLogHashEvent ( >> Status = 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