U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] tpm: remove check on pcr bank count
@ 2024-07-15 13:33 Benjamin BARATTE
  2024-07-29 14:05 ` Ilias Apalodimas
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin BARATTE @ 2024-07-15 13:33 UTC (permalink / raw)
  To: u-boot@lists.denx.de
  Cc: eajames@linux.ibm.com, xypron.glpk@gmx.de, sjg@chromium.org,
	tharvey@gateworks.com, trini@konsulko.com

The number of PCR banks return by the tpm2_get_pcr_info() is related to
TPM supported list of hash algorithm that could be greater than thus
supported by U-Boot. This is not an issue as long as the PCR active bank
hash an hash algorithm supported by U-Boot.
Therefore, checking the number of PCR bank supported by the dTPM and
thus supported by U-Boot doesn't make sense.
This test shall be removed or shall reflect the maximum hash algorithm
defined by the TPM2.0 spec 1.59 which is 8 hash algorithms.

Signed-off-by: Benjamin BARATTE <benjamin.baratte@st.com>
---

 lib/tpm-v2.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
index 59e6cbafaf..64a2f15fee 100644
--- a/lib/tpm-v2.c
+++ b/lib/tpm-v2.c
@@ -413,14 +413,6 @@ int tpm2_get_pcr_info(struct udevice *dev, struct tpml_pcr_selection *pcrs)
                return ret;

        pcrs->count = get_unaligned_be32(response);
-       /*
-        * We only support 4 algorithms for now so check against that
-        * instead of TPM2_NUM_PCR_BANKS
-        */
-       if (pcrs->count > 4 || pcrs->count < 1) {
-               printf("%s: too many pcrs: %u\n", __func__, pcrs->count);
-               return -EMSGSIZE;
-       }

        ret = tpm2_get_num_pcr(dev, &num_pcr);
        if (ret)
--
2.34.1

ST Restricted

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] tpm: remove check on pcr bank count
  2024-07-15 13:33 [PATCH 2/3] tpm: remove check on pcr bank count Benjamin BARATTE
@ 2024-07-29 14:05 ` Ilias Apalodimas
  0 siblings, 0 replies; 2+ messages in thread
From: Ilias Apalodimas @ 2024-07-29 14:05 UTC (permalink / raw)
  To: Benjamin BARATTE
  Cc: u-boot@lists.denx.de, eajames@linux.ibm.com, xypron.glpk@gmx.de,
	sjg@chromium.org, tharvey@gateworks.com, trini@konsulko.com

On Mon, Jul 15, 2024 at 01:33:18PM +0000, Benjamin BARATTE wrote:
> The number of PCR banks return by the tpm2_get_pcr_info() is related to
> TPM supported list of hash algorithm that could be greater than thus
> supported by U-Boot. This is not an issue as long as the PCR active bank
> hash an hash algorithm supported by U-Boot.
> Therefore, checking the number of PCR bank supported by the dTPM and
> thus supported by U-Boot doesn't make sense.
> This test shall be removed or shall reflect the maximum hash algorithm
> defined by the TPM2.0 spec 1.59 which is 8 hash algorithms.
>
> Signed-off-by: Benjamin BARATTE <benjamin.baratte@st.com>
> ---
>
>  lib/tpm-v2.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
> index 59e6cbafaf..64a2f15fee 100644
> --- a/lib/tpm-v2.c
> +++ b/lib/tpm-v2.c
> @@ -413,14 +413,6 @@ int tpm2_get_pcr_info(struct udevice *dev, struct tpml_pcr_selection *pcrs)
>                 return ret;
>
>         pcrs->count = get_unaligned_be32(response);
> -       /*
> -        * We only support 4 algorithms for now so check against that
> -        * instead of TPM2_NUM_PCR_BANKS
> -        */
> -       if (pcrs->count > 4 || pcrs->count < 1) {
> -               printf("%s: too many pcrs: %u\n", __func__, pcrs->count);
> -               return -EMSGSIZE;
> -       }
>
>         ret = tpm2_get_num_pcr(dev, &num_pcr);
>         if (ret)
> --
> 2.34.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

> ST Restricted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-29 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15 13:33 [PATCH 2/3] tpm: remove check on pcr bank count Benjamin BARATTE
2024-07-29 14:05 ` Ilias Apalodimas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox