aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-14 18:24:38 +0000
committerlloyd <[email protected]>2010-10-14 18:24:38 +0000
commit01e0b5f9e0a6572e8eea8f7e226eb96e11c0fa58 (patch)
treec1bb4952191c2efa6c313543b477d9492a43a595
parentf8d3d95b84c55b48d61b50f9d0e6aabbfe007e12 (diff)
Only allocate as much working space as needed in key schedule
-rw-r--r--src/block/aes/aes.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp
index 0c45c38a0..f149a0ac0 100644
--- a/src/block/aes/aes.cpp
+++ b/src/block/aes/aes.cpp
@@ -1,6 +1,6 @@
/*
* AES
-* (C) 1999-2009 Jack Lloyd
+* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -613,12 +613,12 @@ void aes_key_schedule(const byte key[], size_t length,
MemoryRegion<byte>& MD)
{
static const u32bit RC[10] = {
- 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000,
- 0x40000000, 0x80000000, 0x1B000000, 0x36000000 };
+ 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
+ 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000 };
const u32bit rounds = (length / 4) + 6;
- SecureVector<u32bit> XEK(64), XDK(64);
+ SecureVector<u32bit> XEK(length + 32), XDK(length + 32);
const size_t X = length / 4;
for(size_t i = 0; i != X; ++i)