Botan  1.11.30
auto_rng.h
Go to the documentation of this file.
1 /*
2 * Auto Seeded RNG
3 * (C) 2008 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_AUTO_SEEDING_RNG_H__
9 #define BOTAN_AUTO_SEEDING_RNG_H__
10 
11 #include <botan/rng.h>
12 #include <string>
13 
14 namespace Botan {
15 
17  {
18  public:
19  void randomize(byte out[], size_t len) override
20  { m_rng->randomize(out, len); }
21 
22  bool is_seeded() const override { return m_rng->is_seeded(); }
23 
24  void clear() override { m_rng->clear(); }
25 
26  std::string name() const override { return m_rng->name(); }
27 
29  size_t poll_bits,
30  std::chrono::milliseconds poll_timeout) override
31  {
32  return m_rng->reseed_with_sources(srcs, poll_bits, poll_timeout);
33  }
34 
35  void add_entropy(const byte in[], size_t len) override
36  { m_rng->add_entropy(in, len); }
37 
39  private:
40  std::unique_ptr<RandomNumberGenerator> m_rng;
41  };
42 
43 }
44 
45 #endif
void clear() override
Definition: auto_rng.h:24
void randomize(byte out[], size_t len) override
Definition: auto_rng.h:19
size_t reseed_with_sources(Entropy_Sources &srcs, size_t poll_bits, std::chrono::milliseconds poll_timeout) override
Definition: auto_rng.h:28
std::string name() const override
Definition: auto_rng.h:26
static RandomNumberGenerator * make_rng()
Definition: rng.cpp:28
void add_entropy(const byte in[], size_t len) override
Definition: auto_rng.h:35
Definition: alg_id.cpp:13
bool is_seeded() const override
Definition: auto_rng.h:22
std::uint8_t byte
Definition: types.h:31