Botan  1.11.15
Public Member Functions
Botan::Entropy_Accumulator Class Reference

#include <entropy_src.h>

List of all members.

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 ()

Detailed Description

Class used to accumulate the poll results of EntropySources

Definition at line 20 of file entropy_src.h.


Constructor & Destructor Documentation

Botan::Entropy_Accumulator::Entropy_Accumulator ( std::function< bool(const byte[], size_t, double)>  accum) [inline]

Initialize an Entropy_Accumulator

Parameters:
goalis 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.

{}

Member Function Documentation

void Botan::Entropy_Accumulator::add ( const void *  bytes,
size_t  length,
double  entropy_bits_per_byte 
) [inline]

Add entropy to the accumulator

Parameters:
bytesthe input bytes
lengthspecifies how many bytes the input is
entropy_bits_per_byteis 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);
         }
template<typename T >
void Botan::Entropy_Accumulator::add ( const T &  v,
double  entropy_bits_per_byte 
) [inline]

Add entropy to the accumulator

Parameters:
vis some value
entropy_bits_per_byteis 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)

Parameters:
sizerequested size for the I/O buffer
Returns:
cached I/O buffer for repeated polls

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;
         }
Returns:
if our polling goal has been achieved

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; }

The documentation for this class was generated from the following file: