aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/aes
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-04-12 15:34:59 +0000
committerlloyd <[email protected]>2013-04-12 15:34:59 +0000
commit305b09b74e20e34880fc924de98fbc3a290cc80d (patch)
treee94a279b34b8786958057d4eb6043af0b90560bc /src/block/aes
parentdcb8e2f09a29e0961c96a1189f571cc38d907c68 (diff)
Avoid null pointer deref if key was not set in AES
Diffstat (limited to 'src/block/aes')
-rw-r--r--src/block/aes/aes.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp
index 232d0dc0a..f8d632c44 100644
--- a/src/block/aes/aes.cpp
+++ b/src/block/aes/aes.cpp
@@ -417,6 +417,8 @@ void aes_encrypt_n(const byte in[], byte out[],
const secure_vector<u32bit>& EK,
const secure_vector<byte>& ME)
{
+ BOTAN_ASSERT(EK.size() && ME.size() == 16, "Key was set");
+
const size_t BLOCK_SIZE = 16;
const u32bit* TE0 = TE;
@@ -528,6 +530,8 @@ void aes_decrypt_n(const byte in[], byte out[], size_t blocks,
const secure_vector<u32bit>& DK,
const secure_vector<byte>& MD)
{
+ BOTAN_ASSERT(DK.size() && MD.size() == 16, "Key was set");
+
const size_t BLOCK_SIZE = 16;
const u32bit* TD0 = TD;