Botan
1.11.15
|
#include <entropy_src.h>
Public Member Functions | |
void | add (const void *bytes, size_t length, double entropy_bits_per_byte) |
template<typename T > | |
void | add (const T &v, double entropy_bits_per_byte) |
Entropy_Accumulator (std::function< bool(const byte[], size_t, double)> accum) | |
secure_vector< byte > & | get_io_buffer (size_t size) |
bool | polling_goal_achieved () const |
virtual | ~Entropy_Accumulator () |
Class used to accumulate the poll results of EntropySources
Definition at line 20 of file entropy_src.h.
Botan::Entropy_Accumulator::Entropy_Accumulator | ( | std::function< bool(const byte[], size_t, double)> | accum | ) | [inline] |
Initialize an Entropy_Accumulator
goal | is how many bits we would like to collect |
Definition at line 27 of file entropy_src.h.
:
m_accum_fn(accum), m_done(false) {}
virtual Botan::Entropy_Accumulator::~Entropy_Accumulator | ( | ) | [inline, virtual] |
Definition at line 30 of file entropy_src.h.
{}
void Botan::Entropy_Accumulator::add | ( | const void * | bytes, |
size_t | length, | ||
double | entropy_bits_per_byte | ||
) | [inline] |
Add entropy to the accumulator
bytes | the input bytes |
length | specifies how many bytes the input is |
entropy_bits_per_byte | is a best guess at how much entropy per byte is in this input |
Definition at line 58 of file entropy_src.h.
Referenced by Botan::Win32_EntropySource::poll(), Botan::Intel_Rdrand::poll(), Botan::Win32_CAPI_EntropySource::poll(), Botan::High_Resolution_Timestamp::poll(), Botan::Device_EntropySource::poll(), Botan::EGD_EntropySource::poll(), Botan::Unix_EntropySource::poll(), Botan::ProcWalking_EntropySource::poll(), and Botan::UnixProcessInfo_EntropySource::poll().
{ m_done = m_accum_fn(reinterpret_cast<const byte*>(bytes), length, entropy_bits_per_byte * length); }
void Botan::Entropy_Accumulator::add | ( | const T & | v, |
double | entropy_bits_per_byte | ||
) | [inline] |
Add entropy to the accumulator
v | is some value |
entropy_bits_per_byte | is a best guess at how much entropy per byte is in this input |
Definition at line 71 of file entropy_src.h.
{ add(&v, sizeof(T), entropy_bits_per_byte); }
secure_vector<byte>& Botan::Entropy_Accumulator::get_io_buffer | ( | size_t | size | ) | [inline] |
Get a cached I/O buffer (purely for minimizing allocation overhead to polls)
size | requested size for the I/O buffer |
Definition at line 39 of file entropy_src.h.
Referenced by Botan::Win32_CAPI_EntropySource::poll(), Botan::Device_EntropySource::poll(), Botan::EGD_EntropySource::poll(), Botan::Unix_EntropySource::poll(), and Botan::ProcWalking_EntropySource::poll().
{
m_io_buffer.clear();
m_io_buffer.resize(size);
return m_io_buffer;
}
bool Botan::Entropy_Accumulator::polling_goal_achieved | ( | ) | const [inline] |
Definition at line 49 of file entropy_src.h.
Referenced by Botan::Win32_EntropySource::poll(), Botan::Unix_EntropySource::poll(), Botan::ProcWalking_EntropySource::poll(), and Botan::EntropySource::poll_available_sources().
{ return m_done; }