1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <errno.h>
5 #include "string-util-fundamental.h"
6 
7 #ifndef UINT64_C
8 #  define UINT64_C(c) (c ## ULL)
9 #endif
10 
11 #define EFI_LOADER_FEATURE_CONFIG_TIMEOUT          (UINT64_C(1) << 0)
12 #define EFI_LOADER_FEATURE_CONFIG_TIMEOUT_ONE_SHOT (UINT64_C(1) << 1)
13 #define EFI_LOADER_FEATURE_ENTRY_DEFAULT           (UINT64_C(1) << 2)
14 #define EFI_LOADER_FEATURE_ENTRY_ONESHOT           (UINT64_C(1) << 3)
15 #define EFI_LOADER_FEATURE_BOOT_COUNTING           (UINT64_C(1) << 4)
16 #define EFI_LOADER_FEATURE_XBOOTLDR                (UINT64_C(1) << 5)
17 #define EFI_LOADER_FEATURE_RANDOM_SEED             (UINT64_C(1) << 6)
18 #define EFI_LOADER_FEATURE_LOAD_DRIVER             (UINT64_C(1) << 7)
19 
20 typedef enum SecureBootMode {
21         SECURE_BOOT_UNSUPPORTED,
22         SECURE_BOOT_DISABLED,
23         SECURE_BOOT_UNKNOWN,
24         SECURE_BOOT_AUDIT,
25         SECURE_BOOT_DEPLOYED,
26         SECURE_BOOT_SETUP,
27         SECURE_BOOT_USER,
28         _SECURE_BOOT_MAX,
29         _SECURE_BOOT_INVALID = -EINVAL,
30 } SecureBootMode;
31 
32 const sd_char *secure_boot_mode_to_string(SecureBootMode m);
33 SecureBootMode decode_secure_boot_mode(
34                 sd_bool secure,
35                 sd_bool audit,
36                 sd_bool deployed,
37                 sd_bool setup);
38