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>
diff --git a/Makefile b/Makefile
index dbd8925..310eeb0 100644
--- a/Makefile
+++ b/Makefile
@@ -377,6 +377,7 @@
ifneq (${VBOOT2},)
UTILLIB_SRCS += \
host/lib/host_key2.c \
+ host/lib/host_keyblock2.c \
host/lib/host_misc2.c \
host/lib/host_signature2.c \
@@ -639,6 +640,7 @@
tests/vb2_common2_tests \
tests/vb2_common3_tests \
tests/vb2_host_key_tests \
+ tests/vb2_host_keyblock_tests \
tests/vb2_host_misc_tests \
tests/vb2_host_sig_tests \
tests/vb2_misc_tests \
@@ -999,6 +1001,7 @@
${BUILD}/tests/vb2_common2_tests: LDLIBS += ${CRYPTO_LIBS}
${BUILD}/tests/vb2_common3_tests: LDLIBS += ${CRYPTO_LIBS}
${BUILD}/tests/vb2_host_key_tests: LDLIBS += ${CRYPTO_LIBS}
+${BUILD}/tests/vb2_host_keyblock_tests: LDLIBS += ${CRYPTO_LIBS}
${BUILD}/tests/vb2_host_sig_tests: LDLIBS += ${CRYPTO_LIBS}
${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS}
${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS}
@@ -1180,6 +1183,7 @@
${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS}
${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS}
${RUNTEST} ${BUILD_RUN}/tests/vb2_host_key_tests ${TEST_KEYS}
+ ${RUNTEST} ${BUILD_RUN}/tests/vb2_host_keyblock_tests ${TEST_KEYS}
${RUNTEST} ${BUILD_RUN}/tests/vb2_host_misc_tests
${RUNTEST} ${BUILD_RUN}/tests/vb2_host_sig_tests ${TEST_KEYS}
${RUNTEST} ${BUILD_RUN}/tests/vb2_misc_tests