]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/boot-entry.h
cryptenroll: allow to use a public key on a token
[thirdparty/systemd.git] / src / shared / boot-entry.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <stdbool.h>
5
6 #include "sd-id128.h"
7
8 typedef enum BootEntryTokenType {
9 BOOT_ENTRY_TOKEN_MACHINE_ID,
10 BOOT_ENTRY_TOKEN_OS_IMAGE_ID,
11 BOOT_ENTRY_TOKEN_OS_ID,
12 BOOT_ENTRY_TOKEN_LITERAL,
13 BOOT_ENTRY_TOKEN_AUTO,
14 } BootEntryTokenType;
15
16 bool boot_entry_token_valid(const char *p);
17
18 int boot_entry_token_ensure(
19 const char *root,
20 const char *conf_root, /* will be prefixed with root, typically /etc/kernel. */
21 sd_id128_t machine_id,
22 bool machine_id_is_random,
23 BootEntryTokenType *type, /* input and output */
24 char **token); /* output, but do not pass uninitialized value. */
25 int boot_entry_token_ensure_at(
26 int rfd,
27 const char *conf_root,
28 sd_id128_t machine_id,
29 bool machine_id_is_random,
30 BootEntryTokenType *type,
31 char **token);
32
33 int parse_boot_entry_token_type(const char *s, BootEntryTokenType *type, char **token);
34
35 const char* boot_entry_token_type_to_string(BootEntryTokenType t);