vboot2: Add host lib function to create a vb2-style keyblock

Also add vb2_common_desc() helper function to return the description
for an object starting with a common struct header.

And use the new host lib function to create the keyblock for verifying
the firmware lib.

Add tests for everything new.

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

Change-Id: I1fadb3e249e771a692cc69b23620c6ddd46a48ac
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231721
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2014-11-24 12:55:29 -08:00
committed by chrome-internal-fetch
parent fc73f08765
commit 9328bbff52
11 changed files with 313 additions and 77 deletions

View File

@@ -183,6 +183,16 @@ int vb2_verify_member_inside(const void *parent, size_t parent_size,
ptrdiff_t member_data_offset,
size_t member_data_size);
/**
* Return the description of an object starting with a vb2_struct_common header.
*
* Does not sanity-check the buffer; merely returns the pointer.
*
* @param buf Pointer to common object
* @return A pointer to description or an empty string if none.
*/
const char *vb2_common_desc(const void *buf);
/**
* Verify the common struct header is fully contained in its parent data
*