Botan
1.11.15
|
#include <auto_rng.h>
Public Member Functions | |
void | add_entropy (const byte in[], size_t len) |
AutoSeeded_RNG () | |
void | clear () |
bool | is_seeded () const |
std::string | name () const |
byte | next_byte () |
virtual secure_vector< byte > | random_vec (size_t bytes) |
void | randomize (byte out[], size_t len) |
void | reseed (size_t poll_bits=256) |
Static Public Member Functions | |
static RandomNumberGenerator * | make_rng () |
Definition at line 16 of file auto_rng.h.
Botan::AutoSeeded_RNG::AutoSeeded_RNG | ( | ) | [inline] |
Definition at line 33 of file auto_rng.h.
: m_rng(RandomNumberGenerator::make_rng()) {}
void Botan::AutoSeeded_RNG::add_entropy | ( | const byte | in[], |
size_t | length | ||
) | [inline, virtual] |
Add entropy to this RNG.
in | a byte array containg the entropy to be added |
length | the length of the byte array in |
Implements Botan::RandomNumberGenerator.
Definition at line 30 of file auto_rng.h.
{ m_rng->add_entropy(in, len); }
void Botan::AutoSeeded_RNG::clear | ( | ) | [inline, virtual] |
Clear all internally held values of this RNG.
Implements Botan::RandomNumberGenerator.
Definition at line 24 of file auto_rng.h.
{ m_rng->clear(); }
bool Botan::AutoSeeded_RNG::is_seeded | ( | ) | const [inline, virtual] |
Check whether this RNG is seeded.
Implements Botan::RandomNumberGenerator.
Definition at line 22 of file auto_rng.h.
{ return m_rng->is_seeded(); }
RandomNumberGenerator * Botan::RandomNumberGenerator::make_rng | ( | ) | [static, inherited] |
Create a seeded and active RNG object for general application use Added in 1.8.0
Definition at line 14 of file rng.cpp.
{ std::unique_ptr<RandomNumberGenerator> rng( new HMAC_RNG(make_a<MessageAuthenticationCode>("HMAC(SHA-512)"), make_a<MessageAuthenticationCode>("HMAC(SHA-256)")) ); rng->reseed(256); return rng.release(); }
std::string Botan::AutoSeeded_RNG::name | ( | ) | const [inline, virtual] |
Return the name of this object
Implements Botan::RandomNumberGenerator.
Definition at line 26 of file auto_rng.h.
{ return m_rng->name(); }
byte Botan::RandomNumberGenerator::next_byte | ( | ) | [inline, inherited] |
Return a random byte
Definition at line 53 of file rng.h.
Referenced by Botan::random_prime().
virtual secure_vector<byte> Botan::RandomNumberGenerator::random_vec | ( | size_t | bytes | ) | [inline, virtual, inherited] |
Return a random vector
bytes | number of bytes in the result |
Definition at line 42 of file rng.h.
Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), Botan::TLS::Session::encrypt(), Botan::KeyPair::encryption_consistency_check(), Botan::generate_bcrypt(), Botan::mceies_encrypt(), Botan::OctetString::OctetString(), Botan::pbes2_encrypt(), Botan::BigInt::randomize(), Botan::TLS::Session_Manager_SQL::Session_Manager_SQL(), and Botan::KeyPair::signature_consistency_check().
{ secure_vector<byte> output(bytes); randomize(&output[0], output.size()); return output; }
void Botan::AutoSeeded_RNG::randomize | ( | byte | output[], |
size_t | length | ||
) | [inline, virtual] |
Randomize a byte array.
output | the byte array to hold the random output. |
length | the length of the byte array output. |
Implements Botan::RandomNumberGenerator.
Definition at line 19 of file auto_rng.h.
References Botan::RandomNumberGenerator::randomize().
{ m_rng->randomize(out, len); }
void Botan::AutoSeeded_RNG::reseed | ( | size_t | bits_to_collect = 256 | ) | [inline, virtual] |
Seed this RNG using the entropy sources it contains.
bits_to_collect | is the number of bits of entropy to attempt to gather from the entropy sources |
Implements Botan::RandomNumberGenerator.
Definition at line 28 of file auto_rng.h.
{ m_rng->reseed(poll_bits); }