xref: /aosp_15_r20/external/vboot_reference/futility/futility_options.h (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1 /* Copyright 2015 The ChromiumOS Authors
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  *
5  * We centralize option parsing but may split operations into multiple files,
6  * so let's declare the option structures in a single place (here).
7  */
8 
9 #ifndef VBOOT_REFERENCE_FUTILITY_OPTIONS_H_
10 #define VBOOT_REFERENCE_FUTILITY_OPTIONS_H_
11 
12 #include <stdint.h>
13 
14 #include "2rsa.h"
15 #include "file_type.h"
16 
17 struct vb2_private_key;
18 struct vb21_packed_key;
19 
20 struct show_option_s {
21 	struct vb2_public_key *k;
22 	uint8_t *fv;
23 	uint64_t fv_size;
24 	int strict;
25 	int t_flag;
26 	enum futil_file_type type;
27 	struct vb21_packed_key *pkey;
28 	uint32_t sig_size;
29 	bool parseable;
30 };
31 extern struct show_option_s show_option;
32 
33 struct sign_option_s {
34 	struct vb2_private_key *signprivate;
35 	struct vb2_keyblock *keyblock;
36 	struct vb2_packed_key *kernel_subkey;
37 	const char *keysetdir;
38 	uint32_t version;
39 	int version_specified;
40 	uint32_t flags;
41 	int flags_specified;
42 	char *loemdir;
43 	char *loemid;
44 	uint8_t *bootloader_data;
45 	uint64_t bootloader_size;
46 	uint8_t *config_data;
47 	uint32_t config_size;
48 	enum arch_t arch;
49 	int fv_specified;
50 	uint32_t kloadaddr;
51 	uint32_t padding;
52 	int vblockonly;
53 	char *outfile;
54 	int create_new_outfile;
55 	int inout_file_count;
56 	char *pem_signpriv;
57 	int pem_algo_specified;
58 	uint32_t pem_algo;
59 	char *pem_external;
60 	enum futil_file_type type;
61 	enum vb2_hash_algorithm hash_alg;
62 	uint32_t ro_size, rw_size;
63 	uint32_t ro_offset, rw_offset;
64 	uint32_t data_size, sig_size;
65 	struct vb2_private_key *prikey;
66 	const char *ecrw_out;
67 };
68 extern struct sign_option_s sign_option;
69 
70 #define FILE_MODE_SIGN(sign_options)                                           \
71 	(sign_options.create_new_outfile ? FILE_RO : FILE_RW)
72 
73 #endif  /* VBOOT_REFERENCE_FUTILITY_OPTIONS_H_ */
74