[PATCH v2 2/7] tpm: Correct the permissions command in TPMv1

Ilias Apalodimas ilias.apalodimas at linaro.org
Tue Aug 16 15:58:49 CEST 2022


Hi Simon

On Sat, 13 Aug 2022 at 22:56, Simon Glass <sjg at chromium.org> wrote:
>
> The offset here is incorrect. Fix it.

Since we got it wrong the first time, any chance you can give me a
link to the spec describing these offsets (both for this and the
subsequent patch)

Thanks
/Ilias
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v1)
>
>  lib/tpm-v1.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c
> index 22a769c5874..d0e3ab1b21d 100644
> --- a/lib/tpm-v1.c
> +++ b/lib/tpm-v1.c
> @@ -456,12 +456,13 @@ u32 tpm1_get_permissions(struct udevice *dev, u32 index, u32 *perm)
>                 0x0, 0x0, 0x0, 0x4,
>         };
>         const size_t index_offset = 18;
> -       const size_t perm_offset = 60;
> +       const size_t perm_offset = 74;
>         u8 buf[COMMAND_BUFFER_SIZE], response[COMMAND_BUFFER_SIZE];
>         size_t response_length = sizeof(response);
>         u32 err;
>
> -       if (pack_byte_string(buf, sizeof(buf), "d", 0, command, sizeof(command),
> +       if (pack_byte_string(buf, sizeof(buf), "sd",
> +                            0, command, sizeof(command),
>                              index_offset, index))
>                 return TPM_LIB_ERROR;
>         err = tpm_sendrecv_command(dev, buf, response, &response_length);
> --
> 2.37.1.595.g718a3a8f04-goog
>


More information about the U-Boot mailing list