]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
efi_loader: Correctly count the size on DTB measurements
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Fri, 3 Jul 2026 12:40:28 +0000 (15:40 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 15 Jul 2026 22:40:42 +0000 (00:40 +0200)
When doing a sha256_update() for the measured DT, the size arguments for
fdt_size_dt_struct() and fdt_size_dt_strings() are inversed.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_tcg2.c

index 1860dc5023872a4038770eac87c6c179031edc5f..1d52a04ca48fccf61ce0f356e3cad953d9075cda 100644 (file)
@@ -1343,8 +1343,8 @@ efi_status_t efi_tcg2_measure_dtb(void *dtb)
        header = dtb;
        sha256_starts(&hash_ctx);
        sha256_update(&hash_ctx, (u8 *)header, sizeof(struct fdt_header));
-       sha256_update(&hash_ctx, (u8 *)dtb + fdt_off_dt_struct(dtb), fdt_size_dt_strings(dtb));
-       sha256_update(&hash_ctx, (u8 *)dtb + fdt_off_dt_strings(dtb), fdt_size_dt_struct(dtb));
+       sha256_update(&hash_ctx, (u8 *)dtb + fdt_off_dt_struct(dtb), fdt_size_dt_struct(dtb));
+       sha256_update(&hash_ctx, (u8 *)dtb + fdt_off_dt_strings(dtb), fdt_size_dt_strings(dtb));
        sha256_update(&hash_ctx, (u8 *)dtb + fdt_off_mem_rsvmap(dtb), rsvmap_size);
        sha256_finish(&hash_ctx, blob->data + blob->blob_description_size);