summaryrefslogtreecommitdiffstats
path: root/botan/src/rng/rng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'botan/src/rng/rng.cpp')
-rw-r--r--botan/src/rng/rng.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/botan/src/rng/rng.cpp b/botan/src/rng/rng.cpp
new file mode 100644
index 0000000..aa9b73f
--- /dev/null
+++ b/botan/src/rng/rng.cpp
@@ -0,0 +1,38 @@
+/*
+* Random Number Generator Base
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/rng.h>
+
+#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
+ #include <botan/auto_rng.h>
+#endif
+
+namespace Botan {
+
+/*
+* Get a single random byte
+*/
+byte RandomNumberGenerator::next_byte()
+ {
+ byte out;
+ this->randomize(&out, 1);
+ return out;
+ }
+
+/*
+* Create and seed a new RNG object
+*/
+RandomNumberGenerator* RandomNumberGenerator::make_rng()
+ {
+#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
+ return new AutoSeeded_RNG;
+#endif
+
+ throw Algorithm_Not_Found("RandomNumberGenerator::make_rng - no RNG found");
+ }
+
+}