public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Min Xu" <min.m.xu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"sami.mujawar@arm.com" <sami.mujawar@arm.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	"Wang, Jian J" <jian.j.wang@intel.com>, nd <nd@arm.com>,
	Joey Gouly <Joey.Gouly@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 2/3] SecurityPkg: Support TdProtocol in DxeTpm2MeasureBootLib
Date: Wed, 27 Oct 2021 05:19:31 +0000	[thread overview]
Message-ID: <PH0PR11MB50648C8855D1F79DBED191AEC5859@PH0PR11MB5064.namprd11.prod.outlook.com> (raw)
In-Reply-To: <8f972fd2-30fb-9eb2-0ec4-f10031faff04@arm.com>

On October 19, 2021 9:23 PM, Sami Mujawar wrote:
> >     //
> >     // Read the EFI Partition Table Header
> >     //
> > @@ -156,6 +224,15 @@ Tcg2MeasureGptTable (
> >     if (PrimaryHeader == NULL) {
> >       return EFI_OUT_OF_RESOURCES;
> >     }
> > +
> > +  //
> > +  // PrimaryHeader->SizeOfPartitionEntry should not be zero  //  if
> > + (PrimaryHeader->SizeOfPartitionEntry == 0) {
> > +    DEBUG ((DEBUG_ERROR, "SizeOfPartitionEntry should not be zero!\n"));
> > +    return EFI_BAD_BUFFER_SIZE;
> > +  }
> [SAMI] I think this check is at an incorrect location. Should this be after the
> ReadDisk() below? Also, PrimaryHeader would need to be freed in the error
> scenario above.
Good capture! It will be fixed in the next version.

> >
> > +  if (TdProtocol != NULL) {
> > +    TdEvent = CreateTdEventFromTcg2Event (TdProtocol, Tcg2Event,
> EventSize);
> > +    if (TdEvent == NULL) {
> > +      goto Exit;
> [SAMI] I think Status should be set to reflect an appropriate error code here.
I am thinking if TCG2_PROTOCOL and TEE_PROTOCOL will be installed in the same time?
1) If these 2 protocols are NOT installed in the same time, then the returned status reflect the actual operation result of the protocol.
2) If these 2 protocols can be installed in the same time, then it will be a problem that the how to reflect the operation result of the protocols by the status?
I prefer 1) that these 2 protocols are NOT installed in the same time. Because it doesn't make sense to measure the boot in 2 times.
What's your suggestion?
BTW, CreateTdEventFromTcg2Event will be updated to return a status to indicate the operation result. So that the status can reflect an appropriate error code.

> Also would it be possible to create this event just before calling
> TdProtocol->HashLogExtendEvent at line 351?
> I am trying to understand why is this done differently in
> Tcg2MeasurePeImage() i.e. The TdEvent is created and extended in the same
> if (TdProtocol != NULL) block.
You're right. TdEvent should be created and extended in the same if block.  It will be fixed in the next version.
> [/SAMI]

> > +
> > +  if (TdProtocol != NULL) {
> > +    TdEvent = CreateTdEventFromTcg2Event (TdProtocol, Tcg2Event,
> EventSize);
> > +    if (TdEvent == NULL) {
> > +      goto Finish;
> [SAMI] I think Status should be set to reflect an appropriate error code here.
It will be fixed in the next version.
> > **) &Tcg2Protocol);
> > +  MeasureBootProtocols.Tcg2Protocol = NULL;
> > +  MeasureBootProtocols.TdProtocol   = NULL;
> > +
> > +  Status = GetMeasureBootProtocols(&MeasureBootProtocols);
> > +
> >     if (EFI_ERROR (Status)) {
> > -    //
> > -    // Tcg2 protocol is not installed. So, TPM2 is not present.
> > -    // Don't do any measurement, and directly return EFI_SUCCESS.
> > -    //
> [SAMI] It may be helpful to retain the oirginal comment with slight
> rewording.
Sure. It will be added and reworded in the next version. Thanks for reminder.

Thanks
Min

  reply	other threads:[~2021-10-27  5:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  5:21 [PATCH V2 0/3] Introduce TdProtocol into EDK2 Min Xu
2021-10-08  5:21 ` [PATCH V2 1/3] MdePkg: Introduce TdProtocol for TD-Guest firmware Min Xu
2021-10-11  1:37   ` 回复: " gaoliming
2021-10-19 13:21   ` [edk2-devel] " Sami Mujawar
2021-10-19 14:40     ` Yao, Jiewen
2021-10-20  9:26       ` Sami Mujawar
2021-10-08  5:21 ` [PATCH V2 2/3] SecurityPkg: Support TdProtocol in DxeTpm2MeasureBootLib Min Xu
2021-10-19 13:22   ` [edk2-devel] " Sami Mujawar
2021-10-27  5:19     ` Min Xu [this message]
2021-11-01 13:35       ` Sami Mujawar
2021-10-08  5:21 ` [PATCH V2 3/3] SecurityPkg: Support TdProtocol in DxeTpmMeasurementLib Min Xu
2021-10-19 13:24   ` [edk2-devel] " Sami Mujawar
2021-10-12 15:26 ` [edk2-devel] [PATCH V2 0/3] Introduce TdProtocol into EDK2 Sami Mujawar
2021-10-14  5:41   ` Min Xu
2021-10-14 11:59     ` Yao, Jiewen
     [not found]     ` <16ADE3D948B3147A.7007@groups.io>
2021-10-14 13:43       ` Yao, Jiewen
2021-10-18 12:59         ` Sami Mujawar
2021-10-18 13:06           ` Yao, Jiewen
2021-10-19  9:51             ` Sami Mujawar
2021-10-19 13:06               ` Min Xu

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=PH0PR11MB50648C8855D1F79DBED191AEC5859@PH0PR11MB5064.namprd11.prod.outlook.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