aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rng/rng.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-10 03:41:59 +0000
committerlloyd <[email protected]>2014-01-10 03:41:59 +0000
commit6894dca64c04936d07048c0e8cbf7e25858548c3 (patch)
tree5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/rng/rng.cpp
parent9efa3be92442afb3d0b69890a36c7f122df18eda (diff)
Move lib into src
Diffstat (limited to 'src/lib/rng/rng.cpp')
-rw-r--r--src/lib/rng/rng.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/rng/rng.cpp b/src/lib/rng/rng.cpp
new file mode 100644
index 000000000..12a6c163e
--- /dev/null
+++ b/src/lib/rng/rng.cpp
@@ -0,0 +1,34 @@
+/*
+* Random Number Generator Base
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/rng.h>
+#include <botan/hmac_rng.h>
+#include <botan/libstate.h>
+
+namespace Botan {
+
+RandomNumberGenerator* RandomNumberGenerator::make_rng()
+ {
+ return make_rng(global_state().algorithm_factory()).release();
+ }
+
+/*
+* Create and seed a new RNG object
+*/
+std::unique_ptr<RandomNumberGenerator> RandomNumberGenerator::make_rng(Algorithm_Factory& af)
+ {
+ std::unique_ptr<RandomNumberGenerator> rng(
+ new HMAC_RNG(af.make_mac("HMAC(SHA-512)"),
+ af.make_mac("HMAC(SHA-256)"))
+ );
+
+ rng->reseed(256);
+
+ return rng;
+ }
+
+}