From 32f04293ca696ee2124dfdf8812163fbdac4b68d Mon Sep 17 00:00:00 2001 From: Flavio Santes Date: Thu, 17 Nov 2016 05:04:26 -0600 Subject: [PATCH] tests/tinycrypt/aes: Remove struct declaration inside function This commit removes the declaration of a data type inside the tests 3 & 4. The new data type 'struct kat_table' is declared at the beginning of the file. Change-Id: I7662cd164a865fe0e70f984b9b494d96b4a72af9 Signed-off-by: Flavio Santes --- tests/crypto/test_aes/src/test_aes.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/crypto/test_aes/src/test_aes.c b/tests/crypto/test_aes/src/test_aes.c index ed81037ec4d..6fc43cbc494 100644 --- a/tests/crypto/test_aes/src/test_aes.c +++ b/tests/crypto/test_aes/src/test_aes.c @@ -56,6 +56,12 @@ #define NUM_OF_NIST_KEYS 16 #define NUM_OF_FIXED_KEYS 128 + +struct kat_table { + uint8_t in[NUM_OF_NIST_KEYS]; + uint8_t out[NUM_OF_NIST_KEYS]; +}; + /* * NIST test key schedule. */ @@ -173,10 +179,7 @@ uint32_t test_3(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - const struct { - uint8_t in[NUM_OF_NIST_KEYS]; - uint8_t out[NUM_OF_NIST_KEYS]; - } kat_tbl[NUM_OF_FIXED_KEYS] = { + const struct kat_table kat_tbl[NUM_OF_FIXED_KEYS] = { {{ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 @@ -1117,10 +1120,7 @@ uint32_t test_4(void) uint32_t result = TC_PASS; TC_PRINT("AES128 test #4 (NIST variable-key and fixed-text):\n"); - const struct { - uint8_t key[NUM_OF_NIST_KEYS]; - uint8_t out[NUM_OF_NIST_KEYS]; - } kat_tbl[NUM_OF_FIXED_KEYS] = { + const struct kat_table kat_tbl[NUM_OF_FIXED_KEYS] = { {{ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 @@ -2021,7 +2021,7 @@ uint32_t test_4(void) uint32_t i; for (i = 0; i < NUM_OF_FIXED_KEYS; ++i) { - result = var_key_test(i, kat_tbl[i].key, kat_tbl[i].out); + result = var_key_test(i, kat_tbl[i].in, kat_tbl[i].out); if (result == TC_FAIL){ break; }