Add hwid digest field to GBB header

This adds a field in the GBB header to store the sha256 digest of
the HWID string, and updates gbb_utility so that it stores the
digest when it modifies the HWID. Because this is a new field,
the GBB_MINOR_VER is incremented.

BUG=chromium:415227
BRANCH=ToT
TEST=make runtests, VBOOT2=1 make runtests

Since the GBB is in the RO firmware, there should be no side
effects for existing devices (but even without that, they should
handle a minor version change without complaint).

Change-Id: Icdb2a0b564677b0b65e58df897d2ec5af3964998
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221360
This commit is contained in:
Bill Richardson
2014-10-02 18:50:33 -07:00
committed by chrome-internal-fetch
parent 8bb3689d42
commit 6df3e33912
12 changed files with 132 additions and 14 deletions

View File

@@ -315,7 +315,8 @@ struct vb2_shared_data {
/* VB2 GBB struct version */
#define VB2_GBB_MAJOR_VER 1
#define VB2_GBB_MINOR_VER 1
#define VB2_GBB_MINOR_VER 2
/* v1.2 - added fields for sha256 digest of the HWID */
/* Flags for vb2_gbb_header.flags */
enum vb2_gbb_flag {
@@ -388,7 +389,13 @@ struct vb2_gbb_header {
uint32_t recovery_key_offset; /* Recovery key */
uint32_t recovery_key_size;
uint8_t pad[80]; /* To match GBB_HEADER_SIZE. Initialize to 0. */
/* Added in version 1.2 */
uint8_t hwid_digest[32]; /* sha256 */
uint8_t pad[48]; /* To match EXPECTED_GBB_HEADER_SIZE. Init to 0. */
} __attribute__((packed));
/* The GBB is used outside of vboot_reference, so this size is important. */
#define EXPECTED_GBB_HEADER_SIZE 128
#endif /* VBOOT_REFERENCE_VBOOT_2STRUCT_H_ */