From 8916f46cc9d75dc85807faa2eda00807709c44be Mon Sep 17 00:00:00 2001 From: Todd A Ouska Date: Tue, 31 May 2011 17:35:06 -0700 Subject: [PATCH] more AES key checks --- ctaocrypt/src/aes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ctaocrypt/src/aes.c b/ctaocrypt/src/aes.c index 91aa54f35..25a0e5101 100644 --- a/ctaocrypt/src/aes.c +++ b/ctaocrypt/src/aes.c @@ -975,7 +975,7 @@ static void AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock) word32 r = aes->rounds >> 1; const word32* rk = aes->key; - if (r > 7) { + if (r > 7 || r == 0) { CYASSL_MSG("AesEncrypt encountered improper key, set it up"); return; /* stop instead of segfaulting, set up your keys! */ } @@ -1113,7 +1113,7 @@ static void AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock) word32 r = aes->rounds >> 1; const word32* rk = aes->key; - if (r > 7) { + if (r > 7 || r == 0) { CYASSL_MSG("AesDecrypt encountered improper key, set it up"); return; /* stop instead of segfaulting, set up your keys! */ }