forked from wolfSSL/wolfssl
more AES key checks
This commit is contained in:
@ -975,7 +975,7 @@ static void AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
|||||||
word32 r = aes->rounds >> 1;
|
word32 r = aes->rounds >> 1;
|
||||||
|
|
||||||
const word32* rk = aes->key;
|
const word32* rk = aes->key;
|
||||||
if (r > 7) {
|
if (r > 7 || r == 0) {
|
||||||
CYASSL_MSG("AesEncrypt encountered improper key, set it up");
|
CYASSL_MSG("AesEncrypt encountered improper key, set it up");
|
||||||
return; /* stop instead of segfaulting, set up your keys! */
|
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;
|
word32 r = aes->rounds >> 1;
|
||||||
|
|
||||||
const word32* rk = aes->key;
|
const word32* rk = aes->key;
|
||||||
if (r > 7) {
|
if (r > 7 || r == 0) {
|
||||||
CYASSL_MSG("AesDecrypt encountered improper key, set it up");
|
CYASSL_MSG("AesDecrypt encountered improper key, set it up");
|
||||||
return; /* stop instead of segfaulting, set up your keys! */
|
return; /* stop instead of segfaulting, set up your keys! */
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user