Attention is currently required from: Xi Chen, Hung-Te Lin, Christian Walter, Julius Werner.
Sergii Dmytruk has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69444 )
Change subject: treewide: stop calling custom TPM log "TCPA" ......................................................................
treewide: stop calling custom TPM log "TCPA"
TCPA usually refers to log described by TPM 1.2 specification.
Change-Id: I896bd94f18b34d6c4b280f58b011d704df3d4022 Ticket: https://ticket.coreboot.org/issues/423 Signed-off-by: Sergii Dmytruk sergii.dmytruk@3mdeb.com --- M src/arch/x86/car.ld M src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h M src/commonlib/include/commonlib/coreboot_tables.h D src/commonlib/include/commonlib/tcpa_log_serialized.h A src/commonlib/include/commonlib/tpm_log_serialized.h M src/include/memlayout.h M src/include/symbols.h M src/lib/cbfs.c M src/lib/coreboot_table.c M src/security/tpm/tspi.h M src/security/tpm/tspi/crtm.c M src/security/tpm/tspi/crtm.h M src/security/tpm/tspi/log.c M src/security/tpm/tspi/tspi.c M src/soc/cavium/cn81xx/memlayout.ld M src/soc/mediatek/mt8173/memlayout.ld M src/soc/mediatek/mt8183/memlayout.ld M src/soc/mediatek/mt8186/include/soc/memlayout.ld M src/soc/mediatek/mt8188/include/soc/memlayout.ld M src/soc/mediatek/mt8192/include/soc/memlayout.ld M src/soc/mediatek/mt8195/include/soc/memlayout.ld M src/soc/nvidia/tegra124/memlayout.ld M src/soc/nvidia/tegra210/memlayout.ld M src/soc/qualcomm/sc7180/memlayout.ld M src/soc/samsung/exynos5250/memlayout.ld M util/cbmem/cbmem.c 26 files changed, 169 insertions(+), 154 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/69444/1
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld index 47afd78..c8388ee 100644 --- a/src/arch/x86/car.ld +++ b/src/arch/x86/car.ld @@ -20,9 +20,9 @@ VBOOT2_WORK(., 12K) #endif #if CONFIG(TPM_MEASURED_BOOT) - /* Vboot measured boot TCPA log measurements. + /* Vboot measured boot TPM log measurements. * Needs to be transferred until CBMEM is available */ - TPM_TCPA_LOG(., 2K) + TPM_LOG(., 2K) #endif /* Stack for CAR stages. Since it persists across all stages that * use CAR it can be reused. The chipset/SoC is expected to provide diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h b/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h index 1e63c66..78c5471 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h +++ b/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h @@ -59,7 +59,7 @@ #define CBMEM_ID_STAGEx_CACHE 0x57a9e100 #define CBMEM_ID_STAGEx_RAW 0x57a9e200 #define CBMEM_ID_STORAGE_DATA 0x53746f72 -#define CBMEM_ID_TCPA_LOG 0x54435041 +#define CBMEM_ID_TPM_CB_LOG 0x54435041 #define CBMEM_ID_TCPA_TCG_LOG 0x54445041 #define CBMEM_ID_TIMESTAMP 0x54494d45 #define CBMEM_ID_TPM2_TCG_LOG 0x54504d32 @@ -137,7 +137,7 @@ { CBMEM_ID_SMBIOS, "SMBIOS " }, \ { CBMEM_ID_SMM_SAVE_SPACE, "SMM BACKUP " }, \ { CBMEM_ID_STORAGE_DATA, "SD/MMC/eMMC" }, \ - { CBMEM_ID_TCPA_LOG, "TCPA LOG " }, \ + { CBMEM_ID_TPM_CB_LOG, "TPM CB LOG " }, \ { CBMEM_ID_TCPA_TCG_LOG, "TCPA TCGLOG" }, \ { CBMEM_ID_TIMESTAMP, "TIME STAMP " }, \ { CBMEM_ID_TPM2_TCG_LOG, "TPM2 TCGLOG" }, \ diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index 6b5eb59..a112e38 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -77,7 +77,7 @@ LB_TAG_MAC_ADDRS = 0x0033, LB_TAG_VBOOT_WORKBUF = 0x0034, LB_TAG_MMC_INFO = 0x0035, - LB_TAG_TCPA_LOG = 0x0036, + LB_TAG_TPM_CB_LOG = 0x0036, LB_TAG_FMAP = 0x0037, LB_TAG_PLATFORM_BLOB_VERSION = 0x0038, LB_TAG_SMMSTOREV2 = 0x0039, diff --git a/src/commonlib/include/commonlib/tcpa_log_serialized.h b/src/commonlib/include/commonlib/tcpa_log_serialized.h deleted file mode 100644 index 4190a7d..0000000 --- a/src/commonlib/include/commonlib/tcpa_log_serialized.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef __TCPA_LOG_SERIALIZED_H__ -#define __TCPA_LOG_SERIALIZED_H__ - -#include <stdint.h> - -#define MAX_TCPA_LOG_ENTRIES 50 -#define TCPA_DIGEST_MAX_LENGTH 64 -#define TCPA_PCR_HASH_NAME 50 -#define TCPA_PCR_HASH_LEN 10 -/* Assumption of 2K TCPA log size reserved for CAR/SRAM */ -#define MAX_PRERAM_TCPA_LOG_ENTRIES 15 - -struct tcpa_entry { - uint32_t pcr; - char digest_type[TCPA_PCR_HASH_LEN]; - uint8_t digest[TCPA_DIGEST_MAX_LENGTH]; - uint32_t digest_length; - char name[TCPA_PCR_HASH_NAME]; -} __packed; - -struct tcpa_table { - uint16_t max_entries; - uint16_t num_entries; - struct tcpa_entry entries[0]; /* Variable number of entries */ -} __packed; - -#endif diff --git a/src/commonlib/include/commonlib/tpm_log_serialized.h b/src/commonlib/include/commonlib/tpm_log_serialized.h new file mode 100644 index 0000000..dc58dc0 --- /dev/null +++ b/src/commonlib/include/commonlib/tpm_log_serialized.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef COMMONLIB_TPM_LOG_SERIALIZED_H +#define COMMONLIB_TPM_LOG_SERIALIZED_H + +#include <commonlib/bsd/helpers.h> +#include <stdint.h> + +#define MAX_TPM_LOG_ENTRIES 50 +#define TPM_CB_LOG_DIGEST_MAX_LENGTH 64 +#define TPM_CB_LOG_PCR_HASH_NAME 50 +#define TPM_CB_LOG_PCR_HASH_LEN 10 +/* Assumption of 2K TCPA log size reserved for CAR/SRAM */ +#define MAX_PRERAM_TPM_LOG_ENTRIES 15 + +struct tpm_cb_log_entry { + uint32_t pcr; + char digest_type[TPM_CB_LOG_PCR_HASH_LEN]; + uint8_t digest[TPM_CB_LOG_DIGEST_MAX_LENGTH]; + uint32_t digest_length; + char name[TPM_CB_LOG_PCR_HASH_NAME]; +} __packed; + +struct tpm_cb_log_table { + uint16_t max_entries; + uint16_t num_entries; + struct tpm_cb_log_entry entries[0]; /* Variable number of entries */ +} __packed; + +#endif diff --git a/src/include/memlayout.h b/src/include/memlayout.h index 1e9fca8..dee5eaf 100644 --- a/src/include/memlayout.h +++ b/src/include/memlayout.h @@ -168,9 +168,9 @@ STR(vboot2 work buffer size must be equivalent to \ VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE! (sz)));
-#define TPM_TCPA_LOG(addr, size) \ - REGION(tpm_tcpa_log, addr, size, 16) \ - _ = ASSERT(size >= 2K, "tpm tcpa log buffer must be at least 2K!"); +#define TPM_LOG(addr, size) \ + REGION(tpm_log, addr, size, 16) \ + _ = ASSERT(size >= 2K, "tpm log buffer must be at least 2K!");
#if ENV_SEPARATE_VERSTAGE #define VERSTAGE(addr, sz) \ diff --git a/src/include/symbols.h b/src/include/symbols.h index ee7c503..a03af08 100644 --- a/src/include/symbols.h +++ b/src/include/symbols.h @@ -37,7 +37,7 @@ DECLARE_OPTIONAL_REGION(cbfs_cache) DECLARE_REGION(cbfs_mcache) DECLARE_REGION(fmap_cache) -DECLARE_REGION(tpm_tcpa_log) +DECLARE_REGION(tpm_log)
#if ENV_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE) DECLARE_REGION(bss) diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index d2829d1..35adc8a 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -190,7 +190,7 @@
if (!hash || tspi_cbfs_measurement(mdata->h.filename, be32toh(mdata->h.type), hash)) - ERROR("failed to measure '%s' into TCPA log\n", mdata->h.filename); + ERROR("failed to measure '%s' into TPM log\n", mdata->h.filename); /* We intentionally continue to boot on measurement errors. */ }
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 0f20735..6fe5585 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -265,7 +265,7 @@ {CBMEM_ID_ACPI_CNVS, LB_TAG_ACPI_CNVS}, {CBMEM_ID_VPD, LB_TAG_VPD}, {CBMEM_ID_WIFI_CALIBRATION, LB_TAG_WIFI_CALIBRATION}, - {CBMEM_ID_TCPA_LOG, LB_TAG_TCPA_LOG}, + {CBMEM_ID_TPM_CB_LOG, LB_TAG_TPM_CB_LOG}, {CBMEM_ID_FMAP, LB_TAG_FMAP}, {CBMEM_ID_VBOOT_WORKBUF, LB_TAG_VBOOT_WORKBUF}, {CBMEM_ID_TYPE_C_INFO, LB_TAG_TYPE_C_INFO}, diff --git a/src/security/tpm/tspi.h b/src/security/tpm/tspi.h index 2a2a66d..865c3f4 100644 --- a/src/security/tpm/tspi.h +++ b/src/security/tpm/tspi.h @@ -7,40 +7,40 @@ #include <commonlib/region.h> #include <vb2_api.h>
-#include <commonlib/tcpa_log_serialized.h> +#include <commonlib/tpm_log_serialized.h>
#define TPM_PCR_MAX_LEN 64 #define HASH_DATA_CHUNK_SIZE 1024
/** * Get the pointer to the single instance of global - * tcpa log data, and initialize it when necessary + * TPM log data, and initialize it when necessary */ -struct tcpa_table *tcpa_log_init(void); +struct tpm_cb_log_table *tpm_log_init(void);
/** - * Clears the pre-RAM tcpa log data and initializes + * Clears the pre-RAM TPM log data and initializes * any content with default values */ -void tcpa_preram_log_clear(void); +void tpm_preram_log_clear(void);
/** - * Add table entry for cbmem TCPA log. + * Add table entry for cbmem TPM log. * @param name Name of the hashed data * @param pcr PCR used to extend hashed data * @param diget_algo sets the digest algorithm * @param digest sets the hash extended into the tpm * @param digest_len the length of the digest */ -void tcpa_log_add_table_entry(const char *name, const uint32_t pcr, - enum vb2_hash_algorithm digest_algo, - const uint8_t *digest, - const size_t digest_len); +void tpm_log_add_table_entry(const char *name, const uint32_t pcr, + enum vb2_hash_algorithm digest_algo, + const uint8_t *digest, + const size_t digest_len);
/** - * Dump TCPA log entries on console + * Dump TPM log entries on console */ -void tcpa_log_dump(void *unused); +void tpm_log_dump(void *unused);
/** * Ask vboot for a digest and extend a TPM PCR with it. diff --git a/src/security/tpm/tspi/crtm.c b/src/security/tpm/tspi/crtm.c index 8eefc11..6e4fada 100644 --- a/src/security/tpm/tspi/crtm.c +++ b/src/security/tpm/tspi/crtm.c @@ -6,11 +6,11 @@ #include "crtm.h" #include <string.h>
-static int tcpa_log_initialized; -static inline int tcpa_log_available(void) +static int tpm_log_initialized; +static inline int tpm_log_available(void) { if (ENV_BOOTBLOCK) - return tcpa_log_initialized; + return tpm_log_initialized;
return 1; } @@ -33,10 +33,10 @@ */ static uint32_t tspi_init_crtm(void) { - /* Initialize TCPA PRERAM log. */ - if (!tcpa_log_available()) { - tcpa_preram_log_clear(); - tcpa_log_initialized = 1; + /* Initialize TPM PRERAM log. */ + if (!tpm_log_available()) { + tpm_preram_log_clear(); + tpm_log_initialized = 1; } else { printk(BIOS_WARNING, "TSPI: CRTM already initialized!\n"); return VB2_SUCCESS; @@ -109,9 +109,9 @@ uint32_t tspi_cbfs_measurement(const char *name, uint32_t type, const struct vb2_hash *hash) { uint32_t pcr_index; - char tcpa_metadata[TCPA_PCR_HASH_NAME]; + char tpm_log_metadata[TPM_CB_LOG_PCR_HASH_NAME];
- if (!tcpa_log_available()) { + if (!tpm_log_available()) { if (tspi_init_crtm() != VB2_SUCCESS) { printk(BIOS_WARNING, "Initializing CRTM failed!\n"); @@ -142,29 +142,29 @@ break; }
- snprintf(tcpa_metadata, TCPA_PCR_HASH_NAME, "CBFS: %s", name); + snprintf(tpm_log_metadata, TPM_CB_LOG_PCR_HASH_NAME, "CBFS: %s", name);
return tpm_extend_pcr(pcr_index, hash->algo, hash->raw, vb2_digest_size(hash->algo), - tcpa_metadata); + tpm_log_metadata); }
int tspi_measure_cache_to_pcr(void) { int i; - struct tcpa_table *tclt = tcpa_log_init(); + struct tpm_cb_log_table *tclt = tpm_log_init();
/* This means the table is empty. */ - if (!tcpa_log_available()) + if (!tpm_log_available()) return VB2_SUCCESS;
if (!tclt) { - printk(BIOS_WARNING, "TCPA: Log non-existent!\n"); + printk(BIOS_WARNING, "TPM LOG: log non-existent!\n"); return VB2_ERROR_UNKNOWN; }
- printk(BIOS_DEBUG, "TPM: Write digests cached in TCPA log to PCR\n"); + printk(BIOS_DEBUG, "TPM: Write digests cached in TPM log to PCR\n"); for (i = 0; i < tclt->num_entries; i++) { - struct tcpa_entry *tce = &tclt->entries[i]; + struct tpm_cb_log_entry *tce = &tclt->entries[i]; if (tce) { printk(BIOS_DEBUG, "TPM: Write digest for" " %s into PCR %d\n", diff --git a/src/security/tpm/tspi/crtm.h b/src/security/tpm/tspi/crtm.h index afb205c..1d722c4 100644 --- a/src/security/tpm/tspi/crtm.h +++ b/src/security/tpm/tspi/crtm.h @@ -31,7 +31,7 @@ #endif
/** - * Measure digests cached in TCPA log entries into PCRs + * Measure digests cached in TPM log entries into PCRs */ int tspi_measure_cache_to_pcr(void);
diff --git a/src/security/tpm/tspi/log.c b/src/security/tpm/tspi/log.c index 296cb2d..fa95b80 100644 --- a/src/security/tpm/tspi/log.c +++ b/src/security/tpm/tspi/log.c @@ -9,20 +9,20 @@ #include <bootstate.h> #include <vb2_sha.h>
-static struct tcpa_table *tcpa_cbmem_init(void) +static struct tpm_cb_log_table *tpm_log_cbmem_init(void) { - static struct tcpa_table *tclt; + static struct tpm_cb_log_table *tclt; if (tclt) return tclt;
if (cbmem_possibly_online()) { - tclt = cbmem_find(CBMEM_ID_TCPA_LOG); + tclt = cbmem_find(CBMEM_ID_TPM_CB_LOG); if (!tclt) { - size_t tcpa_log_len = sizeof(struct tcpa_table) + - MAX_TCPA_LOG_ENTRIES * sizeof(struct tcpa_entry); - tclt = cbmem_add(CBMEM_ID_TCPA_LOG, tcpa_log_len); + size_t tpm_log_len = sizeof(struct tpm_cb_log_table) + + MAX_TPM_LOG_ENTRIES * sizeof(struct tpm_cb_log_entry); + tclt = cbmem_add(CBMEM_ID_TPM_CB_LOG, tpm_log_len); if (tclt) { - tclt->max_entries = MAX_TCPA_LOG_ENTRIES; + tclt->max_entries = MAX_TPM_LOG_ENTRIES; tclt->num_entries = 0; } } @@ -30,39 +30,39 @@ return tclt; }
-struct tcpa_table *tcpa_log_init(void) +struct tpm_cb_log_table *tpm_log_init(void) { - static struct tcpa_table *tclt; + static struct tpm_cb_log_table *tclt;
/* We are dealing here with pre CBMEM environment. * If cbmem isn't available use CAR or SRAM */ if (!cbmem_possibly_online() && !CONFIG(VBOOT_RETURN_FROM_VERSTAGE)) - return (struct tcpa_table *)_tpm_tcpa_log; + return (struct tpm_cb_log_table *)_tpm_log; else if (ENV_CREATES_CBMEM && !CONFIG(VBOOT_RETURN_FROM_VERSTAGE)) { - tclt = tcpa_cbmem_init(); + tclt = tpm_log_cbmem_init(); if (!tclt) - return (struct tcpa_table *)_tpm_tcpa_log; + return (struct tpm_cb_log_table *)_tpm_log; } else { - tclt = tcpa_cbmem_init(); + tclt = tpm_log_cbmem_init(); }
return tclt; }
-void tcpa_log_dump(void *unused) +void tpm_log_dump(void *unused) { int i, j; - struct tcpa_table *tclt; + struct tpm_cb_log_table *tclt;
- tclt = tcpa_log_init(); + tclt = tpm_log_init(); if (!tclt) return;
- printk(BIOS_INFO, "coreboot TCPA measurements:\n\n"); + printk(BIOS_INFO, "coreboot TPM log measurements:\n\n"); for (i = 0; i < tclt->num_entries; i++) { - struct tcpa_entry *tce = &tclt->entries[i]; + struct tpm_cb_log_entry *tce = &tclt->entries[i]; if (tce) { printk(BIOS_INFO, " PCR-%u ", tce->pcr);
@@ -76,85 +76,87 @@ printk(BIOS_INFO, "\n"); }
-void tcpa_log_add_table_entry(const char *name, const uint32_t pcr, - enum vb2_hash_algorithm digest_algo, - const uint8_t *digest, - const size_t digest_len) +void tpm_log_add_table_entry(const char *name, const uint32_t pcr, + enum vb2_hash_algorithm digest_algo, + const uint8_t *digest, + const size_t digest_len) { - struct tcpa_table *tclt = tcpa_log_init(); + struct tpm_cb_log_table *tclt = tpm_log_init(); if (!tclt) { - printk(BIOS_WARNING, "TCPA: Log non-existent!\n"); + printk(BIOS_WARNING, "TPM LOG: Log non-existent!\n"); return; }
if (tclt->num_entries >= tclt->max_entries) { - printk(BIOS_WARNING, "TCPA: TCPA log table is full\n"); + printk(BIOS_WARNING, "TPM LOG: log table is full\n"); return; }
if (!name) { - printk(BIOS_WARNING, "TCPA: TCPA entry name not set\n"); + printk(BIOS_WARNING, "TPM LOG: entry name not set\n"); return; }
- struct tcpa_entry *tce = &tclt->entries[tclt->num_entries++]; - strncpy(tce->name, name, TCPA_PCR_HASH_NAME - 1); + struct tpm_cb_log_entry *tce = &tclt->entries[tclt->num_entries++]; + strncpy(tce->name, name, TPM_CB_LOG_PCR_HASH_NAME - 1); tce->pcr = pcr;
- if (digest_len > TCPA_DIGEST_MAX_LENGTH) { - printk(BIOS_WARNING, "TCPA: PCR digest too long for TCPA log entry\n"); + if (digest_len > TPM_CB_LOG_DIGEST_MAX_LENGTH) { + printk(BIOS_WARNING, "TPM LOG: PCR digest too long for log entry\n"); return; }
strncpy(tce->digest_type, - vb2_get_hash_algorithm_name(digest_algo), - TCPA_PCR_HASH_LEN - 1); + vb2_get_hash_algorithm_name(digest_algo), + TPM_CB_LOG_PCR_HASH_LEN - 1); tce->digest_length = digest_len; memcpy(tce->digest, digest, tce->digest_length); }
-void tcpa_preram_log_clear(void) +void tpm_preram_log_clear(void) { - printk(BIOS_INFO, "TCPA: Clearing coreboot TCPA log\n"); - struct tcpa_table *tclt = (struct tcpa_table *)_tpm_tcpa_log; - tclt->max_entries = MAX_TCPA_LOG_ENTRIES; + printk(BIOS_INFO, "TPM LOG: clearing preram log\n"); + struct tpm_cb_log_table *tclt = (struct tpm_cb_log_table *)_tpm_log; + tclt->max_entries = MAX_TPM_LOG_ENTRIES; tclt->num_entries = 0; }
#if !CONFIG(VBOOT_RETURN_FROM_VERSTAGE) -static void recover_tcpa_log(int is_recovery) +static void recover_tpm_log(int is_recovery) { - struct tcpa_table *preram_log = (struct tcpa_table *)_tpm_tcpa_log; - struct tcpa_table *ram_log = NULL; + struct tpm_cb_log_table *preram_log = (struct tpm_cb_log_table *)_tpm_log; + struct tpm_cb_log_table *ram_log = NULL; int i;
- if (preram_log->num_entries > MAX_PRERAM_TCPA_LOG_ENTRIES) { - printk(BIOS_WARNING, "TCPA: Pre-RAM TCPA log is too full, possible corruption\n"); + if (preram_log->num_entries > MAX_PRERAM_TPM_LOG_ENTRIES) { + printk(BIOS_WARNING, "TPM LOG: pre-RAM log is too full, possible corruption\n"); return; }
- ram_log = tcpa_cbmem_init(); + ram_log = tpm_log_cbmem_init(); if (!ram_log) { - printk(BIOS_WARNING, "TCPA: CBMEM not available something went wrong\n"); + printk(BIOS_WARNING, "TPM LOG: CBMEM not available something went wrong\n"); return; }
for (i = 0; i < preram_log->num_entries; i++) { - struct tcpa_entry *tce = &ram_log->entries[ram_log->num_entries++]; - strncpy(tce->name, preram_log->entries[i].name, TCPA_PCR_HASH_NAME - 1); + struct tpm_cb_log_entry *tce = &ram_log->entries[ram_log->num_entries++]; + strncpy(tce->name, preram_log->entries[i].name, TPM_CB_LOG_PCR_HASH_NAME - 1); tce->pcr = preram_log->entries[i].pcr;
- if (preram_log->entries[i].digest_length > TCPA_DIGEST_MAX_LENGTH) { - printk(BIOS_WARNING, "TCPA: PCR digest too long for TCPA log entry\n"); + if (preram_log->entries[i].digest_length > TPM_CB_LOG_DIGEST_MAX_LENGTH) { + printk(BIOS_WARNING, "TPM LOG: PCR digest too long for log entry\n"); return; }
- strncpy(tce->digest_type, preram_log->entries[i].digest_type, TCPA_PCR_HASH_LEN - 1); - tce->digest_length = MIN(preram_log->entries[i].digest_length, TCPA_DIGEST_MAX_LENGTH); + strncpy(tce->digest_type, preram_log->entries[i].digest_type, + TPM_CB_LOG_PCR_HASH_LEN - 1); + tce->digest_length = MIN(preram_log->entries[i].digest_length, + TPM_CB_LOG_DIGEST_MAX_LENGTH); memcpy(tce->digest, preram_log->entries[i].digest, tce->digest_length); } } -CBMEM_CREATION_HOOK(recover_tcpa_log); +CBMEM_CREATION_HOOK(recover_tpm_log); #endif
-BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, tcpa_log_dump, NULL); +BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, tpm_log_dump, NULL); diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c index 54ba343..3be98a2 100644 --- a/src/security/tpm/tspi/tspi.c +++ b/src/security/tpm/tspi/tspi.c @@ -242,8 +242,7 @@ }
if (CONFIG(TPM_MEASURED_BOOT)) - tcpa_log_add_table_entry(name, pcr, digest_algo, - digest, digest_len); + tpm_log_add_table_entry(name, pcr, digest_algo, digest, digest_len);
printk(BIOS_DEBUG, "TPM: Digest of `%s` to PCR %d %s\n", name, pcr, tspi_tpm_is_setup() ? "measured" : "logged"); diff --git a/src/soc/cavium/cn81xx/memlayout.ld b/src/soc/cavium/cn81xx/memlayout.ld index 0257b23..41f0914 100644 --- a/src/soc/cavium/cn81xx/memlayout.ld +++ b/src/soc/cavium/cn81xx/memlayout.ld @@ -23,7 +23,7 @@ BOOTBLOCK(BOOTROM_OFFSET + 0x20000, 56K) CBFS_MCACHE(BOOTROM_OFFSET + 0x2e000, 8K) VBOOT2_WORK(BOOTROM_OFFSET + 0x30000, 12K) - TPM_TCPA_LOG(BOOTROM_OFFSET + 0x33000, 2K) + TPM_LOG(BOOTROM_OFFSET + 0x33000, 2K) VERSTAGE(BOOTROM_OFFSET + 0x33800, 50K) ROMSTAGE(BOOTROM_OFFSET + 0x40000, 256K)
diff --git a/src/soc/mediatek/mt8173/memlayout.ld b/src/soc/mediatek/mt8173/memlayout.ld index 092cfdf..8dce428 100644 --- a/src/soc/mediatek/mt8173/memlayout.ld +++ b/src/soc/mediatek/mt8173/memlayout.ld @@ -26,7 +26,7 @@
SRAM_START(0x00100000) VBOOT2_WORK(0x00100000, 12K) - TPM_TCPA_LOG(0x00103000, 2K) + TPM_LOG(0x00103000, 2K) FMAP_CACHE(0x00103800, 2K) PRERAM_CBMEM_CONSOLE(0x00104000, 12K) WATCHDOG_TOMBSTONE(0x00107000, 4) diff --git a/src/soc/mediatek/mt8183/memlayout.ld b/src/soc/mediatek/mt8183/memlayout.ld index 0acd174..3908426 100644 --- a/src/soc/mediatek/mt8183/memlayout.ld +++ b/src/soc/mediatek/mt8183/memlayout.ld @@ -23,7 +23,7 @@ { SRAM_START(0x00100000) VBOOT2_WORK(0x00100000, 12K) - TPM_TCPA_LOG(0x00103000, 2K) + TPM_LOG(0x00103000, 2K) FMAP_CACHE(0x00103800, 2K) WATCHDOG_TOMBSTONE(0x00104000, 4) PRERAM_CBMEM_CONSOLE(0x00104004, 63K - 4) diff --git a/src/soc/mediatek/mt8186/include/soc/memlayout.ld b/src/soc/mediatek/mt8186/include/soc/memlayout.ld index 1764632..f8bb0fa 100644 --- a/src/soc/mediatek/mt8186/include/soc/memlayout.ld +++ b/src/soc/mediatek/mt8186/include/soc/memlayout.ld @@ -31,7 +31,7 @@ /* EMPTY(0x0010a804, 1K - 4) */ /* Regions that can also be moved to SRAM_L2C. */ TIMESTAMP(0x0010ac00, 1K) - TPM_TCPA_LOG(0x0010b000, 2K) + TPM_LOG(0x0010b000, 2K) FMAP_CACHE(0x0010b800, 2K) CBFS_MCACHE(0x0010c000, 16K) SRAM_END(0x00110000) diff --git a/src/soc/mediatek/mt8188/include/soc/memlayout.ld b/src/soc/mediatek/mt8188/include/soc/memlayout.ld index dc4090d..8d1f2bd 100644 --- a/src/soc/mediatek/mt8188/include/soc/memlayout.ld +++ b/src/soc/mediatek/mt8188/include/soc/memlayout.ld @@ -34,7 +34,7 @@ CBFS_MCACHE(0x00120000, 16k) VBOOT2_WORK(0x00124000, 12K) FMAP_CACHE(0x00127000, 2k) - TPM_TCPA_LOG(0x00127800, 2k) + TPM_LOG(0x00127800, 2k) TIMESTAMP(0x00128000, 1k) /* End of regions that can also be moved to SRAM_L2C. */ /* EMPTY(0x00128400, 31K) */ diff --git a/src/soc/mediatek/mt8192/include/soc/memlayout.ld b/src/soc/mediatek/mt8192/include/soc/memlayout.ld index 150bfdd..6c238c7 100644 --- a/src/soc/mediatek/mt8192/include/soc/memlayout.ld +++ b/src/soc/mediatek/mt8192/include/soc/memlayout.ld @@ -23,7 +23,7 @@ { SRAM_START(0x00100000) VBOOT2_WORK(0x00100000, 12K) - TPM_TCPA_LOG(0x00103000, 2K) + TPM_LOG(0x00103000, 2K) FMAP_CACHE(0x00103800, 2K) WATCHDOG_TOMBSTONE(0x00104000, 4) CBFS_MCACHE(0x00107c00, 8K) diff --git a/src/soc/mediatek/mt8195/include/soc/memlayout.ld b/src/soc/mediatek/mt8195/include/soc/memlayout.ld index e8b51d2..8b84637 100644 --- a/src/soc/mediatek/mt8195/include/soc/memlayout.ld +++ b/src/soc/mediatek/mt8195/include/soc/memlayout.ld @@ -26,7 +26,7 @@ { SRAM_START(0x00100000) VBOOT2_WORK(0x00100000, 12K) - TPM_TCPA_LOG(0x00103000, 2K) + TPM_LOG(0x00103000, 2K) FMAP_CACHE(0x00103800, 2K) WATCHDOG_TOMBSTONE(0x00104000, 4) EARLY_INIT(0x00104010, 128) diff --git a/src/soc/nvidia/tegra124/memlayout.ld b/src/soc/nvidia/tegra124/memlayout.ld index 68c70c1..ed386f1 100644 --- a/src/soc/nvidia/tegra124/memlayout.ld +++ b/src/soc/nvidia/tegra124/memlayout.ld @@ -19,7 +19,7 @@ CBFS_MCACHE(0x40006000, 8K) PRERAM_CBFS_CACHE(0x40008000, 6K) VBOOT2_WORK(0x40009800, 12K) - TPM_TCPA_LOG(0x4000D800, 2K) + TPM_LOG(0x4000D800, 2K) STACK(0x4000E000, 8K) BOOTBLOCK(0x40010000, 32K) VERSTAGE(0x40018000, 70K) diff --git a/src/soc/nvidia/tegra210/memlayout.ld b/src/soc/nvidia/tegra210/memlayout.ld index d9d7070..55da129 100644 --- a/src/soc/nvidia/tegra210/memlayout.ld +++ b/src/soc/nvidia/tegra210/memlayout.ld @@ -19,7 +19,7 @@ PRERAM_CBFS_CACHE(0x40001000, 20K) CBFS_MCACHE(0x40006000, 8K) VBOOT2_WORK(0x40008000, 12K) - TPM_TCPA_LOG(0x4000B000, 2K) + TPM_LOG(0x4000B000, 2K) #if ENV_ARM64 STACK(0x4000B800, 3K) #else /* AVP gets a separate stack to avoid any chance of handoff races. */ diff --git a/src/soc/qualcomm/sc7180/memlayout.ld b/src/soc/qualcomm/sc7180/memlayout.ld index 938f3e1..e956c64 100644 --- a/src/soc/qualcomm/sc7180/memlayout.ld +++ b/src/soc/qualcomm/sc7180/memlayout.ld @@ -32,7 +32,7 @@ REGION(pbl_timestamps, 0x14800000, 83K, 4K) WATCHDOG_TOMBSTONE(0x14814FFC, 4) BOOTBLOCK(0x14815000, 48K) - TPM_TCPA_LOG(0x14821000, 2K) + TPM_LOG(0x14821000, 2K) PRERAM_CBFS_CACHE(0x14821800, 60K) PRERAM_CBMEM_CONSOLE(0x14830800, 32K) TIMESTAMP(0x14838800, 1K) diff --git a/src/soc/samsung/exynos5250/memlayout.ld b/src/soc/samsung/exynos5250/memlayout.ld index eec9f60..142a892 100644 --- a/src/soc/samsung/exynos5250/memlayout.ld +++ b/src/soc/samsung/exynos5250/memlayout.ld @@ -21,7 +21,7 @@ PRERAM_CBFS_CACHE(0x205C000, 68K) CBFS_MCACHE(0x206D000, 8K) FMAP_CACHE(0x206F000, 2K) - TPM_TCPA_LOG(0x206F800, 2K) + TPM_LOG(0x206F800, 2K) VBOOT2_WORK(0x2070000, 12K) STACK(0x2074000, 16K) SRAM_END(0x2078000) diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index b1c2f89..c0b39ea 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -21,7 +21,7 @@ #include <commonlib/bsd/cbmem_id.h> #include <commonlib/loglevel.h> #include <commonlib/timestamp_serialized.h> -#include <commonlib/tcpa_log_serialized.h> +#include <commonlib/tpm_log_serialized.h> #include <commonlib/coreboot_tables.h>
#ifdef __OpenBSD__ @@ -267,7 +267,7 @@
static struct lb_cbmem_ref timestamps; static struct lb_cbmem_ref console; -static struct lb_cbmem_ref tcpa_log; +static struct lb_cbmem_ref tpm_cb_log; static struct lb_memory_range cbmem;
/* This is a work-around for a nasty problem introduced by initially having @@ -336,9 +336,9 @@ console = parse_cbmem_ref((struct lb_cbmem_ref *)lbr_p); continue; } - case LB_TAG_TCPA_LOG: { - debug(" Found tcpa log table.\n"); - tcpa_log = + case LB_TAG_TPM_CB_LOG: { + debug(" Found TPM CB log table.\n"); + tpm_cb_log = parse_cbmem_ref((struct lb_cbmem_ref *)lbr_p); continue; } @@ -843,35 +843,35 @@ unmap_memory(×tamp_mapping); }
-/* dump the tcpa log table */ -static void dump_tcpa_log(void) +/* dump the TPM CB log table */ +static void dump_tpm_cb_log(void) { - const struct tcpa_table *tclt_p; + const struct tpm_cb_log_table *tclt_p; size_t size; - struct mapping tcpa_mapping; + struct mapping log_mapping;
- if (tcpa_log.tag != LB_TAG_TCPA_LOG) { - fprintf(stderr, "No tcpa log found in coreboot table.\n"); + if (tpm_cb_log.tag != LB_TAG_TPM_CB_LOG) { + fprintf(stderr, "No TPM log found in coreboot table.\n"); return; }
size = sizeof(*tclt_p); - tclt_p = map_memory(&tcpa_mapping, tcpa_log.cbmem_addr, size); + tclt_p = map_memory(&log_mapping, tpm_cb_log.cbmem_addr, size); if (!tclt_p) - die("Unable to map tcpa log header\n"); + die("Unable to map TPM log header\n");
size += tclt_p->num_entries * sizeof(tclt_p->entries[0]);
- unmap_memory(&tcpa_mapping); + unmap_memory(&log_mapping);
- tclt_p = map_memory(&tcpa_mapping, tcpa_log.cbmem_addr, size); + tclt_p = map_memory(&log_mapping, tpm_cb_log.cbmem_addr, size); if (!tclt_p) - die("Unable to map full tcpa log table\n"); + die("Unable to map full TPM log table\n");
- printf("coreboot TCPA log:\n\n"); + printf("coreboot TPM log:\n\n");
for (uint16_t i = 0; i < tclt_p->num_entries; i++) { - const struct tcpa_entry *tce = &tclt_p->entries[i]; + const struct tpm_cb_log_entry *tce = &tclt_p->entries[i];
printf(" PCR-%u ", tce->pcr);
@@ -881,7 +881,7 @@ printf(" %s [%s]\n", tce->digest_type, tce->name); }
- unmap_memory(&tcpa_mapping); + unmap_memory(&log_mapping); }
struct cbmem_console { @@ -1339,7 +1339,7 @@ " -T | --parseable-timestamps: print parseable timestamps\n" " -S | --stacked-timestamps: print stacked timestamps (e.g. for flame graph tools)\n" " -a | --add-timestamp ID: append timestamp with ID\n" - " -L | --tcpa-log print TCPA log\n" + " -L | --tcpa-log print TPM log\n" " -V | --verbose: verbose (debugging) output\n" " -v | --version: print the version\n" " -h | --help: print this help\n" @@ -1677,7 +1677,7 @@ dump_timestamps(timestamp_type);
if (print_tcpa_log) - dump_tcpa_log(); + dump_tpm_cb_log();
unmap_memory(&lbtable_mapping);