mbox series

[0/9] tpm: Enhance sandbox tpm2 emulation

Message ID 20210705154849.2083972-1-sjg@chromium.org
Headers show
Series tpm: Enhance sandbox tpm2 emulation | expand

Message

Simon Glass July 5, 2021, 3:48 p.m. UTC
At present the TPM2 emulator lacks the ability to load and save the
state. This means it cannot be used for verify-boot flow that includes
multiple phases (e.g. VPL and SPL). It also lacks support for
non-volatile data storage.

This series adds these features to the TPM2 emulator, with some code
from TPM1 moving into a common file.

A few other clean-ups are included to make the two emulators more similar.


Simon Glass (9):
  sandbox: tpm: Split out common nvdata code
  sandbox: tpm: Tidy up reading and writing of device state
  sandbox: tpm: Support the define-space command
  sandbox: tpm: Correct handling of get-capability
  sandbox: tpm: Finish comments for struct sandbox_tpm2
  sandbox: tpm: Track whether the state is valid
  sandbox: tpm: Support nvdata in TPM2
  sandbox: tpm: Support storing device state in tpm2
  sandbox: tpm: Support extending a PCR multiple times

 drivers/tpm/Makefile           |   4 +-
 drivers/tpm/sandbox_common.c   |  77 ++++++++++
 drivers/tpm/sandbox_common.h   | 108 ++++++++++++++
 drivers/tpm/tpm2_tis_sandbox.c | 256 +++++++++++++++++++++++++++++++--
 drivers/tpm/tpm_tis_sandbox.c  | 171 ++++++----------------
 include/tpm-v2.h               |   2 +
 6 files changed, 479 insertions(+), 139 deletions(-)
 create mode 100644 drivers/tpm/sandbox_common.c
 create mode 100644 drivers/tpm/sandbox_common.h

Comments

Simon Glass July 14, 2021, 7:51 p.m. UTC | #1
Hi Ilias,

On Mon, 5 Jul 2021 at 09:48, Simon Glass <sjg@chromium.org> wrote:
>
> At present the TPM2 emulator lacks the ability to load and save the
> state. This means it cannot be used for verify-boot flow that includes
> multiple phases (e.g. VPL and SPL). It also lacks support for
> non-volatile data storage.
>
> This series adds these features to the TPM2 emulator, with some code
> from TPM1 moving into a common file.
>
> A few other clean-ups are included to make the two emulators more similar.
>
>
> Simon Glass (9):
>   sandbox: tpm: Split out common nvdata code
>   sandbox: tpm: Tidy up reading and writing of device state
>   sandbox: tpm: Support the define-space command
>   sandbox: tpm: Correct handling of get-capability
>   sandbox: tpm: Finish comments for struct sandbox_tpm2
>   sandbox: tpm: Track whether the state is valid
>   sandbox: tpm: Support nvdata in TPM2
>   sandbox: tpm: Support storing device state in tpm2
>   sandbox: tpm: Support extending a PCR multiple times
>
>  drivers/tpm/Makefile           |   4 +-
>  drivers/tpm/sandbox_common.c   |  77 ++++++++++
>  drivers/tpm/sandbox_common.h   | 108 ++++++++++++++
>  drivers/tpm/tpm2_tis_sandbox.c | 256 +++++++++++++++++++++++++++++++--
>  drivers/tpm/tpm_tis_sandbox.c  | 171 ++++++----------------
>  include/tpm-v2.h               |   2 +
>  6 files changed, 479 insertions(+), 139 deletions(-)
>  create mode 100644 drivers/tpm/sandbox_common.c
>  create mode 100644 drivers/tpm/sandbox_common.h
>
> --
> 2.32.0.93.g670b81a890-goog
>

Not sure if you have any comments on this one?

Regards,
Simon
Ilias Apalodimas July 14, 2021, 9:07 p.m. UTC | #2
Hi Simon,

Unfortunately i had no time to look into this.  I'll have a look tomorrow

Cheers
/Ilias

On Wed, 14 Jul 2021 at 22:51, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Ilias,
>
> On Mon, 5 Jul 2021 at 09:48, Simon Glass <sjg@chromium.org> wrote:
> >
> > At present the TPM2 emulator lacks the ability to load and save the
> > state. This means it cannot be used for verify-boot flow that includes
> > multiple phases (e.g. VPL and SPL). It also lacks support for
> > non-volatile data storage.
> >
> > This series adds these features to the TPM2 emulator, with some code
> > from TPM1 moving into a common file.
> >
> > A few other clean-ups are included to make the two emulators more similar.
> >
> >
> > Simon Glass (9):
> >   sandbox: tpm: Split out common nvdata code
> >   sandbox: tpm: Tidy up reading and writing of device state
> >   sandbox: tpm: Support the define-space command
> >   sandbox: tpm: Correct handling of get-capability
> >   sandbox: tpm: Finish comments for struct sandbox_tpm2
> >   sandbox: tpm: Track whether the state is valid
> >   sandbox: tpm: Support nvdata in TPM2
> >   sandbox: tpm: Support storing device state in tpm2
> >   sandbox: tpm: Support extending a PCR multiple times
> >
> >  drivers/tpm/Makefile           |   4 +-
> >  drivers/tpm/sandbox_common.c   |  77 ++++++++++
> >  drivers/tpm/sandbox_common.h   | 108 ++++++++++++++
> >  drivers/tpm/tpm2_tis_sandbox.c | 256 +++++++++++++++++++++++++++++++--
> >  drivers/tpm/tpm_tis_sandbox.c  | 171 ++++++----------------
> >  include/tpm-v2.h               |   2 +
> >  6 files changed, 479 insertions(+), 139 deletions(-)
> >  create mode 100644 drivers/tpm/sandbox_common.c
> >  create mode 100644 drivers/tpm/sandbox_common.h
> >
> > --
> > 2.32.0.93.g670b81a890-goog
> >
>
> Not sure if you have any comments on this one?
>
> Regards,
> Simon
Simon Glass July 14, 2021, 10:16 p.m. UTC | #3
Hi Ilias,

On Wed, 14 Jul 2021 at 15:08, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Simon,
>
> Unfortunately i had no time to look into this.  I'll have a look tomorrow

OK thanks.

- Simon

>
> Cheers
> /Ilias
>
> On Wed, 14 Jul 2021 at 22:51, Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Ilias,
> >
> > On Mon, 5 Jul 2021 at 09:48, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > At present the TPM2 emulator lacks the ability to load and save the
> > > state. This means it cannot be used for verify-boot flow that includes
> > > multiple phases (e.g. VPL and SPL). It also lacks support for
> > > non-volatile data storage.
> > >
> > > This series adds these features to the TPM2 emulator, with some code
> > > from TPM1 moving into a common file.
> > >
> > > A few other clean-ups are included to make the two emulators more similar.
> > >
> > >
> > > Simon Glass (9):
> > >   sandbox: tpm: Split out common nvdata code
> > >   sandbox: tpm: Tidy up reading and writing of device state
> > >   sandbox: tpm: Support the define-space command
> > >   sandbox: tpm: Correct handling of get-capability
> > >   sandbox: tpm: Finish comments for struct sandbox_tpm2
> > >   sandbox: tpm: Track whether the state is valid
> > >   sandbox: tpm: Support nvdata in TPM2
> > >   sandbox: tpm: Support storing device state in tpm2
> > >   sandbox: tpm: Support extending a PCR multiple times
> > >
> > >  drivers/tpm/Makefile           |   4 +-
> > >  drivers/tpm/sandbox_common.c   |  77 ++++++++++
> > >  drivers/tpm/sandbox_common.h   | 108 ++++++++++++++
> > >  drivers/tpm/tpm2_tis_sandbox.c | 256 +++++++++++++++++++++++++++++++--
> > >  drivers/tpm/tpm_tis_sandbox.c  | 171 ++++++----------------
> > >  include/tpm-v2.h               |   2 +
> > >  6 files changed, 479 insertions(+), 139 deletions(-)
> > >  create mode 100644 drivers/tpm/sandbox_common.c
> > >  create mode 100644 drivers/tpm/sandbox_common.h
> > >
> > > --
> > > 2.32.0.93.g670b81a890-goog
> > >
> >
> > Not sure if you have any comments on this one?
> >
> > Regards,
> > Simon