7#ifndef BOTAN_STATEFUL_RNG_H_
8#define BOTAN_STATEFUL_RNG_H_
10#include <botan/mutex.h>
36 m_underlying_rng(&rng), m_entropy_sources(&entropy_sources), m_reseed_interval(reseed_interval) {}
45 m_underlying_rng(&rng), m_reseed_interval(reseed_interval) {}
53 m_entropy_sources(&entropy_sources), m_reseed_interval(reseed_interval) {}
65 void initialize_with(std::span<const uint8_t> input);
69 bool is_seeded() const
final;
71 bool accepts_input() const
final {
return true; }
113 virtual
void generate_output(std::span<uint8_t> output, std::span<const uint8_t> input) = 0;
115 virtual
void update(std::span<const uint8_t> input) = 0;
117 virtual
void clear_state() = 0;
120 void generate_batched_output(std::span<uint8_t> output, std::span<const uint8_t> input);
122 void fill_bytes_with_input(std::span<uint8_t> output, std::span<const uint8_t> input)
final;
124 void reset_reseed_counter();
134 const
size_t m_reseed_interval;
135 uint32_t m_last_pid = 0;
142 size_t m_reseed_counter = 0;
size_t reseed_interval() const
virtual size_t security_level() const =0
Stateful_RNG(RandomNumberGenerator &rng, size_t reseed_interval)
Stateful_RNG(RandomNumberGenerator &rng, Entropy_Sources &entropy_sources, size_t reseed_interval)
void initialize_with(const uint8_t input[], size_t length)
Stateful_RNG(Entropy_Sources &entropy_sources, size_t reseed_interval)
virtual size_t max_number_of_bytes_per_request() const =0
int(* update)(CTX *, const void *, CC_LONG len)
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_RNG_RESEED_DEFAULT_TIMEOUT
#define BOTAN_RNG_RESEED_POLL_BITS