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/kasumi | |
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/kasumi')
-rw-r--r-- | src/block/kasumi/kasumi.cpp | 2 | ||||
-rw-r--r-- | src/block/kasumi/kasumi.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/block/kasumi/kasumi.cpp b/src/block/kasumi/kasumi.cpp index d3894789d..ae21338c6 100644 --- a/src/block/kasumi/kasumi.cpp +++ b/src/block/kasumi/kasumi.cpp @@ -211,6 +211,8 @@ void KASUMI::key_schedule(const byte key[], size_t) K[i+8] = K[i] ^ RC[i]; } + EK.resize(64); + for(size_t i = 0; i != 8; ++i) { EK[8*i ] = rotate_left(K[(i+0) % 8 ], 2); diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h index f3dd7e0c7..571085612 100644 --- a/src/block/kasumi/kasumi.h +++ b/src/block/kasumi/kasumi.h @@ -21,11 +21,9 @@ class BOTAN_DLL KASUMI : public Block_Cipher_Fixed_Params<8, 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; - void clear() { zeroise(EK); } + void clear() { EK.clear(); } std::string name() const { return "KASUMI"; } BlockCipher* clone() const { return new KASUMI; } - - KASUMI() : EK(64) {} private: void key_schedule(const byte[], size_t); |