diff options
Diffstat (limited to 'src/rng/x931_rng/x931_rng.cpp')
-rw-r--r-- | src/rng/x931_rng/x931_rng.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp index 72ddb51c5..619c37e57 100644 --- a/src/rng/x931_rng/x931_rng.cpp +++ b/src/rng/x931_rng/x931_rng.cpp @@ -57,15 +57,18 @@ void ANSI_X931_RNG::reseed() { prng->reseed(); - SecureVector<byte> key(cipher->MAXIMUM_KEYLENGTH); - prng->randomize(key, key.size()); - cipher->set_key(key, key.size()); + if(prng->is_seeded()) + { + SecureVector<byte> key(cipher->MAXIMUM_KEYLENGTH); + prng->randomize(key, key.size()); + cipher->set_key(key, key.size()); - if(V.size() != cipher->BLOCK_SIZE) - V.create(cipher->BLOCK_SIZE); - prng->randomize(V, V.size()); + if(V.size() != cipher->BLOCK_SIZE) + V.create(cipher->BLOCK_SIZE); + prng->randomize(V, V.size()); - update_buffer(); + update_buffer(); + } } /************************************************* |