aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-aes.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-10-26 14:00:57 (GMT)
committerJouni Malinen <j@w1.fi>2013-10-26 14:49:05 (GMT)
commite7ecab4a3b8bc5696ee6d9779bc9f9a1f8b4b6ed (patch)
tree85908522f34532000904ebcc47c331e7f0dfd942 /tests/test-aes.c
parent39044a703348e50d9d35053baf1b9ba3f53efdbf (diff)
downloadhostap-e7ecab4a3b8bc5696ee6d9779bc9f9a1f8b4b6ed.zip
hostap-e7ecab4a3b8bc5696ee6d9779bc9f9a1f8b4b6ed.tar.gz
hostap-e7ecab4a3b8bc5696ee6d9779bc9f9a1f8b4b6ed.tar.bz2
Use ARRAY_SIZE() macro
Replace the common sizeof(a)/sizeof(a[0]) constructions with a more readable version. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests/test-aes.c')
-rw-r--r--tests/test-aes.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test-aes.c b/tests/test-aes.c
index 84c959c..e7b5534 100644
--- a/tests/test-aes.c
+++ b/tests/test-aes.c
@@ -134,7 +134,7 @@ static int test_cbc(void)
u8 *buf;
unsigned int i;
- for (i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(vectors); i++) {
struct cbc_test_vector *tv = &vectors[i];
buf = malloc(tv->len);
if (buf == NULL) {
@@ -347,7 +347,7 @@ static int test_gcm(void)
u8 p[64], c[64], tmp[64];
size_t k_len, p_len, aad_len, iv_len;
- for (i = 0; i < sizeof(gcm_tests) / sizeof(gcm_tests[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(gcm_tests); i++) {
const struct gcm_test_vector *tc = &gcm_tests[i];
k_len = os_strlen(tc->k) / 2;
@@ -542,7 +542,7 @@ int main(int argc, char *argv[])
test_aes_perf();
- for (i = 0; i < sizeof(test_vectors) / sizeof(test_vectors[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
tv = &test_vectors[i];
if (omac1_aes_128(tv->k, tv->msg, tv->msg_len, result) ||
memcmp(result, tv->tag, 16) != 0) {