1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-12-03 12:54:05 +00:00

Add macros for AES block size

This commit is contained in:
Douglas Stebila 2019-04-10 11:50:23 -04:00
parent a2c2521e81
commit aea72d3eb2
2 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#define AES192_KEYBYTES 24 #define AES192_KEYBYTES 24
#define AES256_KEYBYTES 32 #define AES256_KEYBYTES 32
#define AESCTR_NONCEBYTES 12 #define AESCTR_NONCEBYTES 12
#define AES_BLOCKBYTES 16
typedef struct { typedef struct {
uint64_t sk_exp[88]; uint64_t sk_exp[88];

View File

@ -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)) { if(memcmp(ct, ct128, 48)) {
printf("ERROR AES128ECB output does not match test vector.\n"); printf("ERROR AES128ECB output does not match test vector.\n");
r = 1; r = 1;
} }
aes192_ecb(ct, msg, 3, &ctx192); aes192_ecb(ct, msg, sizeof(msg) / AES_BLOCKBYTES, &ctx192);
if(memcmp(ct, ct192, 48)) { if(memcmp(ct, ct192, 48)) {
printf("ERROR AES192ECB output does not match test vector.\n"); printf("ERROR AES192ECB output does not match test vector.\n");
r = 1; r = 1;
} }
aes256_ecb(ct, msg, 3, &ctx256); aes256_ecb(ct, msg, sizeof(msg) / AES_BLOCKBYTES, &ctx256);
if(memcmp(ct, ct256, 48)) { if(memcmp(ct, ct256, 48)) {
printf("ERROR AES256ECB output does not match test vector.\n"); printf("ERROR AES256ECB output does not match test vector.\n");
r = 1; r = 1;