All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	 Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: Re: [PATCH 9/9] sandbox: tpm: Support extending a PCR multiple times
Date: Tue, 20 Jul 2021 12:33:10 -0600	[thread overview]
Message-ID: <CAPnjgZ3uKgq87MWmjzcTzA0MC0Fz868r3yEDxE-B+UEiQCOevg@mail.gmail.com> (raw)
In-Reply-To: <CAC_iWj+Z-D345bfATCwsS0F4jzGnkD8h+nBJT=wwD8_Jw-3T=A@mail.gmail.com>

Hi Ilias,

On Thu, 15 Jul 2021 at 13:21, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> On Thu, 15 Jul 2021 at 22:04, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > On Mon, Jul 05, 2021 at 09:48:49AM -0600, Simon Glass wrote:
> > > It is fairly easy to handle this case and it makes the emulator more
> > > useful, since PCRs are commonly extended several times.
> > >
> > > Add support for this, using U-Boot's sha256 support.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > >  drivers/tpm/tpm2_tis_sandbox.c | 19 ++++++++++++-------
> > >  1 file changed, 12 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
> > > index ed9c9a0bc9f..e84bcc7c4c8 100644
> > > --- a/drivers/tpm/tpm2_tis_sandbox.c
> > > +++ b/drivers/tpm/tpm2_tis_sandbox.c
> > > @@ -11,6 +11,7 @@
> > >  #include <asm/unaligned.h>
> > >  #include <linux/bitops.h>
> > >  #include <u-boot/crc.h>
> > > +#include <u-boot/sha256.h>
> > >  #include "sandbox_common.h"
> > >
> > >  /* Hierarchies */
> > > @@ -407,15 +408,19 @@ static int sandbox_tpm2_extend(struct udevice *dev, int pcr_index,
> > >                              const u8 *extension)
> > >  {
> > >       struct sandbox_tpm2 *tpm = dev_get_priv(dev);
> > > -     int i;
> > >
> > > -     /* Only simulate the first extensions from all '0' with only '0' */
> > > -     for (i = 0; i < TPM2_DIGEST_LEN; i++)
> > > -             if (tpm->pcr[pcr_index][i] || extension[i])
> > > -                     return TPM2_RC_FAILURE;
> > > +     if (!pcr_index) {
> > > +             memcpy(tpm->pcr[pcr_index], sandbox_extended_once_pcr,
> > > +                    TPM2_DIGEST_LEN);
> >
> > Why do we have to treat pcr 0 specially?
> > Can't we just get rid of sandbox_extended_once_pcr and just extend all the
> > PCRs with the value wee get?
> >
>
> Also looking at the entire series, SANDBOX_TPM_PCR_NB doesn't seem to change.
> I don't know too much about the tpm sandbox, but that effectively
> limits us to a single PCR?

I did send an updated series.

That's right, only one PCR is currently used by the tests.

Regards,
Simon

  reply	other threads:[~2021-07-20 18:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 15:48 [PATCH 0/9] tpm: Enhance sandbox tpm2 emulation Simon Glass
2021-07-05 15:48 ` [PATCH 1/9] sandbox: tpm: Split out common nvdata code Simon Glass
2021-07-05 15:48 ` [PATCH 2/9] sandbox: tpm: Tidy up reading and writing of device state Simon Glass
2021-07-05 15:48 ` [PATCH 3/9] sandbox: tpm: Support the define-space command Simon Glass
2021-07-05 15:48 ` [PATCH 4/9] sandbox: tpm: Correct handling of get-capability Simon Glass
2021-07-15 18:07   ` Ilias Apalodimas
2021-07-05 15:48 ` [PATCH 5/9] sandbox: tpm: Finish comments for struct sandbox_tpm2 Simon Glass
2021-07-15 18:09   ` Ilias Apalodimas
2021-07-05 15:48 ` [PATCH 6/9] sandbox: tpm: Track whether the state is valid Simon Glass
2021-07-05 15:48 ` [PATCH 7/9] sandbox: tpm: Support nvdata in TPM2 Simon Glass
2021-07-05 15:48 ` [PATCH 8/9] sandbox: tpm: Support storing device state in tpm2 Simon Glass
2021-07-05 15:48 ` [PATCH 9/9] sandbox: tpm: Support extending a PCR multiple times Simon Glass
2021-07-15 19:04   ` Ilias Apalodimas
2021-07-15 19:20     ` Ilias Apalodimas
2021-07-20 18:33       ` Simon Glass [this message]
2021-07-14 19:51 ` [PATCH 0/9] tpm: Enhance sandbox tpm2 emulation Simon Glass
2021-07-14 21:07   ` Ilias Apalodimas
2021-07-14 22:16     ` Simon Glass

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-all 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=CAPnjgZ3uKgq87MWmjzcTzA0MC0Fz868r3yEDxE-B+UEiQCOevg@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=thiruan@linux.microsoft.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.