Hi Ludwig,

On 2026-06-29T08:00:59, Ludwig Nussel <[email protected]> wrote:
> tpm: print all PCRs from pcr_read
>
> Output is now more similar to the Linux userspace tool 'tpm2_pcrread'.
>
> The old semantics that require specifying one PCR number are
> retained. In addition with no arguments the command now prints
> contents of all PCR registers.
>
> Signed-off-by: Ludwig Nussel <[email protected]>
> Acked-by: Ilias Apalodimas <[email protected]>
>
> cmd/tpm-v2.c               | 69 +++++++++++++++++++++++++++++++++-------------
>  test/py/tests/test_tpm2.py |  9 ++----
>  2 files changed, 53 insertions(+), 25 deletions(-)

> diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c
> @@ -168,25 +170,51 @@ static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int 
> flag, int argc,
> +             if (rc == 0) {
> +                     printf('0x');
> +                     for (int i = 0; i < algo_len; ++i)
> +                             printf('%02X', data[i]);
> +                     printf(" (%u known updates)\n", updates);
> +             } else {
> +                     log_err("PCR #%u read failed: %d\n", index, rc);
> +                     ret = report_return_code(rc);
> +             }

prefer if (!rc) over if (rc == 0), and report_return_code()
double-prints the error on top of log_err(). Please just set ret =
CMD_RET_FAILURE here.

Regards,
Simon

Reply via email to