summaryrefslogtreecommitdiff
path: root/tests/vb2_common2_tests.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-10-31 15:18:48 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-05 06:05:01 +0000
commit6b5b8f65d52bc91ca37e5cb484867251d81136b1 (patch)
treea5611c53ec710ed4ea89d825d625b3dec12ff5c0 /tests/vb2_common2_tests.c
parentf97d3879d021159a8d5e050f4533da81f92b267d (diff)
downloadvboot-6b5b8f65d52bc91ca37e5cb484867251d81136b1.tar.gz
vboot2: use common header size fields
Add functions for verifying object integrity using common header size fields. Convert vb2_packed_key2 to use the the new functions. This isn't much prettier for packed keys; the benefit is more obvious for keyblocks (coming next). BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I0c09533368abb7ced3b5ac622a15e62832413b7f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226874 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'tests/vb2_common2_tests.c')
-rw-r--r--tests/vb2_common2_tests.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/vb2_common2_tests.c b/tests/vb2_common2_tests.c
index c2d11d99..050695ee 100644
--- a/tests/vb2_common2_tests.c
+++ b/tests/vb2_common2_tests.c
@@ -99,14 +99,14 @@ static void test_unpack_key2(const VbPublicKey *orig_key)
key2 = vb2_convert_packed_key2(key1, "Test key", &size);
key2->key_offset += 4;
TEST_EQ(vb2_unpack_key2(&pubk, (uint8_t *)key2, size),
- VB2_ERROR_INSIDE_DATA_OUTSIDE,
+ VB2_ERROR_COMMON_MEMBER_SIZE,
"vb2_unpack_key2() buffer too small");
free(key2);
key2 = vb2_convert_packed_key2(key1, "Test key", &size);
key2->c.fixed_size += size;
TEST_EQ(vb2_unpack_key2(&pubk, (uint8_t *)key2, size),
- VB2_ERROR_INSIDE_DATA_OUTSIDE,
+ VB2_ERROR_COMMON_FIXED_SIZE,
"vb2_unpack_key2() buffer too small for desc");
free(key2);
@@ -161,7 +161,7 @@ static void test_unpack_key2(const VbPublicKey *orig_key)
free(key2);
key2 = vb2_convert_packed_key2(key1, "Test key", &size);
- key2->key_size--;
+ key2->key_size -= 4;
TEST_EQ(vb2_unpack_key2(&pubk, (uint8_t *)key2, size),
VB2_ERROR_UNPACK_KEY_SIZE,
"vb2_unpack_key2() invalid size");
@@ -170,7 +170,7 @@ static void test_unpack_key2(const VbPublicKey *orig_key)
key2 = vb2_convert_packed_key2(key1, "Test key", &size);
key2->key_offset--;
TEST_EQ(vb2_unpack_key2(&pubk, (uint8_t *)key2, size),
- VB2_ERROR_UNPACK_KEY_ALIGN,
+ VB2_ERROR_COMMON_MEMBER_UNALIGNED,
"vb2_unpack_key2() unaligned data");
free(key2);