[PATCH v6 2/7] tpm: rng: Add driver model interface for TPM RNG device

Simon Glass sjg at chromium.org
Tue Jul 12 12:58:39 CEST 2022


Hi Sughosh,

On Tue, 5 Jul 2022 at 11:23, Sughosh Ganu <sughosh.ganu at linaro.org> wrote:
>
> hi Simon,
>
> On Tue, 5 Jul 2022 at 15:17, Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi Sughosh,
> >
> > On Mon, 4 Jul 2022 at 07:35, Sughosh Ganu <sughosh.ganu at linaro.org> wrote:
> > >
> > > The TPM device has a builtin random number generator(RNG)
> > > functionality. Expose the RNG functions of the TPM device to the
> > > driver model so that they can be used by the EFI_RNG_PROTOCOL if the
> > > protocol is installed.
> > >
> > > Also change the function arguments and return type of the random
> > > number functions to comply with the driver model api.
> > >
> > > Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> > > ---
> > > Changes since V5:
> > > * Use the dev_get_parent() interface for getting the TPM device when
> > >   calling the tpm_get_random() function
> > >
> > >  drivers/rng/Kconfig   | 11 +++++++++++
> > >  drivers/rng/Makefile  |  1 +
> > >  drivers/rng/tpm_rng.c | 23 +++++++++++++++++++++++
> > >  lib/Kconfig           |  1 +
> > >  lib/tpm-v1.c          | 13 +++++++------
> > >  lib/tpm-v2.c          |  6 +++---
> > >  lib/tpm_api.c         |  6 +++---
> > >  7 files changed, 49 insertions(+), 12 deletions(-)
> > >  create mode 100644 drivers/rng/tpm_rng.c
> >
> > The API change should not be needed. The code that calls the TPM
> > routines should adapt for that.
>
> Are you referring to the changes made in tpm[1,2]_get_random
> functions? If so, those changes in the return values have been made
> based on review comments from Heinrich[1]. If you are referring to
> some other changes, please let me know. Thanks.

I think Heinrich might have the wrong end of the stick.

The TPM API returns a positive error code. We should not change it.
The tpm_rng module can handle any conversion.

Regards,
Simon



>
> -sughosh
>
> [1] - https://lists.denx.de/pipermail/u-boot/2022-February/476085.html


More information about the U-Boot mailing list