[PATCH 07/11] tpm: Reduce duplication in a few functions
Ilias Apalodimas
ilias.apalodimas at linaro.org
Tue Jan 19 09:22:44 CET 2021
Hi Simon,
On Sat, Jan 16, 2021 at 02:51:34PM -0700, Simon Glass wrote:
> Update tpm2_clear() and tpm2_pcr_extend() so that the command size
> is not repeated twice. Add a small comment to the latter.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> lib/tpm-v2.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
> index 1f3deb06e48..b148081afd7 100644
> --- a/lib/tpm-v2.c
> +++ b/lib/tpm-v2.c
> @@ -47,9 +47,10 @@ u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test)
> u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw,
> const ssize_t pw_sz)
> {
> + uint offset = 27;
I know this was a pre-existing problem, but a comment explaining the 'magic'
offsets, or a link to the relevant documentation would come in handy.
> u8 command_v2[COMMAND_BUFFER_SIZE] = {
> */
[...]
> ret = pack_byte_string(command_v2, sizeof(command_v2), "s",
> offset, digest, digest_len);
> - offset += digest_len;
This is removed because offset is not used after the calculation, right?
> if (ret)
> return TPM_LIB_ERROR;
>
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>
More information about the U-Boot
mailing list