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/gost_28147/gost_28147.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/block/gost_28147/gost_28147.cpp') diff --git a/src/block/gost_28147/gost_28147.cpp b/src/block/gost_28147/gost_28147.cpp index d4a9faa40..db144a81f 100644 --- a/src/block/gost_28147/gost_28147.cpp +++ b/src/block/gost_28147/gost_28147.cpp @@ -51,8 +51,7 @@ GOST_28147_89_Params::GOST_28147_89_Params(const std::string& n) : name(n) /* * GOST Constructor */ -GOST_28147_89::GOST_28147_89(const GOST_28147_89_Params& param) : - SBOX(1024), EK(8) +GOST_28147_89::GOST_28147_89(const GOST_28147_89_Params& param) : SBOX(1024) { // Convert the parallel 4x4 sboxes into larger word-based sboxes for(size_t i = 0; i != 4; ++i) @@ -165,6 +164,7 @@ void GOST_28147_89::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void GOST_28147_89::key_schedule(const byte key[], size_t) { + EK.resize(8); for(size_t i = 0; i != 8; ++i) EK[i] = load_le(key, i); } -- cgit v1.2.3