aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rng/system_rng/system_rng.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/rng/system_rng/system_rng.h')
-rw-r--r--src/lib/rng/system_rng/system_rng.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lib/rng/system_rng/system_rng.h b/src/lib/rng/system_rng/system_rng.h
index cac861618..0f4b94725 100644
--- a/src/lib/rng/system_rng/system_rng.h
+++ b/src/lib/rng/system_rng/system_rng.h
@@ -1,6 +1,6 @@
/*
* System RNG interface
-* (C) 2014 Jack Lloyd
+* (C) 2014,2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -19,6 +19,29 @@ namespace Botan {
*/
BOTAN_DLL RandomNumberGenerator& system_rng();
+/*
+* Instantiatable reference to the system RNG.
+*/
+class BOTAN_DLL System_RNG : public RandomNumberGenerator
+ {
+ public:
+ System_RNG() : m_rng(system_rng()) {}
+
+ void randomize(Botan::byte out[], size_t len) override { m_rng.randomize(out, len); }
+
+ bool is_seeded() const override { return m_rng.is_seeded(); }
+
+ void clear() override { m_rng.clear(); }
+
+ std::string name() const override { return m_rng.name(); }
+
+ void reseed(size_t poll_bits = 256) override { m_rng.reseed(poll_bits); }
+
+ void add_entropy(const byte in[], size_t len) override { m_rng.add_entropy(in, len); }
+ private:
+ Botan::RandomNumberGenerator& m_rng;
+ };
+
}
#endif