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/stream/wid_wake/wid_wake.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/stream/wid_wake/wid_wake.cpp') diff --git a/src/stream/wid_wake/wid_wake.cpp b/src/stream/wid_wake/wid_wake.cpp index 51159064d..e4ab6477f 100644 --- a/src/stream/wid_wake/wid_wake.cpp +++ b/src/stream/wid_wake/wid_wake.cpp @@ -74,6 +74,10 @@ void WiderWake_41_BE::generate(size_t length) */ void WiderWake_41_BE::key_schedule(const byte key[], size_t) { + t_key.resize(4); + state.resize(5); + buffer.resize(DEFAULT_BUFFERSIZE); + for(size_t i = 0; i != 4; ++i) t_key[i] = load_be(key, i); @@ -81,6 +85,7 @@ void WiderWake_41_BE::key_schedule(const byte key[], size_t) 0x726A8F3B, 0xE69A3B5C, 0xD3C71FE5, 0xAB3C73D2, 0x4D3A8EB3, 0x0396D6E8, 0x3D4C2F7A, 0x9EE27CF3 }; + T.resize(256); for(size_t i = 0; i != 4; ++i) T[i] = t_key[i]; @@ -143,10 +148,10 @@ void WiderWake_41_BE::set_iv(const byte iv[], size_t length) void WiderWake_41_BE::clear() { position = 0; - zeroise(t_key); - zeroise(state); - zeroise(T); - zeroise(buffer); + t_key.clear(); + state.clear(); + T.clear(); + buffer.clear(); } } -- cgit v1.2.3