7#include <botan/auto_rng.h>
9#include <botan/entropy_src.h>
10#include <botan/hmac_drbg.h>
11#include <botan/internal/loadstor.h>
12#include <botan/internal/os_utils.h>
16#if defined(BOTAN_HAS_SYSTEM_RNG)
17 #include <botan/system_rng.h>
24std::unique_ptr<MessageAuthenticationCode> auto_rng_hmac() {
25 const std::string possible_auto_rng_hmacs[] = {
30 for(
const auto& hmac : possible_auto_rng_hmacs) {
45 m_rng = std::make_unique<HMAC_DRBG>(auto_rng_hmac(), underlying_rng, reseed_interval);
51 m_rng = std::make_unique<HMAC_DRBG>(auto_rng_hmac(), entropy_sources, reseed_interval);
58 size_t reseed_interval) {
59 m_rng = std::make_unique<HMAC_DRBG>(auto_rng_hmac(), underlying_rng, entropy_sources, reseed_interval);
74 m_rng->force_reseed();
77 if(!m_rng->is_seeded()) {
83 return m_rng->is_seeded();
95 return m_rng->reseed(srcs, poll_bits, poll_timeout);
98void AutoSeeded_RNG::fill_bytes_with_input(std::span<uint8_t> out, std::span<const uint8_t> in) {
100 m_rng->randomize_with_ts_input(out);
102 m_rng->randomize_with_input(out, in);
std::string name() const override
~AutoSeeded_RNG() override
AutoSeeded_RNG(size_t reseed_interval=BOTAN_RNG_DEFAULT_RESEED_INTERVAL)
bool is_seeded() const override
size_t reseed(Entropy_Sources &srcs, size_t poll_bits=BOTAN_RNG_RESEED_POLL_BITS, std::chrono::milliseconds poll_timeout=BOTAN_RNG_RESEED_DEFAULT_TIMEOUT) override
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(std::string_view algo_spec, std::string_view provider="")
#define BOTAN_HAS_SYSTEM_RNG
RandomNumberGenerator & system_rng()