diff options
Diffstat (limited to 'src/lib/block/aes/aes.cpp')
-rw-r--r-- | src/lib/block/aes/aes.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp index 6cca701af..aac277b4f 100644 --- a/src/lib/block/aes/aes.cpp +++ b/src/lib/block/aes/aes.cpp @@ -345,6 +345,12 @@ void aes_key_schedule(const byte key[], size_t length, secure_vector<byte>& ME, secure_vector<byte>& MD) { + + // if length is < 4, X = 0, the first for loop is not entered and in + // the second for loop "RC[(i-X)/X]" = division by zero + // But obviously valid aes length values are only 16, 24 and 32 + BOTAN_ASSERT( length >= 4, "aes key length has valid size" ); + static const u32bit RC[10] = { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000 }; |