diff options
author | lloyd <[email protected]> | 2008-06-27 15:46:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-27 15:46:02 +0000 |
commit | 09d2b6df9a2a680476160a6a0a56c4b4f2fb91aa (patch) | |
tree | aec3bd3a9b2eb520067b8af20e61c9f654cd230a | |
parent | 9d77dd59ab4a7d122a20b0d89ae081a177f38287 (diff) |
OctetString now requires a RandomNumberGenerator& to create a random
key or IV; it does not reference the global RNG.
-rw-r--r-- | include/symkey.h | 2 | ||||
-rw-r--r-- | src/symkey.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/symkey.h b/include/symkey.h index 93946d12d..f3211eb0f 100644 --- a/include/symkey.h +++ b/include/symkey.h @@ -33,7 +33,7 @@ class BOTAN_DLL OctetString void change(const byte[], u32bit); void change(const MemoryRegion<byte>& in) { bits = in; } - OctetString(u32bit len); + OctetString(class RandomNumberGenerator&, u32bit len); OctetString(const std::string& str = "") { change(str); } OctetString(const byte in[], u32bit len) { change(in, len); } OctetString(const MemoryRegion<byte>& in) { change(in); } diff --git a/src/symkey.cpp b/src/symkey.cpp index b5ddb6af9..f07421bef 100644 --- a/src/symkey.cpp +++ b/src/symkey.cpp @@ -5,9 +5,9 @@ #include <botan/symkey.h> #include <botan/bit_ops.h> +#include <botan/rng.h> #include <botan/pipe.h> #include <botan/hex.h> -#include <botan/libstate.h> #include <algorithm> namespace Botan { @@ -15,10 +15,11 @@ namespace Botan { /************************************************* * Create an OctetString from RNG output * *************************************************/ -OctetString::OctetString(u32bit length) +OctetString::OctetString(RandomNumberGenerator& rng, + u32bit length) { bits.create(length); - global_state().randomize(bits, length); + rng.randomize(bits, length); } /************************************************* |