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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55470
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Johnny Lin <Johnny_Lin@wiwynn.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/src/security/tpm/tspi/crtm.c b/src/security/tpm/tspi/crtm.c
index 1559838..b64bbbf 100644
--- a/src/security/tpm/tspi/crtm.c
+++ b/src/security/tpm/tspi/crtm.c
@@ -178,6 +178,10 @@
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;