From aea72d3eb2c2ff40acc3d26764ab5a61d0907599 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 10 Apr 2019 11:50:23 -0400 Subject: [PATCH] Add macros for AES block size --- common/aes.h | 1 + test/common/aes.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/aes.h b/common/aes.h index dd5a1019..ef1eca28 100644 --- a/common/aes.h +++ b/common/aes.h @@ -8,6 +8,7 @@ #define AES192_KEYBYTES 24 #define AES256_KEYBYTES 32 #define AESCTR_NONCEBYTES 12 +#define AES_BLOCKBYTES 16 typedef struct { uint64_t sk_exp[88]; diff --git a/test/common/aes.c b/test/common/aes.c index dcfe8029..d7759168 100644 --- a/test/common/aes.c +++ b/test/common/aes.c @@ -78,19 +78,19 @@ int main(void) } - aes128_ecb(ct, msg, 3, &ctx128); + aes128_ecb(ct, msg, sizeof(msg) / AES_BLOCKBYTES, &ctx128); if(memcmp(ct, ct128, 48)) { printf("ERROR AES128ECB output does not match test vector.\n"); r = 1; } - aes192_ecb(ct, msg, 3, &ctx192); + aes192_ecb(ct, msg, sizeof(msg) / AES_BLOCKBYTES, &ctx192); if(memcmp(ct, ct192, 48)) { printf("ERROR AES192ECB output does not match test vector.\n"); r = 1; } - aes256_ecb(ct, msg, 3, &ctx256); + aes256_ecb(ct, msg, sizeof(msg) / AES_BLOCKBYTES, &ctx256); if(memcmp(ct, ct256, 48)) { printf("ERROR AES256ECB output does not match test vector.\n"); r = 1;