]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tpm: measure DTB in PCR1 instead of PCR0
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Fri, 14 Jun 2024 12:09:50 +0000 (15:09 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 16 Jun 2024 07:45:57 +0000 (09:45 +0200)
The PC client spec [0], doesn't describe measurements for DTBs. It does
describe what do to for ACPI tables though.

There is a description for ACPI in 3.3.4.1 PCR[0] – SRTM, POST BIOS,
and Embedded Drivers and they explicitly mention ACPI in there. There's
no mention of ACPI in 3.3.4.2 PCR[1] – Host Platform Configuration.

However, in Figure 6 --  PCR Mapping of UEFI Components ACPI is shown
in PCR1. The general description also mentions PCR0 is for code and PCR1
is for data such as ACPI and SMBIOS.

So let's switch over the DTB measurements to PCR1 which seems a better
fit.

[0] https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
boot/bootm.c
lib/efi_loader/efi_tcg2.c

index 032f5a4a160540a1e265886c121660fd08b4d0cb..9879e1bba4eba8c10ed4a6bb431c697050975e72 100644 (file)
@@ -964,7 +964,7 @@ int bootm_measure(struct bootm_headers *images)
                        goto unmap_initrd;
 
                if (IS_ENABLED(CONFIG_MEASURE_DEVICETREE)) {
-                       ret = tcg2_measure_data(dev, &elog, 0, images->ft_len,
+                       ret = tcg2_measure_data(dev, &elog, 1, images->ft_len,
                                                (u8 *)images->ft_addr,
                                                EV_TABLE_OF_DEVICES,
                                                strlen("dts") + 1,
index 945aafb847d85ecb13fa04d254d04a1dd0af9a7f..d56bd5657c8a3349ef0accfd961571151a66bbc9 100644 (file)
@@ -1331,7 +1331,7 @@ efi_status_t efi_tcg2_measure_dtb(void *dtb)
        sha256_update(&hash_ctx, (u8 *)dtb + fdt_off_mem_rsvmap(dtb), rsvmap_size);
        sha256_finish(&hash_ctx, blob->data + blob->blob_description_size);
 
-       ret = measure_event(dev, 0, EV_POST_CODE, event_size, (u8 *)blob);
+       ret = measure_event(dev, 1, EV_POST_CODE, event_size, (u8 *)blob);
 
        free(blob);
        return ret;