From 344a07051ec07f3c66feef15b91d1eb6c8c1b40e Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 15 Oct 2021 17:24:36 +0200 Subject: [PATCH] #39 --- wolfcrypt/src/aes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 2bd4eb8ad..d3bbfdf93 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -2825,8 +2825,9 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock) if (keylen != 16 && keylen != 24 && keylen != 32) { return BAD_FUNC_ARG; } - #ifdef AES_MAX_KEY_SIZE - /* Check key length */ + #if defined(AES_MAX_KEY_SIZE) && AES_MAX_KEY_SIZE < 256 + /* Check key length only when AES_MAX_KEY_SIZE doesn't allow + * all key sizes. Otherwise this condition is never true. */ if (keylen > (AES_MAX_KEY_SIZE / 8)) { return BAD_FUNC_ARG; }