]> git.ipfire.org Git - thirdparty/systemd.git/commit
tpm2-util: initialize NvPCRs on first extension
authorPaul Meyer <katexochen0@gmail.com>
Mon, 13 Jul 2026 07:47:40 +0000 (09:47 +0200)
committerPaul Meyer <katexochen0@gmail.com>
Wed, 15 Jul 2026 11:25:37 +0000 (13:25 +0200)
commitdcf86d1529f438fc71eea366e25d985c951b6928
tree087836022cda18f15a613dabce9b776c33e7be15
parent5a12005c834eab92d7c76d61c7090aa78b61cdfb
tpm2-util: initialize NvPCRs on first extension

Both callers of tpm2_nvpcr_extend_bytes() duplicate the same dance: on
-ENETDOWN, i.e. when the NvPCR isn't anchored yet because
systemd-tpm2-setup hasn't run, they acquire the anchor secret,
initialize the NvPCR, and extend again. Move this into
tpm2_nvpcr_extend_bytes() itself. The only caller-specific bit, whether
the anchor secret shall be synced to /var, is passed in as a parameter.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
src/cryptsetup/cryptsetup.c
src/pcrextend/pcrextend.c
src/shared/tpm2-util.c
src/shared/tpm2-util.h