aboutsummaryrefslogtreecommitdiffstats
path: root/src/x931_rng.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-28 14:28:27 +0000
committerlloyd <[email protected]>2008-06-28 14:28:27 +0000
commiteeb6859df0be3034cefd81ccce20494b9f7bc308 (patch)
tree6251fe589c8de164904329385f49e71b4ca52ad5 /src/x931_rng.cpp
parent0071ad80fc8eafc607d31018da27640c80d52af2 (diff)
Add interfaces for add_entropy_source and add_entropy to
RandomNumberGenerator, and make ANSI_X931_PRNG's implementations just forward the arguments to the underlying RNG. This allows seeding the RNG even if no entropy modules are loaded into the library. Also it allows actually adding user-specified data; to do it otherwise would require creating the RNG objects yourself and retaining a pointer to the Randpool, which is pretty bogus. Move Null_RNG to rng.h
Diffstat (limited to 'src/x931_rng.cpp')
-rw-r--r--src/x931_rng.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/x931_rng.cpp b/src/x931_rng.cpp
index 68d633df4..8f454dcb8 100644
--- a/src/x931_rng.cpp
+++ b/src/x931_rng.cpp
@@ -70,6 +70,22 @@ void ANSI_X931_RNG::reseed()
}
/*************************************************
+* Add a entropy source to the underlying PRNG *
+*************************************************/
+void ANSI_X931_RNG::add_entropy_source(EntropySource* src)
+ {
+ prng->add_entropy_source(src);
+ }
+
+/*************************************************
+* Add some entropy to the underlying PRNG *
+*************************************************/
+void ANSI_X931_RNG::add_entropy(const byte input[], u32bit length)
+ {
+ prng->add_entropy(input, length);
+ }
+
+/*************************************************
* Check if the the PRNG is seeded *
*************************************************/
bool ANSI_X931_RNG::is_seeded() const