aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/gost_28147/gost_28147.cpp
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/gost_28147/gost_28147.cpp
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/gost_28147/gost_28147.cpp')
-rw-r--r--src/block/gost_28147/gost_28147.cpp4
1 files changed, 2 insertions, 2 deletions
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<u32bit>(key, i);
}