aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/noekeon
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-25 02:11:10 +0000
committerlloyd <[email protected]>2012-05-25 02:11:10 +0000
commit113f4035f41cf3152832e1753d28b79a7ea811a4 (patch)
tree1e2071c1f7786972d268b727f52ee33225ad68d4 /src/block/noekeon
parentee42784fee56c48f72ecf03d7b93765dac35edf5 (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/noekeon')
-rw-r--r--src/block/noekeon/noekeon.cpp6
-rw-r--r--src/block/noekeon/noekeon.h2
2 files changed, 4 insertions, 4 deletions
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