summaryrefslogtreecommitdiff
path: root/tests/vb2_misc_tests.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-08-28 17:45:05 +0800
committerCommit Bot <commit-bot@chromium.org>2019-09-23 17:54:09 +0000
commit967ba853d88b7803c73f3adb94b8717d001a077b (patch)
tree2ce2dc70ead38a5f687f2c5b822a2d19d38469f2 /tests/vb2_misc_tests.c
parentaaf394335cc4e287a1ffb6332311559b2b29c41f (diff)
downloadvboot-967ba853d88b7803c73f3adb94b8717d001a077b.tar.gz
vboot/secdata: implement vboot2 FWMP support
Implement FWMP support in vboot2. Currently, the data structure is just accessed directly, checking to see whether its `flags` member contains particular flags. We'd like to change this to follow the same scheme as secdata_firmware and secdata_kernel. This CL also updates some functions, comments, and tests related to secdata_firmware and secdata_kernel to ensure consistency between code for the secdata spaces. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: Ia0d67532cc6e077e170ffb25d0bc587b1d53edf3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773088 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'tests/vb2_misc_tests.c')
-rw-r--r--tests/vb2_misc_tests.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/vb2_misc_tests.c b/tests/vb2_misc_tests.c
index 43c97e4e..ee73da4f 100644
--- a/tests/vb2_misc_tests.c
+++ b/tests/vb2_misc_tests.c
@@ -219,13 +219,13 @@ static void gbb_tests(void)
gbbsrc.header_size--;
TEST_EQ(vb2_read_gbb_header(&ctx, &gbbdest),
VB2_ERROR_GBB_HEADER_SIZE, "read gbb header size");
- TEST_EQ(vb2_fw_parse_gbb(&ctx),
- VB2_ERROR_GBB_HEADER_SIZE, "parse gbb failure");
+ TEST_EQ(vb2_fw_init_gbb(&ctx),
+ VB2_ERROR_GBB_HEADER_SIZE, "init gbb failure");
gbbsrc.header_size++;
- /* Parse GBB */
+ /* Init GBB */
int used_before = ctx.workbuf_used;
- TEST_SUCC(vb2_fw_parse_gbb(&ctx), "parse gbb");
+ TEST_SUCC(vb2_fw_init_gbb(&ctx), "init gbb");
/* Manually calculate the location of GBB since we have mocked out the
original definition of vb2_get_gbb. */
struct vb2_gbb_header *current_gbb = vb2_member_of(sd, sd->gbb_offset);
@@ -237,8 +237,19 @@ static void gbb_tests(void)
/* Workbuf failure */
reset_common_data();
ctx.workbuf_used = ctx.workbuf_size - 4;
- TEST_EQ(vb2_fw_parse_gbb(&ctx),
- VB2_ERROR_GBB_WORKBUF, "parse gbb no workbuf");
+ TEST_EQ(vb2_fw_init_gbb(&ctx),
+ VB2_ERROR_GBB_WORKBUF, "init gbb no workbuf");
+
+ /* Check for setting NO_SECDATA_FWMP context flag */
+ reset_common_data();
+ TEST_SUCC(vb2_fw_init_gbb(&ctx), "init gbb");
+ TEST_EQ(ctx.flags & VB2_CONTEXT_NO_SECDATA_FWMP, 0,
+ "without DISABLE_FWMP: NO_SECDATA_FWMP shouldn't be set");
+ reset_common_data();
+ gbbsrc.flags |= VB2_GBB_FLAG_DISABLE_FWMP;
+ TEST_SUCC(vb2_fw_init_gbb(&ctx), "init gbb");
+ TEST_NEQ(ctx.flags & VB2_CONTEXT_NO_SECDATA_FWMP, 0,
+ "with DISABLE_FWMP: NO_SECDATA_FWMP should be set");
}
static void fail_tests(void)