forked from wolfSSL/wolfssl
don't segfault on AES if user didn't set up keys
This commit is contained in:
@ -973,6 +973,8 @@ 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)
|
||||||
|
return; /* stop instead of segfaulting, set up your keys! */
|
||||||
/*
|
/*
|
||||||
* map byte array block to cipher state
|
* map byte array block to cipher state
|
||||||
* and add initial round key:
|
* and add initial round key:
|
||||||
@ -1107,6 +1109,8 @@ 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)
|
||||||
|
return; /* stop instead of segfaulting, set up your keys! */
|
||||||
/*
|
/*
|
||||||
* map byte array block to cipher state
|
* map byte array block to cipher state
|
||||||
* and add initial round key:
|
* and add initial round key:
|
||||||
|
Reference in New Issue
Block a user