I very much dislike the approach in which we were mixing Linux and UEFI C code
in the same subdirectory. No code was shared between two environments. This
layout was created in e7dd673d1e, with the
justification of "being more consistent with the rest of systemd", but I don't
see how it's supposed to be so.
Originally, when the C code was just a single bootctl.c file, this wasn't so
bad. But over time the userspace code grew quite a bit. With the moves done in
previuos commits, the intermediate subdirectory is now empty except for the
efi/ subdir, and this additional subdirectory level doesn't have a good
justification. The components is called "systemd-boot", not "systemd-efi", and
we can remove one level of indentation.
56 lines
2.1 KiB
C
56 lines
2.1 KiB
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include "efi.h"
|
|
|
|
#if ENABLE_TPM
|
|
|
|
bool tpm_present(void);
|
|
|
|
/* Routines for boot-time TPM PCR measurement as well as submitting an event log entry about it. The latter
|
|
* can be done with two different event log record types. For old stuff we use EV_IPL (which is legacy, and
|
|
* not great to recognize properly during PCR validation). For new stuff we use properly tagged
|
|
* EV_EVENT_TAG record. */
|
|
|
|
/* Old stuff is logged as EV_IPL */
|
|
EFI_STATUS tpm_log_ipl_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t buffer_size, const char16_t *description, bool *ret_measured);
|
|
EFI_STATUS tpm_log_ipl_event_ascii(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t buffer_size, const
|
|
char *description, bool *ret_measured);
|
|
|
|
/* New stuff is logged as EV_EVENT_TAG */
|
|
EFI_STATUS tpm_log_tagged_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t buffer_size, uint32_t event_id, const char16_t *description, bool *ret_measured);
|
|
|
|
EFI_STATUS tpm_log_load_options(const char16_t *cmdline, bool *ret_measured);
|
|
|
|
#else
|
|
|
|
static inline bool tpm_present(void) {
|
|
return false;
|
|
}
|
|
|
|
static inline EFI_STATUS tpm_log_ipl_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t buffer_size, const char16_t *description, bool *ret_measured) {
|
|
if (ret_measured)
|
|
*ret_measured = false;
|
|
return EFI_SUCCESS;
|
|
}
|
|
|
|
static inline EFI_STATUS tpm_log_ipl_event_ascii(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t buffer_size, const char *description, bool *ret_measured) {
|
|
if (ret_measured)
|
|
*ret_measured = false;
|
|
return EFI_SUCCESS;
|
|
}
|
|
|
|
static inline EFI_STATUS tpm_log_tagged_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t buffer_size, uint32_t event_id, const char16_t *description, bool *ret_measured) {
|
|
if (ret_measured)
|
|
*ret_measured = false;
|
|
return EFI_SUCCESS;
|
|
}
|
|
|
|
static inline EFI_STATUS tpm_log_load_options(const char16_t *cmdline, bool *ret_measured) {
|
|
if (ret_measured)
|
|
*ret_measured = false;
|
|
return EFI_SUCCESS;
|
|
}
|
|
|
|
#endif
|