Message ID | 20220224180552.26901-3-sughosh.ganu@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | tpm: rng: Move TPM RNG functionality to driver model | expand |
On 2/24/22 19:05, Sughosh Ganu wrote: > The tpm random number generation functionality will be moved to the > driver model. With that, the tpm_get_random function will call the > common driver model api instead of separate functions for tpmv1 and > tpmv2. Return an int instead of a u32 to comply with the return value > of the driver model function. > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > include/tpm_api.h | 4 ++-- > lib/tpm_api.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/tpm_api.h b/include/tpm_api.h > index ef45b43a8f..b9e3e8b5e6 100644 > --- a/include/tpm_api.h > +++ b/include/tpm_api.h > @@ -274,9 +274,9 @@ u32 tpm_find_key_sha1(struct udevice *dev, const u8 auth[20], > * @param dev TPM device > * @param data output buffer for the random bytes > * @param count size of output buffer > - * Return: return code of the operation > + * Return: 0 if OK, -ve on error > */ > -u32 tpm_get_random(struct udevice *dev, void *data, u32 count); > +int tpm_get_random(struct udevice *dev, void *data, u32 count); > > /** > * tpm_finalise_physical_presence() - Finalise physical presence > diff --git a/lib/tpm_api.c b/lib/tpm_api.c > index 4c662640a9..1bbe33a3fc 100644 > --- a/lib/tpm_api.c > +++ b/lib/tpm_api.c > @@ -274,7 +274,7 @@ u32 tpm_get_permissions(struct udevice *dev, u32 index, u32 *perm) > return -ENOSYS; > } > > -u32 tpm_get_random(struct udevice *dev, void *data, u32 count) > +int tpm_get_random(struct udevice *dev, void *data, u32 count) > { > if (is_tpm1(dev)) > return tpm1_get_random(dev, data, count);
On Thu, 24 Feb 2022 at 20:06, Sughosh Ganu <sughosh.ganu@linaro.org> wrote: > > The tpm random number generation functionality will be moved to the > driver model. With that, the tpm_get_random function will call the > common driver model api instead of separate functions for tpmv1 and > tpmv2. Return an int instead of a u32 to comply with the return value > of the driver model function. > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> > --- > include/tpm_api.h | 4 ++-- > lib/tpm_api.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/tpm_api.h b/include/tpm_api.h > index ef45b43a8f..b9e3e8b5e6 100644 > --- a/include/tpm_api.h > +++ b/include/tpm_api.h > @@ -274,9 +274,9 @@ u32 tpm_find_key_sha1(struct udevice *dev, const u8 auth[20], > * @param dev TPM device > * @param data output buffer for the random bytes > * @param count size of output buffer > - * Return: return code of the operation > + * Return: 0 if OK, -ve on error > */ > -u32 tpm_get_random(struct udevice *dev, void *data, u32 count); > +int tpm_get_random(struct udevice *dev, void *data, u32 count); > > /** > * tpm_finalise_physical_presence() - Finalise physical presence > diff --git a/lib/tpm_api.c b/lib/tpm_api.c > index 4c662640a9..1bbe33a3fc 100644 > --- a/lib/tpm_api.c > +++ b/lib/tpm_api.c > @@ -274,7 +274,7 @@ u32 tpm_get_permissions(struct udevice *dev, u32 index, u32 *perm) > return -ENOSYS; > } > > -u32 tpm_get_random(struct udevice *dev, void *data, u32 count) > +int tpm_get_random(struct udevice *dev, void *data, u32 count) > { > if (is_tpm1(dev)) > return tpm1_get_random(dev, data, count); > -- > 2.17.1 > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/include/tpm_api.h b/include/tpm_api.h index ef45b43a8f..b9e3e8b5e6 100644 --- a/include/tpm_api.h +++ b/include/tpm_api.h @@ -274,9 +274,9 @@ u32 tpm_find_key_sha1(struct udevice *dev, const u8 auth[20], * @param dev TPM device * @param data output buffer for the random bytes * @param count size of output buffer - * Return: return code of the operation + * Return: 0 if OK, -ve on error */ -u32 tpm_get_random(struct udevice *dev, void *data, u32 count); +int tpm_get_random(struct udevice *dev, void *data, u32 count); /** * tpm_finalise_physical_presence() - Finalise physical presence diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 4c662640a9..1bbe33a3fc 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -274,7 +274,7 @@ u32 tpm_get_permissions(struct udevice *dev, u32 index, u32 *perm) return -ENOSYS; } -u32 tpm_get_random(struct udevice *dev, void *data, u32 count) +int tpm_get_random(struct udevice *dev, void *data, u32 count) { if (is_tpm1(dev)) return tpm1_get_random(dev, data, count);
The tpm random number generation functionality will be moved to the driver model. With that, the tpm_get_random function will call the common driver model api instead of separate functions for tpmv1 and tpmv2. Return an int instead of a u32 to comply with the return value of the driver model function. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> --- include/tpm_api.h | 4 ++-- lib/tpm_api.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)