| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#ifdef SD_BOOT |
| 5 |
# define EINVAL 22 |
| 6 |
#else |
| 7 |
# include <errno.h> |
| 8 |
#endif |
| 9 |
#include "string-util.h" |
| 10 |
|
| 11 |
/* Features of the loader, i.e. systemd-boot */ |
| 12 |
#define EFI_LOADER_FEATURE_CONFIG_TIMEOUT (UINT64_C(1) << 0) |
| 13 |
#define EFI_LOADER_FEATURE_CONFIG_TIMEOUT_ONE_SHOT (UINT64_C(1) << 1) |
| 14 |
#define EFI_LOADER_FEATURE_ENTRY_DEFAULT (UINT64_C(1) << 2) |
| 15 |
#define EFI_LOADER_FEATURE_ENTRY_ONESHOT (UINT64_C(1) << 3) |
| 16 |
#define EFI_LOADER_FEATURE_BOOT_COUNTING (UINT64_C(1) << 4) |
| 17 |
#define EFI_LOADER_FEATURE_XBOOTLDR (UINT64_C(1) << 5) |
| 18 |
#define EFI_LOADER_FEATURE_RANDOM_SEED (UINT64_C(1) << 6) |
| 19 |
#define EFI_LOADER_FEATURE_LOAD_DRIVER (UINT64_C(1) << 7) |
| 20 |
#define EFI_LOADER_FEATURE_SORT_KEY (UINT64_C(1) << 8) |
| 21 |
#define EFI_LOADER_FEATURE_SAVED_ENTRY (UINT64_C(1) << 9) |
| 22 |
#define EFI_LOADER_FEATURE_DEVICETREE (UINT64_C(1) << 10) |
| 23 |
#define EFI_LOADER_FEATURE_SECUREBOOT_ENROLL (UINT64_C(1) << 11) |
| 24 |
#define EFI_LOADER_FEATURE_RETAIN_SHIM (UINT64_C(1) << 12) |
| 25 |
#define EFI_LOADER_FEATURE_MENU_DISABLE (UINT64_C(1) << 13) |
| 26 |
#define EFI_LOADER_FEATURE_MULTI_PROFILE_UKI (UINT64_C(1) << 14) |
| 27 |
#define EFI_LOADER_FEATURE_REPORT_URL (UINT64_C(1) << 15) |
| 28 |
#define EFI_LOADER_FEATURE_TYPE1_UKI (UINT64_C(1) << 16) |
| 29 |
#define EFI_LOADER_FEATURE_TYPE1_UKI_URL (UINT64_C(1) << 17) |
| 30 |
#define EFI_LOADER_FEATURE_TPM2_ACTIVE_PCR_BANKS (UINT64_C(1) << 18) |
| 31 |
#define EFI_LOADER_FEATURE_ENTRY_PREFERRED (UINT64_C(1) << 19) |
| 32 |
#define EFI_LOADER_FEATURE_KEYBOARD_LAYOUT (UINT64_C(1) << 20) |
| 33 |
#define EFI_LOADER_FEATURE_SMBIOS_MEASURED (UINT64_C(1) << 21) |
| 34 |
|
| 35 |
/* Features of the stub, i.e. systemd-stub */ |
| 36 |
#define EFI_STUB_FEATURE_REPORT_BOOT_PARTITION (UINT64_C(1) << 0) |
| 37 |
#define EFI_STUB_FEATURE_PICK_UP_CREDENTIALS (UINT64_C(1) << 1) |
| 38 |
#define EFI_STUB_FEATURE_PICK_UP_SYSEXTS (UINT64_C(1) << 2) |
| 39 |
#define EFI_STUB_FEATURE_THREE_PCRS (UINT64_C(1) << 3) |
| 40 |
#define EFI_STUB_FEATURE_RANDOM_SEED (UINT64_C(1) << 4) |
| 41 |
#define EFI_STUB_FEATURE_CMDLINE_ADDONS (UINT64_C(1) << 5) |
| 42 |
#define EFI_STUB_FEATURE_CMDLINE_SMBIOS (UINT64_C(1) << 6) |
| 43 |
#define EFI_STUB_FEATURE_DEVICETREE_ADDONS (UINT64_C(1) << 7) |
| 44 |
#define EFI_STUB_FEATURE_PICK_UP_CONFEXTS (UINT64_C(1) << 8) |
| 45 |
#define EFI_STUB_FEATURE_MULTI_PROFILE_UKI (UINT64_C(1) << 9) |
| 46 |
#define EFI_STUB_FEATURE_REPORT_STUB_PARTITION (UINT64_C(1) << 10) |
| 47 |
#define EFI_STUB_FEATURE_REPORT_URL (UINT64_C(1) << 11) |
| 48 |
#define EFI_STUB_FEATURE_SMBIOS_MEASURED (UINT64_C(1) << 12) |
| 49 |
|
| 50 |
typedef enum SecureBootMode { |
| 51 |
SECURE_BOOT_UNSUPPORTED, |
| 52 |
SECURE_BOOT_DISABLED, |
| 53 |
SECURE_BOOT_UNKNOWN, |
| 54 |
SECURE_BOOT_AUDIT, |
| 55 |
SECURE_BOOT_DEPLOYED, |
| 56 |
SECURE_BOOT_SETUP, |
| 57 |
SECURE_BOOT_USER, |
| 58 |
SECURE_BOOT_TAINTED, |
| 59 |
_SECURE_BOOT_MAX, |
| 60 |
_SECURE_BOOT_INVALID = -EINVAL, |
| 61 |
} SecureBootMode; |
| 62 |
|
| 63 |
const sd_char *secure_boot_mode_to_string(SecureBootMode m); |
| 64 |
SecureBootMode decode_secure_boot_mode(bool secure, bool audit, bool deployed, bool setup, bool moksb); |