problem with reading the NV memory index of TPM slb9670

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Nov 21 13:56:20 CET 2022


Hi Simon, thanks for the cc

Tasos thanks for the report.  Here's what happens here

On Fri, 18 Nov 2022 at 22:50, Simon Glass <sjg at chromium.org> wrote:
>
> +Ilias Apalodimas
>
>
> On Tue, 15 Nov 2022 at 23:12, Tasos Terzidis <terzanasta at gmail.com> wrote:
> >
> > Hello,
> >
> > I tried to use a tpm2 command for reading the NV memory index of an slb9670
> > TPM.
> >
> > I noticed in file cmd/tpm-v2.c, that the command tpm2 nv_read_value (as tpm
> > nv_read_value)
> >
> > is not implemented. In file lib/tpm-v2.c there is the tpm2_nv_read_value
> > function.
> >
> > Do you plan to implement the command tpm2 nv_read_value in the future ?

That should be relatively easy to plug in and test.  The functionality
already exists in the TPM API (tpm_nv_read_value support v1 & v2).
However no one has added it in 'tpm2' functions which explains what
you see below.

The entry point for the tpm command is 'cmd/tpm-common.c'.  In that
code we try to figure out if we are talking to a tpmv1 or v2.  In your
case it's a v2 and you get back a usage message since reading nvram
isn't implemented yet.

> >
> >
> >
> > Then I used the
> >
> > tpm nv_read_value index addr count
> >
> >       "Read <count> bytes from space <index> to memory address <addr>".
> >
> >
> >
> > The syntax I used is
> >
> > tpm nv_read_value 0x100000000 0x30000000 20
> >
> > I’m trying to read 32 bytes from 0x100000000 index nv memory of TPM
> >
> > to 0x30000000 memory of u-boot
> >
> > U-boot can’t understand the command and returns the help listing all the
> > commands for tpm.
> >
> > I also used
> >
> > tpm nv_read_value 0x0 0x30000000 20
> >
> > 0x0 as an offset to 0x100000000 index of NV memory (following the syntax of
> > tpm2_nvread command o TSS tpm –tools)
> >
> >
> > Same result, list of commands for tpm
> >
> >
> >
> > Other commands of tpm such as tpm2 pcr read or extend functions as expected
> > in u-boot environment
> >
> >
> >
> > I can’t understand what I do wrong
> >

Thanks
/Ilias
> >
> >
> > Thank you
> >
> > Tasos Terzids


More information about the U-Boot mailing list