From c9b7d1fb57787d7037a5bce031a1300d13f5df40 Mon Sep 17 00:00:00 2001 From: Philipp Deppenwiese Date: Sat, 10 Nov 2018 00:35:02 +0100 Subject: security/tpm: Fix TCPA log feature Until now the TCPA log wasn't working correctly. * Refactor TCPA log code. * Add TCPA log dump fucntion. * Make TCPA log available in bootblock. * Fix TCPA log formatting. * Add x86 and Cavium memory for early log. Change-Id: Ic93133531b84318f48940d34bded48cbae739c44 Signed-off-by: Philipp Deppenwiese Reviewed-on: https://review.coreboot.org/c/coreboot/+/29563 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- util/cbmem/cbmem.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'util') diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index fc2dcdcc75..ae1d2127fb 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -690,8 +690,6 @@ static void dump_tcpa_log(void) const struct tcpa_table *tclt_p; size_t size; struct mapping tcpa_mapping; - char log_string[TCPA_LOG_STRING_LENGTH]; - char hash[TCPA_FORMAT_HASH_LENGTH]; if (tcpa_log.tag != LB_TAG_TCPA_LOG) { fprintf(stderr, "No tcpa log found in coreboot table.\n"); @@ -716,13 +714,12 @@ static void dump_tcpa_log(void) for (i = 0; i < tclt_p->num_entries; i++) { const struct tcpa_entry *tce = &tclt_p->entries[i]; - memset(log_string, 0, TCPA_LOG_STRING_LENGTH); + printf(" PCR-%u ", tce->pcr); + for (j = 0; j < tce->digest_length; j++) - sprintf((char *)&(hash[j * 2]), "%02x", tce->digest[j]); + printf("%02x", tce->digest[j]); - snprintf(log_string, TCPA_LOG_STRING_LENGTH, "%u %s 00 [%s]\n", - tce->pcr, hash, tce->name); - printf("%s", log_string); + printf(" %s [%s]\n", tce->digest_type, tce->name); } unmap_memory(&tcpa_mapping); -- cgit v1.2.3