diff options
author | Yicheng Li <yichengli@chromium.org> | 2020-01-16 16:43:03 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-17 22:30:02 +0000 |
commit | 91ba35b1ce4480575a6644ab9c14e296df4de8aa (patch) | |
tree | aa7b428c0d48f55b796415bd78b7e62e6122a69b /test/aes.c | |
parent | 9960b3f0296f23cd700630af7f6050889ca4e347 (diff) | |
download | chrome-ec-91ba35b1ce4480575a6644ab9c14e296df4de8aa.tar.gz |
aes: Enforce alignment of static array
When building on-device unit test binaries, the static array in
test/aes.c were not address-aligned after being linked into the
final binary. This causes "runtest" to emit an exception on device
as the MCU tries to load from the address of the static array which
is unaligned address. Enforce alignment to avoid the error.
BRANCH=nocturne
BUG=b:146059307
TEST=make BOARD=nucleo-h743zi tests -j
# Flash build/nucleo-h743zi/test-aes.bin
# Connect to UARD console
runtest
Change-Id: I91e8523fa0f13bf89baa609cded36e111e466972
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2006708
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'test/aes.c')
-rw-r--r-- | test/aes.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/aes.c b/test/aes.c index ddc0c03833..53b7c770e4 100644 --- a/test/aes.c +++ b/test/aes.c @@ -621,12 +621,12 @@ static void test_aes_speed(void) { int i; /* Test vectors from FIPS-197, Appendix C. */ - static const uint8_t key[] = { + static const uint8_t key[] __aligned(4) = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, }; const int key_size = sizeof(key); - static const uint8_t plaintext[] = { + static const uint8_t plaintext[] __aligned(4) = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, }; |