mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
tpm: Don't create an EventLog if algorithms are misconfigured
We already check the active banks vs what U-Boot was compiled with when trying to extend a PCR and we refuse to do so if the TPM active ones don't match the ones U-Boot supports. Do the same thing for the EventLog creation since extending will fail anyway and print a message so the user can figure out the missing algorithms. Co-developed-by: Raymond Mao <raymond.mao@linaro.org> Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
27891e85f3
commit
8dc886ce31
3 changed files with 56 additions and 1 deletions
23
lib/tpm-v2.c
23
lib/tpm-v2.c
|
@ -926,3 +926,26 @@ bool tpm2_check_active_banks(struct udevice *dev)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void tpm2_print_active_banks(struct udevice *dev)
|
||||
{
|
||||
struct tpml_pcr_selection pcrs;
|
||||
size_t i;
|
||||
int rc;
|
||||
|
||||
rc = tpm2_get_pcr_info(dev, &pcrs);
|
||||
if (rc) {
|
||||
log_err("Can't retrieve active PCRs\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < pcrs.count; i++) {
|
||||
if (tpm2_is_active_bank(&pcrs.selection[i])) {
|
||||
const char *str;
|
||||
|
||||
str = tpm2_algorithm_name(pcrs.selection[i].hash);
|
||||
if (str)
|
||||
log_info("%s\n", str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue