aboutsummaryrefslogtreecommitdiff
path: root/src/security/tpm/tspi/crtm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/security/tpm/tspi/crtm.h')
-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