summaryrefslogtreecommitdiff
path: root/src/security/tpm/tspi
diff options
context:
space:
mode:
authorSergii Dmytruk <sergii.dmytruk@3mdeb.com>2022-10-23 00:24:37 +0300
committerMartin L Roth <gaumless@gmail.com>2022-11-19 15:11:09 +0000
commit97fe17ff59849e869d9df646e55393626f187e39 (patch)
treef710b13b7737f259b144cc478a47cdef9ee76f45 /src/security/tpm/tspi
parent1d903a24dcb56b141df96314290ad9e23ec1594f (diff)
security/tpm: make log format configurable via Kconfig
This commit doesn't add any new format options, just makes selecting existing format explicit. Ticket: https://ticket.coreboot.org/issues/422 Change-Id: I3903aff54e01093bc9ea75862bbf5989cc6e6c55 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68746 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Diffstat (limited to 'src/security/tpm/tspi')
-rw-r--r--src/security/tpm/tspi/crtm.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/security/tpm/tspi/crtm.h b/src/security/tpm/tspi/crtm.h
index bd5bc5785d..e8e44fd745 100644
--- a/src/security/tpm/tspi/crtm.h
+++ b/src/security/tpm/tspi/crtm.h
@@ -16,7 +16,19 @@
*/
#define TPM_RUNTIME_DATA_PCR 3
-#define TPM_MEASURE_ALGO (CONFIG(TPM1) ? VB2_HASH_SHA1 : VB2_HASH_SHA256)
+#if CONFIG(TPM_LOG_CB) && CONFIG(TPM1)
+# define TPM_MEASURE_ALGO VB2_HASH_SHA1
+#elif CONFIG(TPM_LOG_CB) && CONFIG(TPM2)
+# define TPM_MEASURE_ALGO VB2_HASH_SHA256
+#endif
+
+#if !defined(TPM_MEASURE_ALGO)
+# if !CONFIG(TPM_MEASURED_BOOT)
+# define TPM_MEASURE_ALGO VB2_HASH_INVALID
+# else
+# error "Misconfiguration: failed to determine TPM hashing algorithm"
+# endif
+#endif
/**
* Measure digests cached in TCPA log entries into PCRs