diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-10-25 10:00:27 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-11-14 16:42:19 -0800 |
commit | f182401b974b85bc4bc641d8ec43719a99777b1b (patch) | |
tree | fa861263146816c1bc8ae8812a20e57373d27650 /tests/vboot_kernel_tests.c | |
parent | dfcacc87bec544ab7b4ed8645f65876b471a1cd3 (diff) | |
download | vboot-stabilize-8992.B.tar.gz |
vboot: Split partition and vblock verification from LoadKernel()stabilize-8992.B
LoadKernel() was a big function which did everything from looping over
partitions on a drive to loading the data within them to calling the
low-level verification functions on that data. Split it apart into more
manageable chunks. This also reduces indentation of the inner parts of
the code, whic increases readability.
No outwardly-visible functionality changes.
BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge
Change-Id: Iea79e70163f5d9f1a9d0d897e4a9bacc925a742d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404919
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'tests/vboot_kernel_tests.c')
-rw-r--r-- | tests/vboot_kernel_tests.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c index 21ee895b..3c26ee2e 100644 --- a/tests/vboot_kernel_tests.c +++ b/tests/vboot_kernel_tests.c @@ -138,22 +138,22 @@ static void ResetMocks(void) gbb->minor_version = GBB_MINOR_VER; gbb->flags = 0; + memset(&shared_data, 0, sizeof(shared_data)); + VbSharedDataInit(shared, sizeof(shared_data)); + shared->kernel_version_tpm = 0x20001; + memset(&cparams, '\0', sizeof(cparams)); cparams.gbb = gbb; cparams.gbb_data = gbb; cparams.gbb_size = sizeof(gbb_data); + cparams.shared_data_blob = shared; memset(&vnc, 0, sizeof(vnc)); VbNvSetup(&vnc); VbNvTeardown(&vnc); /* So CRC gets generated */ - memset(&shared_data, 0, sizeof(shared_data)); - VbSharedDataInit(shared, sizeof(shared_data)); - shared->kernel_version_tpm = 0x20001; - memset(&lkp, 0, sizeof(lkp)); lkp.nv_context = &vnc; - lkp.shared_data_blob = shared; lkp.gbb_data = gbb; lkp.gbb_size = sizeof(gbb_data); lkp.bytes_per_lba = 512; @@ -580,11 +580,6 @@ static void InvalidParamsTest(void) "Bad lba count"); ResetMocks(); - lkp.bytes_per_lba = 128*1024; - TEST_EQ(LoadKernel(&lkp, &cparams), VBERROR_INVALID_PARAMETER, - "Huge lba size"); - - ResetMocks(); gpt_init_fail = 1; TEST_EQ(LoadKernel(&lkp, &cparams), VBERROR_NO_KERNEL_FOUND, "Bad GPT"); |