From: Raymond Mao Date: Mon, 27 Jan 2025 14:58:50 +0000 (-0800) Subject: tpm: PCR allocate during PCR extend to disable the unsupported algorithms X-Git-Tag: v2025.04-rc2~49^2~4 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7e166dabf129aae1fc57fe637ffc37d022ea45a;p=pandora-u-boot.git tpm: PCR allocate during PCR extend to disable the unsupported algorithms During PCR extend process, if any unsupported algorithms are active, try to use PCR allocate to inactivate them. Signed-off-by: Raymond Mao Acked-by: Ilias Apalodimas Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index aa02a9e9611..9ca7933c094 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -344,7 +344,10 @@ u32 tpm2_pcr_extend(struct udevice *dev, u32 index, u32 algorithm, if (!tpm2_check_active_banks(dev)) { log_err("Cannot extend PCRs if all the TPM enabled algorithms are not supported\n"); - return -EINVAL; + + ret = tpm2_pcr_allocate(dev, 0); + if (ret) + return -EINVAL; } /* * Fill the command structure starting from the first buffer: