diff options
author | lloyd <[email protected]> | 2008-05-24 18:54:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-05-24 18:54:35 +0000 |
commit | 0d31ffcbc89d232e2682110733ca2d969af1e15e (patch) | |
tree | 13964c2c10eec341e3765d02b603998d205f42b5 | |
parent | f8078f5904fce5cbfd69516b175872496bdc2267 (diff) |
Avoid global RNG in S2K::new_random_salt (RNG reference passed as argument instead)
-rw-r--r-- | include/s2k.h | 2 | ||||
-rw-r--r-- | src/s2k.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/s2k.h b/include/s2k.h index 88cc16d68..cfe735cd9 100644 --- a/include/s2k.h +++ b/include/s2k.h @@ -25,7 +25,7 @@ class BOTAN_DLL S2K void set_iterations(u32bit); void change_salt(const byte[], u32bit); void change_salt(const MemoryRegion<byte>&); - void new_random_salt(u32bit); + void new_random_salt(RandomNumberGenerator& rng, u32bit); u32bit iterations() const { return iter; } SecureVector<byte> current_salt() const { return salt; } diff --git a/src/s2k.cpp b/src/s2k.cpp index e5668f32f..9c67aef10 100644 --- a/src/s2k.cpp +++ b/src/s2k.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/s2k.h> -#include <botan/libstate.h> namespace Botan { @@ -44,10 +43,11 @@ void S2K::change_salt(const MemoryRegion<byte>& new_salt) /************************************************* * Create a new random salt * *************************************************/ -void S2K::new_random_salt(u32bit length) +void S2K::new_random_salt(RandomNumberGenerator& rng, + u32bit length) { salt.create(length); - global_state().randomize(salt, length); + rng.randomize(salt, length); } } |