Botan
1.11.15
|
#include <entropy_src.h>
Public Member Functions | |
virtual std::string | name () const =0 |
virtual void | poll (Entropy_Accumulator &accum)=0 |
virtual | ~EntropySource () |
Static Public Member Functions | |
static void | poll_available_sources (class Entropy_Accumulator &accum) |
Abstract interface to a source of entropy
Definition at line 84 of file entropy_src.h.
virtual Botan::EntropySource::~EntropySource | ( | ) | [inline, virtual] |
Definition at line 100 of file entropy_src.h.
{}
virtual std::string Botan::EntropySource::name | ( | ) | const [pure virtual] |
Implemented in Botan::UnixProcessInfo_EntropySource, Botan::ProcWalking_EntropySource, Botan::Unix_EntropySource, Botan::EGD_EntropySource, Botan::High_Resolution_Timestamp, Botan::Device_EntropySource, Botan::Win32_CAPI_EntropySource, Botan::Intel_Rdrand, and Botan::Win32_EntropySource.
virtual void Botan::EntropySource::poll | ( | Entropy_Accumulator & | accum | ) | [pure virtual] |
Perform an entropy gathering poll
accum | is an accumulator object that will be given entropy |
Implemented in Botan::UnixProcessInfo_EntropySource, Botan::ProcWalking_EntropySource, Botan::Unix_EntropySource, Botan::EGD_EntropySource, Botan::Device_EntropySource, Botan::High_Resolution_Timestamp, Botan::Win32_CAPI_EntropySource, Botan::Intel_Rdrand, and Botan::Win32_EntropySource.
void Botan::EntropySource::poll_available_sources | ( | class Entropy_Accumulator & | accum | ) | [static] |
Definition at line 108 of file entropy_srcs.cpp.
References Botan::Entropy_Accumulator::polling_goal_achieved().
Referenced by Botan::HMAC_RNG::reseed().
{ static std::vector<std::unique_ptr<EntropySource>> g_sources(get_default_entropy_sources()); if(g_sources.empty()) throw std::runtime_error("No entropy sources enabled at build time, poll failed"); size_t poll_attempt = 0; while(!accum.polling_goal_achieved() && poll_attempt < 16) { const size_t src_idx = poll_attempt % g_sources.size(); g_sources[src_idx]->poll(accum); ++poll_attempt; } }