From 113f4035f41cf3152832e1753d28b79a7ea811a4 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 25 May 2012 02:11:10 +0000 Subject: 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. --- src/block/noekeon/noekeon.cpp | 6 ++++-- src/block/noekeon/noekeon.h | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/block/noekeon') diff --git a/src/block/noekeon/noekeon.cpp b/src/block/noekeon/noekeon.cpp index 06c415be9..3929d57d1 100644 --- a/src/block/noekeon/noekeon.cpp +++ b/src/block/noekeon/noekeon.cpp @@ -185,6 +185,7 @@ void Noekeon::key_schedule(const byte key[], size_t) A0 ^= RC[16]; + DK.resize(4); DK[0] = A0; DK[1] = A1; DK[2] = A2; @@ -192,6 +193,7 @@ void Noekeon::key_schedule(const byte key[], size_t) theta(A0, A1, A2, A3); + EK.resize(4); EK[0] = A0; EK[1] = A1; EK[2] = A2; @@ -203,8 +205,8 @@ void Noekeon::key_schedule(const byte key[], size_t) */ void Noekeon::clear() { - zeroise(EK); - zeroise(DK); + EK.clear(); + DK.clear(); } } diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h index 8bcff64c9..108b34cd6 100644 --- a/src/block/noekeon/noekeon.h +++ b/src/block/noekeon/noekeon.h @@ -24,8 +24,6 @@ class BOTAN_DLL Noekeon : public Block_Cipher_Fixed_Params<16, 16> void clear(); std::string name() const { return "Noekeon"; } BlockCipher* clone() const { return new Noekeon; } - - Noekeon() : EK(4), DK(4) {} protected: /** * The Noekeon round constants -- cgit v1.2.3