diff options
Diffstat (limited to 'test/rollback_entropy.c')
-rw-r--r-- | test/rollback_entropy.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/test/rollback_entropy.c b/test/rollback_entropy.c index 788fab2572..50a8cb4701 100644 --- a/test/rollback_entropy.c +++ b/test/rollback_entropy.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -12,9 +12,7 @@ static const uint32_t VALID_ROLLBACK_COOKIE = 0x0b112233; static const uint32_t UNINITIALIZED_ROLLBACK_COOKIE = 0xffffffff; -static const uint8_t FAKE_ENTROPY[] = { - 0xff, 0xff, 0xff, 0xff -}; +static const uint8_t FAKE_ENTROPY[] = { 0xff, 0xff, 0xff, 0xff }; /* * Generated by concatenating 32-bytes (256-bits) of zeros with the 4 bytes @@ -26,13 +24,12 @@ static const uint8_t FAKE_ENTROPY[] = { * * 890ed82cf09f22243bdc4252e4d79c8a9810c1391f455dce37a7b732eb0a0e4f */ -#define EXPECTED_SECRET \ - 0x89, 0x0e, 0xd8, 0x2c, 0xf0, 0x9f, 0x22, 0x24, 0x3b, 0xdc, 0x42, \ - 0x52, 0xe4, 0xd7, 0x9c, 0x8a, 0x98, 0x10, 0xc1, 0x39, 0x1f, 0x45, \ - 0x5d, 0xce, 0x37, 0xa7, 0xb7, 0x32, 0xeb, 0x0a, 0x0e, 0x4f -__maybe_unused static const uint8_t _EXPECTED_SECRET[] = { - EXPECTED_SECRET -}; +#define EXPECTED_SECRET \ + 0x89, 0x0e, 0xd8, 0x2c, 0xf0, 0x9f, 0x22, 0x24, 0x3b, 0xdc, 0x42, \ + 0x52, 0xe4, 0xd7, 0x9c, 0x8a, 0x98, 0x10, 0xc1, 0x39, 0x1f, \ + 0x45, 0x5d, 0xce, 0x37, 0xa7, 0xb7, 0x32, 0xeb, 0x0a, 0x0e, \ + 0x4f +__maybe_unused static const uint8_t _EXPECTED_SECRET[] = { EXPECTED_SECRET }; BUILD_ASSERT(sizeof(_EXPECTED_SECRET) == CONFIG_ROLLBACK_SECRET_SIZE); /* @@ -45,22 +42,20 @@ BUILD_ASSERT(sizeof(_EXPECTED_SECRET) == CONFIG_ROLLBACK_SECRET_SIZE); * * b5d2c08b1f9109ac5c67de15486f0ac267ef9501bd9f646f4ea80085cb08284c */ -#define EXPECTED_SECRET2 \ - 0xb5, 0xd2, 0xc0, 0x8b, 0x1f, 0x91, 0x09, 0xac, 0x5c, 0x67, 0xde, \ - 0x15, 0x48, 0x6f, 0x0a, 0xc2, 0x67, 0xef, 0x95, 0x01, 0xbd, 0x9f, \ - 0x64, 0x6f, 0x4e, 0xa8, 0x00, 0x85, 0xcb, 0x08, 0x28, 0x4c -__maybe_unused static const uint8_t _EXPECTED_SECRET2[] = { - EXPECTED_SECRET2 -}; +#define EXPECTED_SECRET2 \ + 0xb5, 0xd2, 0xc0, 0x8b, 0x1f, 0x91, 0x09, 0xac, 0x5c, 0x67, 0xde, \ + 0x15, 0x48, 0x6f, 0x0a, 0xc2, 0x67, 0xef, 0x95, 0x01, 0xbd, \ + 0x9f, 0x64, 0x6f, 0x4e, 0xa8, 0x00, 0x85, 0xcb, 0x08, 0x28, \ + 0x4c +__maybe_unused static const uint8_t _EXPECTED_SECRET2[] = { EXPECTED_SECRET2 }; BUILD_ASSERT(sizeof(_EXPECTED_SECRET2) == CONFIG_ROLLBACK_SECRET_SIZE); -#define EXPECTED_UNINITIALIZED_ROLLBACK_SECRET \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -__maybe_unused static const uint8_t -_EXPECTED_UNINITIALIZED_ROLLBACK_SECRET[] = { +#define EXPECTED_UNINITIALIZED_ROLLBACK_SECRET \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, +__maybe_unused static const uint8_t _EXPECTED_UNINITIALIZED_ROLLBACK_SECRET[] = { EXPECTED_UNINITIALIZED_ROLLBACK_SECRET }; BUILD_ASSERT(sizeof(_EXPECTED_UNINITIALIZED_ROLLBACK_SECRET) == @@ -143,7 +138,8 @@ test_static int test_add_entropy(void) /* Immediately after boot region 1 should not yet be initialized. */ rv = read_rollback(1, &rb_data); TEST_EQ(rv, EC_SUCCESS, "%d"); - TEST_EQ(check_equal(&rb_data, &expected_uninitialized), EC_SUCCESS, "%d"); + TEST_EQ(check_equal(&rb_data, &expected_uninitialized), EC_SUCCESS, + "%d"); /* * Add entropy. The result should end up being written to the unused @@ -186,7 +182,7 @@ test_static int test_add_entropy(void) return rv; } -void run_test(int argc, char **argv) +void run_test(int argc, const char **argv) { ccprintf("Running rollback_entropy test\n"); RUN_TEST(test_add_entropy); |