Botan: src/rng/auto_rng/auto_rng.h Source File

Botan 1.10.17

auto_rng.h
Go to the documentation of this file.
1 /*
2 * Auto Seeded RNG
3 * (C) 2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_AUTO_SEEDING_RNG_H__
9 #define BOTAN_AUTO_SEEDING_RNG_H__
10
11 #include <botan/rng.h>
12 #include <botan/libstate.h>
13 #include <string>
14
15 namespace Botan {
16
17 /**
18 * An automatically seeded PRNG
19 */
20 class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator
21 {
22 public:
23 void randomize(byte out[], size_t len)
24 { rng->randomize(out, len); }
25
26 bool is_seeded() const { return rng->is_seeded(); }
27
28 void clear() { rng->clear(); }
29
30 std::string name() const { return rng->name(); }
31
32 void reseed(size_t poll_bits = 256) { rng->reseed(poll_bits); }
33
34 void add_entropy_source(EntropySource* es)
35 { rng->add_entropy_source(es); }
36
37 void add_entropy(const byte in[], size_t len)
38 { rng->add_entropy(in, len); }
39
40 AutoSeeded_RNG() { rng = &global_state().global_rng(); }
41 private:
42 RandomNumberGenerator* rng;
43 };
44
45 }
46
47 #endif
Botan::AutoSeeded_RNG::AutoSeeded_RNG
AutoSeeded_RNG()
Definition: auto_rng.h:40
Botan::Library_State::global_rng
RandomNumberGenerator & global_rng()
Definition: libstate.cpp:183
Botan::RandomNumberGenerator
Definition: rng.h:20
Botan::AutoSeeded_RNG::randomize
void randomize(byte out[], size_t len)
Definition: auto_rng.h:23
Botan::AutoSeeded_RNG::name
std::string name() const
Definition: auto_rng.h:30
Botan::AutoSeeded_RNG::clear
void clear()
Definition: auto_rng.h:28
Botan::EntropySource
Definition: entropy_src.h:122
Botan::AutoSeeded_RNG::add_entropy
void add_entropy(const byte in[], size_t len)
Definition: auto_rng.h:37
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::AutoSeeded_RNG
Definition: auto_rng.h:20
Botan::Global_State_Management::global_state
Library_State & global_state()
Definition: global_state.cpp:32
Botan::AutoSeeded_RNG::reseed
void reseed(size_t poll_bits=256)
Definition: auto_rng.h:32
Botan::AutoSeeded_RNG::add_entropy_source
void add_entropy_source(EntropySource *es)
Definition: auto_rng.h:34
Botan::AutoSeeded_RNG::is_seeded
bool is_seeded() const
Definition: auto_rng.h:26
Botan
Definition: algo_base.h:14