to systemd's UEFI-mode measurements, and if the latter are not done the former
aren't made either.
-systemd will measure to PCRs 11 (`kernel-boot`), 12 (`kernel-config`), 13
-(`sysexts`), 15 (`system-identity`).
+systemd will measure to PCRs 5 (`boot-loader-config`), 11 (`kernel-boot`),
+12 (`kernel-config`), 13 (`sysexts`), 15 (`system-identity`).
Currently, four components will issue TPM2 PCR measurements:
## PCR Measurements Made by `systemd-boot` (UEFI)
+### PCS 5, `EV_EVENT_TAG`, "loader.conf"
+
+The content of `systemd-boot`'s configuration file, `loader/loader.conf`, is
+measured as a tagged event.
+
+→ **Event Tag** `0xf5bc582a`
+
+→ **Description** in the event log record is the file name, `loader.conf`.
+
+→ **Measured hash** covers the content of `loader.conf` as it is read from the ESP.
+
### PCR 12, `EV_IPL`, "Kernel Command Line"
If the kernel command line was specified explicitly (by the user or in a Boot
#include "secure-boot.h"
#include "shim.h"
#include "ticks.h"
+#include "tpm2-pcr.h"
#include "util.h"
#include "version.h"
#include "vmm.h"
DECLARE_SBAT(SBAT_BOOT_SECTION_TEXT);
+#define LOADER_CONF_CONTENT_EVENT_TAG_ID UINT32_C(0xf5bc582a)
+
typedef enum LoaderType {
LOADER_UNDEFINED,
LOADER_AUTO,
static void config_load_defaults(Config *config, EFI_FILE *root_dir) {
_cleanup_free_ char *content = NULL;
- size_t value = 0; /* avoid false maybe-uninitialized warning */
+ size_t content_size, value = 0; /* avoid false maybe-uninitialized warning */
EFI_STATUS err;
assert(root_dir);
.timeout_sec_efivar = TIMEOUT_UNSET,
};
- err = file_read(root_dir, u"\\loader\\loader.conf", 0, 0, &content, NULL);
- if (err == EFI_SUCCESS)
+ err = file_read(root_dir, u"\\loader\\loader.conf", 0, 0, &content, &content_size);
+ if (err == EFI_SUCCESS) {
config_defaults_load_from_file(config, content);
+ err = tpm_log_tagged_event(
+ TPM2_PCR_BOOT_LOADER_CONFIG,
+ POINTER_TO_PHYSICAL_ADDRESS(content),
+ content_size,
+ LOADER_CONF_CONTENT_EVENT_TAG_ID,
+ u"loader.conf",
+ /* ret_measured= */ NULL);
+ if (err != EFI_SUCCESS)
+ log_error_status(err, "Error measuring loader.conf into TPM: %m");
+ }
err = efivar_get_timeout(u"LoaderConfigTimeout", &config->timeout_sec_efivar);
if (err == EFI_SUCCESS)