From 2497f6a84c0b906551d08054a631b86942cb4fa9 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Fri, 26 Jan 2024 09:53:42 +0900 Subject: efi_loader: migrate SMBIOS 3.0 entry point structure for measurement Current U-Boot only supports the SMBIOS 3.0 entry point structure. TCG2 measurement code should migrate to SMBIOS 3.0 entry point structure. efi_selftest tcg2 test also needs to be updated, and expected PCR[1] result is changed since guid for SMBIOS EFI system table uses different guid SMBIOS3_TABLE_GUID instead of SMBIOS_TABLE_GUID. Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/smbios-parser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/smbios-parser.c') diff --git a/lib/smbios-parser.c b/lib/smbios-parser.c index ac9a367a87..f48d743657 100644 --- a/lib/smbios-parser.c +++ b/lib/smbios-parser.c @@ -223,21 +223,24 @@ static void clear_smbios_table(struct smbios_header *header, } } -void smbios_prepare_measurement(const struct smbios_entry *entry, +void smbios_prepare_measurement(const struct smbios3_entry *entry, struct smbios_header *smbios_copy) { u32 i, j; + void *table_end; struct smbios_header *header; + table_end = (void *)((u8 *)smbios_copy + entry->max_struct_size); + for (i = 0; i < ARRAY_SIZE(smbios_filter_tables); i++) { header = smbios_copy; - for (j = 0; j < entry->struct_count; j++) { + for (j = 0; (void *)header < table_end; j++) { if (header->type == smbios_filter_tables[i].type) break; header = get_next_header(header); } - if (j >= entry->struct_count) + if ((void *)header >= table_end) continue; clear_smbios_table(header, -- cgit v1.2.3