Botan  1.11.15
Public Member Functions | Static Public Member Functions
Botan::EntropySource Class Reference

#include <entropy_src.h>

Inheritance diagram for Botan::EntropySource:
Botan::BeOS_EntropySource Botan::Device_EntropySource Botan::EGD_EntropySource Botan::High_Resolution_Timestamp Botan::Intel_Rdrand Botan::ProcWalking_EntropySource Botan::Unix_EntropySource Botan::UnixProcessInfo_EntropySource Botan::Win32_CAPI_EntropySource Botan::Win32_EntropySource

List of all members.

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)

Detailed Description

Abstract interface to a source of entropy

Definition at line 84 of file entropy_src.h.


Constructor & Destructor Documentation

virtual Botan::EntropySource::~EntropySource ( ) [inline, virtual]

Definition at line 100 of file entropy_src.h.

{}

Member Function Documentation

virtual std::string Botan::EntropySource::name ( ) const [pure virtual]
virtual void Botan::EntropySource::poll ( Entropy_Accumulator accum) [pure virtual]

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

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