summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/2lib/include/2constants.h9
-rw-r--r--firmware/2lib/include/2struct.h13
2 files changed, 16 insertions, 6 deletions
diff --git a/firmware/2lib/include/2constants.h b/firmware/2lib/include/2constants.h
index 76e7f22e..4dadd8b6 100644
--- a/firmware/2lib/include/2constants.h
+++ b/firmware/2lib/include/2constants.h
@@ -65,6 +65,13 @@
#define VB2_WORKBUF_ALIGN __BIGGEST_ALIGNMENT__
/* Maximum length of a HWID in bytes, counting terminating null. */
-#define VB2_GBB_HWID_MAX_SIZE 256
+#define VB2_GBB_HWID_MAX_SIZE 256
+
+/* Type and offset of flags member in vb2_gbb_header struct. */
+#define VB2_GBB_FLAGS_OFFSET 12
+#ifndef __ASSEMBLER__
+#include <stdint.h>
+typedef uint32_t vb2_gbb_flags_t;
+#endif
#endif /* VBOOT_REFERENCE_2CONSTANTS_H_ */
diff --git a/firmware/2lib/include/2struct.h b/firmware/2lib/include/2struct.h
index 2ca30142..52783b6a 100644
--- a/firmware/2lib/include/2struct.h
+++ b/firmware/2lib/include/2struct.h
@@ -15,9 +15,9 @@
#ifndef VBOOT_REFERENCE_VBOOT_2STRUCT_H_
#define VBOOT_REFERENCE_VBOOT_2STRUCT_H_
-#include <stdint.h>
+#include "2constants.h"
#include "2crypto.h"
-#include "2gbb_flags.h"
+#include "2sysincludes.h"
/*
* Key block flags.
@@ -250,7 +250,7 @@ struct vb2_gbb_header {
uint32_t header_size; /* Size of GBB header in bytes */
/* Flags (see enum vb2_gbb_flag in 2gbb_flags.h) */
- uint32_t flags;
+ vb2_gbb_flags_t flags;
/* Offsets (from start of header) and sizes (in bytes) of components */
uint32_t hwid_offset; /* HWID */
@@ -265,13 +265,16 @@ struct vb2_gbb_header {
/* Added in version 1.2 */
uint8_t hwid_digest[VB2_GBB_HWID_DIGEST_SIZE]; /* SHA-256 of HWID */
- /* Pad to match EXPECETED_VB2_GBB_HEADER_SIZE. Initialize to 0. */
+ /* Pad to match EXPECTED_VB2_GBB_HEADER_SIZE. Initialize to 0. */
uint8_t pad[48];
} __attribute__((packed));
-/* The GBB is used outside of vboot_reference, so this size is important. */
#define EXPECTED_VB2_GBB_HEADER_SIZE 128
+/* VB2_GBB_FLAGS_OFFSET exposed in 2constants.h */
+_Static_assert(VB2_GBB_FLAGS_OFFSET == offsetof(struct vb2_gbb_header, flags),
+ "VB2_GBB_FLAGS_OFFSET set incorrectly");
+
/*
* Root key hash for Ryu devices only. Contains the hash of the root key.
* This will be embedded somewhere inside the RO part of the firmware, so that