diff options
author | Joel Kitching <kitching@google.com> | 2019-05-23 15:33:54 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-07 22:40:03 +0000 |
commit | 3eb00efa4eb30e02d1b3197dafc5975fdcbe5914 (patch) | |
tree | a60cece3b500976279a32bb7e71d4ba993d4400e /tests/vboot_kernel_tests.c | |
parent | 96d5a58cbe65d762c64dc0e8f5ecc7af397015a4 (diff) | |
download | vboot-3eb00efa4eb30e02d1b3197dafc5975fdcbe5914.tar.gz |
vboot: rewrite GBB functions and API
Old vboot1-style GBB accessor functions were awkwardly located
within region-init.c.
Rewrite GBB accessor functions for vboot2, and formally expose
HWID retrieval function via vboot2 API. workbuf is used for
key retrieval functions, while a buffer provided by the caller
is used for HWID retrieval function.
Reintroduce vboot_display_tests to `make runtests` test suite.
Move GBB tests from vboot_display_tests to vb2_gbb_tests.
Properly propagate vb2_workbuf objects within the function call
stack (vb2_load_partition).
BUG=b:124141368, chromium:954774
TEST=Build and flash to eve, check that Chrome OS boots
TEST=Build with CL:1627469 applied, check HWID
TEST=make clean && make runtests
BRANCH=none
Change-Id: I398d1329f0b092de35aac73d98dfd9aee6e4e7de
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1584488
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Commit-Queue: Jason Clinton <jclinton@chromium.org>
Diffstat (limited to 'tests/vboot_kernel_tests.c')
-rw-r--r-- | tests/vboot_kernel_tests.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c index 1711ceed..1c7440cf 100644 --- a/tests/vboot_kernel_tests.c +++ b/tests/vboot_kernel_tests.c @@ -75,6 +75,7 @@ static GptHeader *mock_gpt_secondary = static uint8_t mock_digest[VB2_SHA256_DIGEST_SIZE] = {12, 34, 56, 78}; static uint8_t workbuf[VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE]; static struct vb2_context ctx; +static struct vb2_packed_key mock_key; /** * Prepare a valid GPT header that will pass CheckHeader() tests @@ -178,6 +179,8 @@ static void ResetMocks(void) ctx.workbuf_size = sizeof(workbuf); vb2_nv_init(&ctx); + memset(&mock_key, 0, sizeof(mock_key)); + struct vb2_shared_data *sd = vb2_get_sd(&ctx); sd->vbsd = shared; @@ -200,6 +203,24 @@ int vb2ex_read_resource(struct vb2_context *c, return VB2_SUCCESS; } +int vb2_gbb_read_root_key(struct vb2_context *c, + struct vb2_packed_key **keyp, + uint32_t *size, + struct vb2_workbuf *wb) +{ + *keyp = &mock_key; + return VB2_SUCCESS; +} + +int vb2_gbb_read_recovery_key(struct vb2_context *c, + struct vb2_packed_key **keyp, + uint32_t *size, + struct vb2_workbuf *wb) +{ + *keyp = &mock_key; + return VB2_SUCCESS; +} + VbError_t VbExDiskRead(VbExDiskHandle_t h, uint64_t lba_start, uint64_t lba_count, void *buffer) { |