summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-01-27 07:53:29 -0500
committerTom Rini <[email protected]>2024-01-27 07:53:29 -0500
commitfb5fe1bf84ff489211b333c0165418f0d119d328 (patch)
treefafce57ec527b2586e599584a8e31028507aa23e /lib/efi_loader
parente7f9e5eb584dd0b5d1b1ff82fe607d6da9940cc6 (diff)
parent91cc06bcab76dd4b9d07c221b4962283f0984c8e (diff)
Merge tag 'smbios-2024-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request smbios-2024-04-rc1-2 * Add missing field to SMBIOS type 2 structure definition * Provide smbios command to display smbios table * Enable the command on sandbox and qemu_arm64_defconfig * Provide a python test for the smbios command * Fix copying SMBIOS 2.1 table from QEMU * Correct EFI TCG measurement to assume SMBIOS 3 table
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_tcg2.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 8db35d0b3c8..85562c50a1c 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1075,12 +1075,17 @@ error:
*/
static efi_status_t
tcg2_measure_smbios(struct udevice *dev,
- const struct smbios_entry *entry)
+ const struct smbios3_entry *entry)
{
efi_status_t ret;
struct smbios_header *smbios_copy;
struct smbios_handoff_table_pointers2 *event = NULL;
u32 event_size;
+ const char smbios3_anchor[] = "_SM3_";
+
+ /* We only support SMBIOS 3.0 Entry Point structure */
+ if (memcmp(entry->anchor, smbios3_anchor, sizeof(smbios3_anchor) - 1))
+ return EFI_UNSUPPORTED;
/*
* TCG PC Client PFP Spec says
@@ -1093,7 +1098,7 @@ tcg2_measure_smbios(struct udevice *dev,
*/
event_size = sizeof(struct smbios_handoff_table_pointers2) +
FIELD_SIZEOF(struct efi_configuration_table, guid) +
- entry->struct_table_length;
+ entry->max_struct_size;
event = calloc(1, event_size);
if (!event) {
ret = EFI_OUT_OF_RESOURCES;
@@ -1104,11 +1109,11 @@ tcg2_measure_smbios(struct udevice *dev,
memcpy(event->table_description, SMBIOS_HANDOFF_TABLE_DESC,
sizeof(SMBIOS_HANDOFF_TABLE_DESC));
put_unaligned_le64(1, &event->number_of_tables);
- guidcpy(&event->table_entry[0].guid, &smbios_guid);
+ guidcpy(&event->table_entry[0].guid, &smbios3_guid);
smbios_copy = (struct smbios_header *)((uintptr_t)&event->table_entry[0].table);
memcpy(&event->table_entry[0].table,
(void *)((uintptr_t)entry->struct_table_address),
- entry->struct_table_length);
+ entry->max_struct_size);
smbios_prepare_measurement(entry, smbios_copy);
@@ -1133,7 +1138,7 @@ static void *find_smbios_table(void)
u32 i;
for (i = 0; i < systab.nr_tables; i++) {
- if (!guidcmp(&smbios_guid, &systab.tables[i].guid))
+ if (!guidcmp(&smbios3_guid, &systab.tables[i].guid))
return systab.tables[i].table;
}
@@ -1360,7 +1365,7 @@ efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj *ha
u32 pcr_index;
struct udevice *dev;
u32 event = 0;
- struct smbios_entry *entry;
+ struct smbios3_entry *entry;
if (!is_tcg2_protocol_installed())
return EFI_SUCCESS;
@@ -1382,7 +1387,7 @@ efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj *ha
if (ret != EFI_SUCCESS)
goto out;
- entry = (struct smbios_entry *)find_smbios_table();
+ entry = (struct smbios3_entry *)find_smbios_table();
if (entry) {
ret = tcg2_measure_smbios(dev, entry);
if (ret != EFI_SUCCESS)