From d873fa8a8e8b1e5061c85fa406916af301257b67 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Mon, 14 Jun 2021 09:18:45 +0200 Subject: [PATCH] security/tpm/tspi/crtm.c: Fix early init If the early crtm is not initialised there is nothing to write to PCR in the early tpm init. Change-Id: I9fa05f04588321163afc817de29c03bd426fc1f0 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/55470 Tested-by: build bot (Jenkins) Reviewed-by: Johnny Lin Reviewed-by: Angel Pons Reviewed-by: Christian Walter Reviewed-by: Julius Werner --- src/security/tpm/tspi/crtm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/security/tpm/tspi/crtm.c b/src/security/tpm/tspi/crtm.c index 1559838430..b64bbbf6c6 100644 --- a/src/security/tpm/tspi/crtm.c +++ b/src/security/tpm/tspi/crtm.c @@ -178,6 +178,10 @@ int tspi_measure_cache_to_pcr(void) enum vb2_hash_algorithm hash_alg; struct tcpa_table *tclt = tcpa_log_init(); + /* This means the table is empty. */ + if (!tcpa_log_available()) + return VB2_SUCCESS; + if (!tclt) { printk(BIOS_WARNING, "TCPA: Log non-existent!\n"); return VB2_ERROR_UNKNOWN;