don't segfault on AES if user didn't set up keys

This commit is contained in:
Todd A Ouska 2011-02-28 15:25:38 -08:00
parent 27d54b1096
commit ca9caaf606

View File

@ -973,6 +973,8 @@ void AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
word32 r = aes->rounds >> 1;
const word32* rk = aes->key;
if (r > 7)
return; /* stop instead of segfaulting, set up your keys! */
/*
* map byte array block to cipher state
* and add initial round key:
@ -1107,6 +1109,8 @@ void AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
word32 r = aes->rounds >> 1;
const word32* rk = aes->key;
if (r > 7)
return; /* stop instead of segfaulting, set up your keys! */
/*
* map byte array block to cipher state
* and add initial round key: