vboot2: Add verification for common vb2 struct header

All new-style structs have a common header.  This adds a verification
function for that common header, and tests for it.

BUG=chromium:423882
BRANCH=none
TEST=VBOOT2=1 make runtests

Change-Id: I668486e77f7200c10b43aa2d17b4dd6639e5538e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225459
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2014-10-23 17:04:03 -07:00
committed by chrome-internal-fetch
parent 7c2beb0838
commit f6cfb974ce
5 changed files with 115 additions and 11 deletions

View File

@@ -277,12 +277,16 @@ struct vb2_struct_common {
uint16_t struct_version_major;
uint16_t struct_version_minor;
/* Offset of null-terminated ASCII description from start of struct */
/*
* Offset of null-terminated ASCII description from start of struct.
* Must be 0 if desc_size=0.
*/
uint32_t desc_offset;
/*
* Size of description in bytes, counting null terminator. May be 0
* if no description is present.
* Size of description in bytes, counting null terminator. Set 0 if no
* description is present. If non-zero, there must be a null
* terminator (0) at offset (desc_offset + desc_size - 1).
*/
uint32_t desc_size;
} __attribute__((packed));