public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Zeng, Star" <star.zeng@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zhang, Chao B" <chao.b.zhang@intel.com>
Subject: Re: [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size
Date: Fri, 18 Nov 2016 02:20:53 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386D70A4@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <c5d1a4bb-7da0-43d4-18f7-cb6e3117a8a2@intel.com>

Yes, that is correct. I misunderstand the patch.

Reviewed-by: Jiewen.yao@intel.com<mailto:Jiewen.yao@intel.com>

At same time, I would recommend we update PEI with comment on why we can use GetDigestListSize (DigestList) in PEI, but not use GetDigestListSize in DXE, 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 <jiewen.yao@intel.com>; edk2-devel@lists.01.org
Cc: Zhang, Chao B <chao.b.zhang@intel.com>
Subject: Re: [edk2] [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size

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<mailto:edk2-devel@lists.01.org>
>> Cc: Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>;
>> Zhang, Chao B <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
>> 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 <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>
>> Cc: Chao Zhang <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>>
>> ---
>>  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


      reply	other threads:[~2016-11-18  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17  9:26 [PATCH] SecurityPkg Tcg2Dxe: Get correct digest list size Star Zeng
2016-11-17 12:32 ` Yao, Jiewen
2016-11-18  0:51   ` Zeng, Star
2016-11-18  2:20     ` Yao, Jiewen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C50386D70A4@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox