[PATCH v4 0/6] Improve U-Boot's TPM handling in the non-EFI case
Ludwig Nussel
ludwig.nussel at siemens.com
Mon Jun 29 10:00:59 CEST 2026
With EFI U-Boot always allocates a buffer for the TPM event log. If
a previous bootloader stage started an event log, U-Boot would copy
the entries to that allocated buffer.
Without EFI U-Boot wants to reuse the event log memory from a
previous bootloader stage instead. If U-Boot is first component to
start the event log, e.g. when used in qemu there would be no memory
allocated for the event log.
So allocate memory in tcg2_log_prepare_buffer() if no event log was
found and no buffer was allocated already.
Also copy the address of the event log into the device tree for the
kernel so the event log is accessible from Linux userspace too.
Changes in v4:
- reword commit message
- include Ilias' patches for unifying event logs in the series
Changes in v3:
- fix test failure
- sync description with cover letter
Changes in v2:
- fix return value handling
- imply DEVRES in config TPM
- use fdt_getprop for reading property
- don't wrap #include in #if
- fix memory leak in error case of tcg2_log_prepare_buffer
- handle NULL elog parameter in tcg2_measurement_term
- use CONFIG_TPM2_EVENT_LOG_SIZE
- pass log_size instead of position in dt
Ilias Apalodimas (2):
tpm: unify the tcg2 eventlog structures
tpm: unify the eventlog initialization
Ludwig Nussel (4):
test: include mapmem.h explicitly
tpm: print all PCRs from pcr_read
tpm: allocate tpm event log if missing
Fix tcg2_measurement_init call
boot/bootm.c | 18 ++---
boot/image-fdt.c | 69 +++++++++++++++++
cmd/tpm-v2.c | 69 ++++++++++++-----
include/tpm-common.h | 2 +
include/tpm_tcg2.h | 44 +++++------
lib/Kconfig | 1 +
lib/efi_loader/efi_tcg2.c | 97 +++++-------------------
lib/tpm_tcg2.c | 151 ++++++++++++++++++++++++++++++-------
test/boot/measurement.c | 1 +
test/py/tests/test_tpm2.py | 9 +--
10 files changed, 296 insertions(+), 165 deletions(-)
--
2.43.0
base-commit: 3cdce049f90d77c3f9221f1eb73922384c8972c3
branch: us-tpm4
More information about the U-Boot
mailing list