]> git.ipfire.org Git - thirdparty/systemd.git/commit
tpm2-util: fix PCR bank guessing without EFI
authorPatrick Wicki <patrick.wicki@subset.ch>
Fri, 20 Mar 2026 14:56:56 +0000 (15:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 25 Mar 2026 22:18:58 +0000 (23:18 +0100)
commit6c7e5b81ac4dd79952b3d0428a038dd5febb2bc3
treef49de2f4122f0e4832e21612a2df0337fa0e175a
parent91af485544b7f1ec7436f4b73b4a9bdcc6607f72
tpm2-util: fix PCR bank guessing without EFI

Since 7643e4a89 efi_get_active_pcr_banks() is used to determine the
active PCR banks. Without EFI support, this returns -EOPNOTSUPP. This in
turns leads to cryptenroll and cryptsetup attach failures unless the PCR
bank is explicitly set, i.e.

$ systemd-cryptenroll $LUKS_PART --tpm2-device=auto --tpm2-pcrs='7'
[...]
Could not read pcr values: Operation not supported

But it works fine with --tpm2-pcrs='7:sha256'.

Similarly, unsealing during cryptsetup attach also fails if the bank
needs to be determined:

Failed to unseal secret using TPM2: Operation not supported

Catch the -EOPNOTSUPP and fallback to the guessing strategy.

Signed-off-by: Patrick Wicki <patrick.wicki@subset.ch>
src/shared/tpm2-util.c