All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/8] tpm: rng: Move TPM RNG functionality to driver model
@ 2022-03-04 13:34 Sughosh Ganu
  2022-03-04 13:34 ` [PATCH v3 1/8] tpm: rng: Change tpm_get_random to return an int Sughosh Ganu
                   ` (7 more replies)
  0 siblings, 8 replies; 33+ messages in thread
From: Sughosh Ganu @ 2022-03-04 13:34 UTC (permalink / raw)
  To: u-boot; +Cc: Ilias Apalodimas, Simon Glass, Heinrich Schuchardt



The TPM device provides the random number generator(RNG)
functionality, whereby sending a command to the TPM device results in
the TPM device responding with random bytes.

There was a discussion on the mailing list earlier[1], where it was
explained that platforms with a TPM device can install the
EFI_RNG_PROTOCOL for getting the random bytes instead of populating
the dtb with the kaslr-seed property. That would make it possible to
measure the dtb.

This patchset moves the already existing functions for getting random
bytes from the TPM device to drivers complying with the RNG
uclass. This is done since the EFI_RNG_PROTOCOL's get_rng routine uses
the RNG uclass's dm_rng_read api to get the random bytes.

The TPM uclass driver adds the RNG child device as part of it's
post_probe function. The TPM uclass driver's child_pre_probe function
initialises the TPM parent device for use -- this enables the RNG
child device to be used subsequently.

Some additional changes have also been made to facilitate the
use of the RNG devices, including extending the 'rng' command to take
the RNG device as one of the command-line parameters.

This series depends on a patch[2] from Simon Glass for moving the TPM
device version detection functions to the tpm_api.h header as static
inline functions. Using this patch, a couple of patches[3][4] from the
series are no longer needed.

[1] - https://lore.kernel.org/u-boot/20220103120738.47835-1-ilias.apalodimas@linaro.org/
[2] - https://lore.kernel.org/u-boot/20220301001125.1554442-2-sjg@chromium.org/T/#u
[3] - https://lore.kernel.org/u-boot/20220228120638.678137-7-sughosh.ganu@linaro.org/T/#u
[4] - https://lore.kernel.org/u-boot/20220228120638.678137-6-sughosh.ganu@linaro.org/T/#u

Changes since V2:

* Export the existing tpm*_get_random functions to the driver model
  instead of moving them to the drivers/rng/ directory.
* Enable DM_RNG when CONFIG_TPM is enabled to build the RNG uclass
  code
* Additional patch for a document for the 'rng' command as suggested
  by Simon Glass
* Additional patch for unit test for the 'rng' command as suggested by
  Simon Glass

Sughosh Ganu (8):
  tpm: rng: Change tpm_get_random to return an int
  tpm: Fix the return type of tpm_startup
  tpm: rng: Add driver model interface for TPM RNG device
  tpm: Add the RNG child device
  qemu: arm: Remove platform specific function to get RNG device
  cmd: rng: Add support for selecting RNG device
  doc: rng: Add documentation for the rng command
  test: rng: Add a UT testcase for the rng command

 board/emulation/qemu-arm/qemu-arm.c | 42 --------------------
 cmd/Kconfig                         |  1 +
 cmd/rng.c                           | 31 +++++++++++----
 doc/usage/index.rst                 |  1 +
 doc/usage/rng.rst                   | 25 ++++++++++++
 drivers/tpm/tpm-uclass.c            | 60 +++++++++++++++++++++++++++--
 include/tpm-v1.h                    |  4 +-
 include/tpm-v2.h                    |  4 +-
 include/tpm_api.h                   |  6 +--
 lib/Kconfig                         |  1 +
 lib/tpm-v1.c                        | 28 ++++++++++----
 lib/tpm-v2.c                        | 21 +++++++---
 lib/tpm_api.c                       | 28 +++++++++++---
 test/dm/rng.c                       | 29 ++++++++++++++
 14 files changed, 201 insertions(+), 80 deletions(-)
 create mode 100644 doc/usage/rng.rst

-- 
2.25.1



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2022-03-24 16:22 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 13:34 [PATCH v3 0/8] tpm: rng: Move TPM RNG functionality to driver model Sughosh Ganu
2022-03-04 13:34 ` [PATCH v3 1/8] tpm: rng: Change tpm_get_random to return an int Sughosh Ganu
2022-03-09  7:36   ` Ilias Apalodimas
2022-03-04 13:34 ` [PATCH v3 2/8] tpm: Fix the return type of tpm_startup Sughosh Ganu
2022-03-09  7:37   ` Ilias Apalodimas
2022-03-04 13:34 ` [PATCH v3 3/8] tpm: rng: Add driver model interface for TPM RNG device Sughosh Ganu
2022-03-09  2:35   ` Simon Glass
2022-03-09  6:00     ` Sughosh Ganu
2022-03-09 11:18       ` Sughosh Ganu
2022-03-12 17:59         ` Simon Glass
2022-03-04 13:34 ` [PATCH v3 4/8] tpm: Add the RNG child device Sughosh Ganu
2022-03-09  2:35   ` Simon Glass
2022-03-09  6:02     ` Sughosh Ganu
2022-03-04 13:34 ` [PATCH v3 5/8] qemu: arm: Remove platform specific function to get RNG device Sughosh Ganu
2022-03-09  2:35   ` Simon Glass
2022-03-09  7:47     ` Ilias Apalodimas
2022-03-04 13:34 ` [PATCH v3 6/8] cmd: rng: Add support for selecting " Sughosh Ganu
2022-03-09  2:35   ` Simon Glass
2022-03-09  6:04     ` Sughosh Ganu
2022-03-09  7:42   ` Ilias Apalodimas
2022-03-09 15:32   ` Simon Glass
2022-03-10 12:42     ` Sughosh Ganu
2022-03-12 17:59       ` Simon Glass
2022-03-04 13:34 ` [PATCH v3 7/8] doc: rng: Add documentation for the rng command Sughosh Ganu
2022-03-09  2:35   ` Simon Glass
2022-03-09  7:39   ` Ilias Apalodimas
2022-03-04 13:34 ` [PATCH v3 8/8] test: rng: Add a UT testcase " Sughosh Ganu
2022-03-09  2:35   ` Simon Glass
2022-03-09  6:18     ` Sughosh Ganu
2022-03-12  2:43       ` Simon Glass
2022-03-13 11:07         ` Sughosh Ganu
2022-03-13 22:23           ` Simon Glass
2022-03-24 16:22   ` Sughosh Ganu

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.