summaryrefslogtreecommitdiff
path: root/src/boot/pcrphase.c
Commit message (Collapse)AuthorAgeFilesLines
* chase-symlinks: Rename chase_symlinks() to chase()Daan De Meyer2023-03-241-2/+2
| | | | | | | | | Chasing symlinks is a core function that's used in a lot of places so it deservers a less verbose names so let's rename it to chase() and chaseat(). We also slightly change the pattern used for the chaseat() helpers so we get chase_and_openat() and similar.
* src: Fixup copy-paste error for terminal_urlify_manMorten Linderud2023-03-101-1/+1
| | | | Signed-off-by: Morten Linderud <morten@linderud.pw>
* tpm2: use Tpm2Context* instead of ESYS_CONTEXT*Dan Streetman2023-02-011-2/+2
| | | | | This is needed for later patches that use Tpm2Handle, which requires access to the Tpm2Context.
* tpm2: use ref counter for Tpm2ContextDan Streetman2023-02-011-4/+4
| | | | | | | This will be used by Tpm2Handle instances, which is added in later patches. The refcounting allows the context to be retained until all Tpm2Handles have been cleaned up, and the initial ref is released, before cleaning the context.
* tpm2: rename struct tpm2_context to Tpm2ContextDan Streetman2023-02-011-2/+2
| | | | This aligns with systemd coding guidelines for struct naming
* shared/efi-loader: fix compilation with !ENABLE_EFI, improve messagesZbigniew Jędrzejewski-Szmek2023-01-241-2/+2
| | | | | | | | | | | | When compiled without ENABLE_EFI, efi_stub_measured() was not defined, so compilation would fail. But it's not enough to add a stub that returns -EOPNOTSUPP. We call this function in various places and usually print the error at warning or error level, so we'd print a confusing message. We also can't add a stub that always returns 0, because then we'd print a message like "Kernel stub did not measure", which would be confusing too. Adding special handling for -EOPNOTSUPP in every caller is also unattractive. So instead efi_stub_measured() is reworked to log the warning or error internally, and such logging is removed from the callers, and a stub is added that logs a custom message.
* tpm2: add common helper for checking if we are running on UKI with TPM ↵Lennart Poettering2023-01-171-29/+9
| | | | | | | | | | | | | | | | | | | | | | | | measurements Let's introduce a common implementation of a function that checks whether we are booted on a kernel with systemd-stub that has TPM PCR measurements enabled. Do our own userspace measurements only if we detect that. PCRs are scarce and most likely there are projects which already make use of them in other ways. Hence, instead of blindly stepping into their territory let's conditionalize things so that people have to explicitly buy into our PCR assignments before we start measuring things into them. Specifically bind everything to an UKI that reported measurements. This was previously already implemented in systemd-pcrphase, but with this change we expand this to all tools that process PCR measurement settings. The env var to override the check is renamed to SYSTEMD_FORCE_MEASURE, to make it more generic (since we'll use it at multiple places now). This is not a compat break, since the original env var for that was not included in any stable release yet.
* pcrphase: make tool more generic, reuse for measuring machine id/fs uuidsLennart Poettering2023-01-171-24/+186
| | | | See: #24503
* tpm2-util: optionally do HMAC in tpm2_extend_bytes() in case we process ↵Lennart Poettering2023-01-171-1/+1
| | | | | | | | | | | | | | sensitive data When measuring data into a PCR we are supposed to hash the data on the CPU and then pass the hash value over the wire to the TPM2. That's all good as long as the data we intend to measure is not sensitive. Let's be extra careful though if we want to measure sensitive data, for example the root file system volume key. Instead of just hashing that and passing it over the wire to the TPM2, let's do a HMAC signature instead. It's also a hash operation, but should protect our secret reasonably well and not leak direct information about it to wiretappers.
* tpm2-util: split out code that extends a PCR from pcrphaseLennart Poettering2023-01-171-39/+3
| | | | This way we can reuse it later outside of pcrphase
* tpm2-util: split out code that derives "good" TPM2 banks into an strv from ↵Lennart Poettering2023-01-171-22/+6
| | | | | | pcrphase and generalize it in tpm2-util.c That way we can reuse it later from different places.
* pcrphase: gracefully exit if TPM2 support is incompleteLennart Poettering2022-12-151-0/+13
| | | | | | | | If everything points to the fact that TPM2 should work, but then the driver fails to initialize we should handle this gracefully and not cause failing services all over the place. Fixes: #25700
* pcrphase: add $SYSTEMD_PCRPHASE_STUB_VERIFY env var for overriding stub checkLennart Poettering2022-11-171-11/+24
|
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
|
* pcrphase: fix --help textLennart Poettering2022-10-171-1/+1
| | | | | We don't take a command, we just take a "word" which we'll extend into PCR 11.
* boot: add new pcrphase tool to measure barrier strings into PCR 11Lennart Poettering2022-09-221-0/+262