diff options
author | Sughosh Ganu <sughosh.ganu@linaro.org> | 2022-07-22 21:32:04 +0530 |
---|---|---|
committer | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2022-08-02 23:50:02 +0300 |
commit | e67ffb5aa5ab03a89305f4575ad3142486f9a306 (patch) | |
tree | 624c26edcc914c27bcdd0a8a04e4490995572d84 /lib | |
parent | 5d98329196daaf624c39304aec1397d6363b3e72 (diff) | |
download | u-boot-e67ffb5aa5ab03a89305f4575ad3142486f9a306.zip u-boot-e67ffb5aa5ab03a89305f4575ad3142486f9a306.tar.gz u-boot-e67ffb5aa5ab03a89305f4575ad3142486f9a306.tar.bz2 |
tpm: rng: Add driver model interface for TPM RNG device
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@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 1 | ||||
-rw-r--r-- | lib/tpm_api.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 7dd777b..e888c29 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -360,6 +360,7 @@ source lib/crypt/Kconfig config TPM bool "Trusted Platform Module (TPM) Support" depends on DM + imply DM_RNG help This enables support for TPMs which can be used to provide security features for your board. The TPM can be connected via LPC or I2C diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 4ac4612..032f383 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -269,7 +269,7 @@ u32 tpm_get_random(struct udevice *dev, void *data, u32 count) if (tpm_is_v1(dev)) return tpm1_get_random(dev, data, count); else if (tpm_is_v2(dev)) - return -ENOSYS; /* not implemented yet */ - else - return -ENOSYS; + return tpm2_get_random(dev, data, count); + + return -ENOSYS; } |