]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/boot/efi/stub.c
efi: from the stub measure the ELF kernel + built-in initrd and so on into PCR 11
authorLennart Poettering <lennart@poettering.net>
Mon, 25 Jul 2022 15:44:24 +0000 (17:44 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Aug 2022 08:28:49 +0000 (10:28 +0200)
commit72c97c19c3865f72ec3e40d31d2a57f40880dbe5
treef89db8227c4cbc24afeac506c0a837bddb46e7cf
parent599fe002a135570406504998dbb7a42dabc963da
efi: from the stub measure the ELF kernel + built-in initrd and so on into PCR 11

Here we grab a new – on Linux so far unused (by my Googling skills, that
is) – and measure all static components of the PE kernel image into.
This is useful since for the first time we'll have a PCR that contains
only a PCR of the booted kernel, nothing else. That allows putting
together TPM policies that bind to a specific kernel (+ builtin initrd),
without having to have booted that kernel first. PCRs can be
pre-calculated. Yay!

You might wonder, why we measure just the discovered PE sections we are
about to use, instead of the whole PE image. That's because of the next
step I have in mind: PE images should also be able to carry an
additional section that contains a signature for its own expected,
pre-calculated PCR values. This signature data should then be passed
into the booted kernel and can be used there in TPM policies. Benefit:
TPM policies can now be bound to *signatures* of PCRs, instead of the
raw hash values themselves. This makes update management a *lot* easier,
as policies don't need to be updated whenever a kernel is updated, as
long as the signature is available. Now, if the PCR signature is
embedded in the kernel PE image it cannot be of a PCR hash of the kernel
PE image itself, because that would be a chicken-and-egg problem. Hence,
by only measuring the relavent payload sections (and that means
excluding the future section that will contain the PCR hash signature)
we avoid this problem, naturally.
man/systemd-cryptenroll.xml
man/systemd-stub.xml
src/boot/efi/measure.h
src/boot/efi/stub.c