|
Botan 3.14.1
Crypto and TLS for C&
|
#include <entropy_src.h>
Public Member Functions | |
| size_t | _gather (Entropy_Accumulator &acc) |
| size_t | _gather_just (Entropy_Accumulator &acc, std::string_view src) |
| void | add_source (std::unique_ptr< Entropy_Source > src) |
| std::vector< std::string > | enabled_sources () const |
| Entropy_Sources ()=default | |
| Entropy_Sources (const Entropy_Sources &other)=delete | |
| Entropy_Sources (const std::vector< std::string > &sources) | |
| Entropy_Sources (Entropy_Sources &&other)=delete | |
| Entropy_Sources & | operator= (const Entropy_Sources &other)=delete |
| Entropy_Sources & | operator= (Entropy_Sources &&other)=delete |
| size_t | poll (RandomNumberGenerator &rng, size_t bits) |
| size_t | poll (RandomNumberGenerator &rng, size_t bits, std::chrono::milliseconds timeout) |
| size_t | poll_just (RandomNumberGenerator &rng, std::string_view src) |
| ~Entropy_Sources ()=default | |
Static Public Member Functions | |
| static Entropy_Sources & | global_sources () |
A collection of entropy sources which can be polled together
Definition at line 167 of file entropy_src.h.
|
default |
Create an empty collection of entropy sources
References Entropy_Sources().
Referenced by Entropy_Sources(), Entropy_Sources(), Entropy_Sources(), global_sources(), operator=(), and operator=().
|
explicit |
Create a collection containing the named entropy sources
| sources | the names of the sources to enable |
Definition at line 341 of file entropy_srcs.cpp.
References add_source(), and Botan::Entropy_Source::create().
|
delete |
References Entropy_Sources().
|
delete |
References Entropy_Sources().
|
default |
| size_t Botan::Entropy_Sources::_gather | ( | Entropy_Accumulator & | acc | ) |
Poll all sources into acc until its goal is reached
This should not be called by applications and is not covered by SemVer
Definition at line 281 of file entropy_srcs.cpp.
References Botan::Entropy_Accumulator::bits_collected(), and Botan::Entropy_Accumulator::goal_reached().
Referenced by poll(), Botan::RandomNumberGenerator::reseed_from_sources(), and Botan::Stateful_RNG::reseed_from_sources().
| size_t Botan::Entropy_Sources::_gather_just | ( | Entropy_Accumulator & | acc, |
| std::string_view | src ) |
Poll just a single named source into acc. Ordinally only used for testing
This should not be called by applications and is not covered by SemVer
Definition at line 295 of file entropy_srcs.cpp.
References Botan::Entropy_Accumulator::bits_collected().
Referenced by poll_just().
| void Botan::Entropy_Sources::add_source | ( | std::unique_ptr< Entropy_Source > | src | ) |
Add an entropy source to this collection
| src | the source to add |
Definition at line 266 of file entropy_srcs.cpp.
Referenced by Entropy_Sources().
| std::vector< std::string > Botan::Entropy_Sources::enabled_sources | ( | ) | const |
List the entropy sources in this collection
Definition at line 272 of file entropy_srcs.cpp.
|
static |
Access the process-wide set of entropy sources used by default
Definition at line 347 of file entropy_srcs.cpp.
References Entropy_Sources().
Referenced by Botan::AutoSeeded_RNG::AutoSeeded_RNG().
|
delete |
References Entropy_Sources().
|
delete |
References Entropy_Sources().
| size_t Botan::Entropy_Sources::poll | ( | RandomNumberGenerator & | rng, |
| size_t | bits ) |
Poll all sources to collect bits of entropy. Entropy collection is aborted as soon as the requested number of bits are obtained.
The data is mixed into rng without affecting its seeded state. To seed an RNG from entropy sources use RandomNumberGenerator::reseed_from
Definition at line 331 of file entropy_srcs.cpp.
References _gather().
| size_t Botan::Entropy_Sources::poll | ( | RandomNumberGenerator & | rng, |
| size_t | bits, | ||
| std::chrono::milliseconds | timeout ) |
Poll all sources to collect bits of entropy with a timeout. Entropy collection is aborted as soon as either the requested number of bits are obtained or the timeout runs out. If the target system does not provide a clock, the timeout is ignored.
Note that the timeout is cooperative. If the poll() method of an entropy source blocks forever, this invocation will potentially also block.
TODO(Botan4) remove this variant, and the <chrono> include above
Definition at line 307 of file entropy_srcs.cpp.
References Botan::Entropy_Accumulator::bits_collected(), and Botan::Entropy_Accumulator::goal_reached().
| size_t Botan::Entropy_Sources::poll_just | ( | RandomNumberGenerator & | rng, |
| std::string_view | src ) |
Poll just a single named source. Ordinally only used for testing
The data is mixed into rng without affecting its seeded state.
Definition at line 336 of file entropy_srcs.cpp.
References _gather_just(), and Botan::RandomNumberGenerator::DefaultPollBits.