Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

system_rng.h
Go to the documentation of this file.
1 /*
2 * System RNG interface
3 * (C) 2014,2015 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_SYSTEM_RNG_H__
9 #define BOTAN_SYSTEM_RNG_H__
10
11 #include <botan/rng.h>
12
13 namespace Botan {
14
15 /**
16 * Return a shared reference to a global PRNG instance provided by the
17 * operating system. For instance might be instantiated by /dev/urandom
18 * or CryptGenRandom.
19 */
20 BOTAN_DLL RandomNumberGenerator& system_rng();
21
22 /*
23 * Instantiable reference to the system RNG.
24 */
25 class BOTAN_DLL System_RNG final : public RandomNumberGenerator
26 {
27 public:
28 std::string name() const override { return system_rng().name(); }
29
30 void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); }
31
32 void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); }
33
34 bool is_seeded() const override { return true; }
35
36 void clear() override {}
37 };
38
39 }
40
41 #endif
Botan::System_RNG::add_entropy
void add_entropy(const uint8_t in[], size_t length) override
Definition: system_rng.h:32
Botan::RandomNumberGenerator::add_entropy
virtual void add_entropy(const uint8_t input[], size_t length)=0
Botan::RandomNumberGenerator
Definition: rng.h:25
Botan::RandomNumberGenerator::randomize
virtual void randomize(uint8_t output[], size_t length)=0
Botan::System_RNG::clear
void clear() override
Definition: system_rng.h:36
Botan::System_RNG::name
std::string name() const override
Definition: system_rng.h:28
Botan::RandomNumberGenerator::name
virtual std::string name() const =0
Botan::System_RNG
Definition: system_rng.h:25
Botan
Definition: alg_id.cpp:13
Botan::system_rng
RandomNumberGenerator & system_rng()
Definition: system_rng.cpp:196
Botan::System_RNG::is_seeded
bool is_seeded() const override
Definition: system_rng.h:34
Botan::System_RNG::randomize
void randomize(uint8_t out[], size_t len) override
Definition: system_rng.h:30