diff options
author | lloyd <[email protected]> | 2012-05-25 02:11:10 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-25 02:11:10 +0000 |
commit | 113f4035f41cf3152832e1753d28b79a7ea811a4 (patch) | |
tree | 1e2071c1f7786972d268b727f52ee33225ad68d4 /src/block/aes | |
parent | ee42784fee56c48f72ecf03d7b93765dac35edf5 (diff) |
For block and stream ciphers, don't set the size of the key vectors
until we are actually setting a key. This avoids the problem of
prototype objects consuming not just memory but the precious few bytes
of mlock'able memory that we're given by Linux.
Use clear_mem instead of a loop in BigInt::mask_bits
If OS2ECP encounters an invalid format type, include what type it was
in the exception message.
Diffstat (limited to 'src/block/aes')
-rw-r--r-- | src/block/aes/aes.cpp | 3 | ||||
-rw-r--r-- | src/block/aes/aes.h | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp index 42db7abae..6a706fd24 100644 --- a/src/block/aes/aes.cpp +++ b/src/block/aes/aes.cpp @@ -659,6 +659,9 @@ void aes_key_schedule(const byte key[], size_t length, TD[SE[get_byte(2, XDK[i])] + 512] ^ TD[SE[get_byte(3, XDK[i])] + 768]; + ME.resize(16); + MD.resize(16); + for(size_t i = 0; i != 4; ++i) { store_be(XEK[i+4*rounds], &ME[4*i]); diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h index f6f683bf9..5ddd39b08 100644 --- a/src/block/aes/aes.h +++ b/src/block/aes/aes.h @@ -18,8 +18,6 @@ namespace Botan { class BOTAN_DLL AES_128 : public Block_Cipher_Fixed_Params<16, 16> { public: - AES_128() : EK(40), DK(40), ME(16), MD(16) {} - void encrypt_n(const byte in[], byte out[], size_t blocks) const; void decrypt_n(const byte in[], byte out[], size_t blocks) const; @@ -40,8 +38,6 @@ class BOTAN_DLL AES_128 : public Block_Cipher_Fixed_Params<16, 16> class BOTAN_DLL AES_192 : public Block_Cipher_Fixed_Params<16, 24> { public: - AES_192() : EK(48), DK(48), ME(16), MD(16) {} - void encrypt_n(const byte in[], byte out[], size_t blocks) const; void decrypt_n(const byte in[], byte out[], size_t blocks) const; @@ -62,8 +58,6 @@ class BOTAN_DLL AES_192 : public Block_Cipher_Fixed_Params<16, 24> class BOTAN_DLL AES_256 : public Block_Cipher_Fixed_Params<16, 32> { public: - AES_256() : EK(56), DK(56), ME(16), MD(16) {} - void encrypt_n(const byte in[], byte out[], size_t blocks) const; void decrypt_n(const byte in[], byte out[], size_t blocks) const; |