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 <zaolin.daisuki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/29563 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
@ -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);
|
||||
for (j = 0; j < tce->digest_length; j++)
|
||||
sprintf((char *)&(hash[j * 2]), "%02x", tce->digest[j]);
|
||||
printf(" PCR-%u ", tce->pcr);
|
||||
|
||||
snprintf(log_string, TCPA_LOG_STRING_LENGTH, "%u %s 00 [%s]\n",
|
||||
tce->pcr, hash, tce->name);
|
||||
printf("%s", log_string);
|
||||
for (j = 0; j < tce->digest_length; j++)
|
||||
printf("%02x", tce->digest[j]);
|
||||
|
||||
printf(" %s [%s]\n", tce->digest_type, tce->name);
|
||||
}
|
||||
|
||||
unmap_memory(&tcpa_mapping);
|
||||
|
Reference in New Issue
Block a user