Debian Codegraph @

3rdparty/vboot/firmware/2lib/include/2constants.h

raw symbols SCIP
1 /* Copyright 2019 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 * General vboot-related constants.
6 *
7 * Constants that need to be exposed to assembly files or linker scripts
8 * may be placed here and imported via vb2_constants.h.
9 */
10
11 #ifndef VBOOT_REFERENCE_2CONSTANTS_H_
12 #define VBOOT_REFERENCE_2CONSTANTS_H_
13
14 /*
15 * Size of non-volatile data used by vboot.
16 *
17 * If you only support non-volatile data format V1, then use VB2_NVDATA_SIZE.
18 * If you support V2, use VB2_NVDATA_SIZE_V2 and set context flag
19 * VB2_CONTEXT_NVDATA_V2.
20 */
21 #define VB2_NVDATA_SIZE 16
22 #define VB2_NVDATA_SIZE_V2 64
23
24 /* Size of secure data spaces used by vboot */
25 #define VB2_SECDATA_FIRMWARE_SIZE 10
26 #define VB2_SECDATA_KERNEL_SIZE_V02 13
27 #define VB2_SECDATA_KERNEL_SIZE_V10 40
28 #define VB2_SECDATA_KERNEL_MIN_SIZE 13
29 #define VB2_SECDATA_KERNEL_MAX_SIZE 64
30 #define VB2_SECDATA_FWMP_MIN_SIZE 40
31 #define VB2_SECDATA_FWMP_MAX_SIZE 64
32
33 /* Size of current secdata_kernel revision. Referenced by external projects. */
34 #define VB2_SECDATA_KERNEL_SIZE VB2_SECDATA_KERNEL_SIZE_V10
35
36 /*
37 * Recommended size of work buffer for firmware verification stage.
38 *
39 * TODO: The recommended size really depends on which key algorithms are
40 * used. Should have a better / more accurate recommendation than this.
41 */
42 #ifdef VB2_X86_RSA_ACCELERATION
43 #define VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE (20 * 1024)
44 #else
45 #define VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE (12 * 1024)
46 #endif
47
48 /*
49 * Recommended size of work buffer for kernel verification stage.
50 *
51 * This is bigger because vboot 2.0 kernel preambles are usually padded to
52 * 64 KB.
53 *
54 * TODO: The recommended size really depends on which key algorithms are
55 * used. Should have a better / more accurate recommendation than this.
56 */
57 #define VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE (80 * 1024)
58
59 /* Recommended buffer size for vb2api_get_pcr_digest. */
60 #define VB2_PCR_DIGEST_RECOMMENDED_SIZE 32
61
62 /*
63 * Alignment for work buffer pointers/allocations should be useful for any
64 * data type. When declaring workbuf buffers on the stack, the caller should
65 * use explicit alignment to avoid run-time errors. For example:
66 *
67 * int foo(void)
68 * {
69 * struct vb2_workbuf wb;
70 * uint8_t buf[NUM] __attribute__((aligned(VB2_WORKBUF_ALIGN)));
71 * wb.buf = buf;
72 * wb.size = sizeof(buf);
73 */
74
75 /* We want consistent alignment across all architectures.
76 8-byte should work for all of them. */
77 #define VB2_WORKBUF_ALIGN 8
78
79 /* Maximum length of a HWID in bytes, counting terminating null. */
80 #define VB2_GBB_HWID_MAX_SIZE 256
81
82 /* Type and offset of flags member in vb2_gbb_header struct. */
83 #define VB2_GBB_FLAGS_OFFSET 12
84 #ifndef __ASSEMBLER__
85 #include <stdint.h>
86 typedef uint32_t vb2_gbb_flags_t;
87 /*
88 * We use disk handles rather than indices. Using indices causes problems if
89 * a disk is removed/inserted in the middle of processing.
90 *
91 * TODO(b/181739551): move this to 2api.h when the VbExDisk* functions are
92 * removed from vboot_api.h.
93 */
94 typedef void *vb2ex_disk_handle_t;
95 #endif
96
97 /* Size of legacy VbSharedDataHeader struct. Defined here to avoid including
98 the struct definition as part of a vb2_api.h include. */
99 #define VB2_VBSD_SIZE 1096
100
101 #endif /* VBOOT_REFERENCE_2CONSTANTS_H_ */