Botan
1.11.15
|
#include <rng.h>
Public Member Functions | |
virtual void | add_entropy (const byte in[], size_t length)=0 |
virtual void | clear ()=0 |
virtual bool | is_seeded () const =0 |
virtual std::string | name () const =0 |
byte | next_byte () |
RandomNumberGenerator & | operator= (const RandomNumberGenerator &rng) |
virtual secure_vector< byte > | random_vec (size_t bytes) |
virtual void | randomize (byte output[], size_t length)=0 |
RandomNumberGenerator (const RandomNumberGenerator &rng) | |
RandomNumberGenerator () | |
virtual void | reseed (size_t bits_to_collect)=0 |
virtual | ~RandomNumberGenerator () |
Static Public Member Functions | |
static RandomNumberGenerator * | make_rng () |
Botan::RandomNumberGenerator::RandomNumberGenerator | ( | ) | [inline] |
virtual Botan::RandomNumberGenerator::~RandomNumberGenerator | ( | ) | [inline, virtual] |
virtual void Botan::RandomNumberGenerator::add_entropy | ( | const byte | in[], |
size_t | length | ||
) | [pure virtual] |
Add entropy to this RNG.
in | a byte array containg the entropy to be added |
length | the length of the byte array in |
Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.
virtual void Botan::RandomNumberGenerator::clear | ( | ) | [pure virtual] |
Clear all internally held values of this RNG.
Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.
virtual bool Botan::RandomNumberGenerator::is_seeded | ( | ) | const [pure virtual] |
Check whether this RNG is seeded.
Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::HMAC_DRBG, Botan::ANSI_X931_RNG, and Botan::AutoSeeded_RNG.
RandomNumberGenerator * Botan::RandomNumberGenerator::make_rng | ( | ) | [static] |
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(); }
virtual std::string Botan::RandomNumberGenerator::name | ( | ) | const [pure virtual] |
Return the name of this object
Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.
byte Botan::RandomNumberGenerator::next_byte | ( | ) | [inline] |
Return a random byte
Definition at line 53 of file rng.h.
Referenced by Botan::random_prime().
RandomNumberGenerator& Botan::RandomNumberGenerator::operator= | ( | const RandomNumberGenerator & | rng | ) |
virtual secure_vector<byte> Botan::RandomNumberGenerator::random_vec | ( | size_t | bytes | ) | [inline, virtual] |
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; }
virtual void Botan::RandomNumberGenerator::randomize | ( | byte | output[], |
size_t | length | ||
) | [pure virtual] |
Randomize a byte array.
output | the byte array to hold the random output. |
length | the length of the byte array output. |
Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::HMAC_DRBG, Botan::ANSI_X931_RNG, and Botan::AutoSeeded_RNG.
Referenced by botan_rng_get(), Botan::McEliece_PrivateKey::check_key(), Botan::McEliece_KEM_Encryptor::encrypt(), Botan::CryptoBox::encrypt(), Botan::generate_dsa_primes(), Botan::generate_passhash9(), Botan::TLS::make_hello_random(), Botan::random_code_element(), Botan::AutoSeeded_RNG::randomize(), Botan::RTSS_Share::split(), and Botan::TLS::write_record().
virtual void Botan::RandomNumberGenerator::reseed | ( | size_t | bits_to_collect | ) | [pure 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 |
Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.
Referenced by botan_rng_reseed().