| Botan
    1.10.16
    | 
#include <hmac_rng.h>
 
  
 | Public Member Functions | |
| void | add_entropy (const byte[], size_t) | 
| void | add_entropy_source (EntropySource *es) | 
| void | clear () | 
| HMAC_RNG (MessageAuthenticationCode *extractor, MessageAuthenticationCode *prf) | |
| bool | is_seeded () const | 
| std::string | name () const | 
| byte | next_byte () | 
| SecureVector< byte > | random_vec (size_t bytes) | 
| void | randomize (byte buf[], size_t len) | 
| void | reseed (size_t poll_bits) | 
| ~HMAC_RNG () | |
| Static Public Member Functions | |
| static RandomNumberGenerator * | make_rng () | 
HMAC_RNG - based on the design described in "On Extract-then-Expand Key Derivation Functions and an HMAC-based KDF" by Hugo Krawczyk (henceforce, 'E-t-E')
However it actually can be parameterized with any two MAC functions, not restricted to HMAC (this variation is also described in Krawczyk's paper), for instance one could use HMAC(SHA-512) as the extractor and CMAC(AES-256) as the PRF.
Definition at line 27 of file hmac_rng.h.
| Botan::HMAC_RNG::HMAC_RNG | ( | MessageAuthenticationCode * | extractor, | 
| MessageAuthenticationCode * | prf | ||
| ) | 
| extractor | a MAC used for extracting the entropy | 
| prf | a MAC used as a PRF using HKDF construction | 
Definition at line 169 of file hmac_rng.cpp.
References Botan::MessageAuthenticationCode::name(), Botan::Buffered_Computation::output_length(), Botan::SymmetricAlgorithm::set_key(), and Botan::SymmetricAlgorithm::valid_keylength().
| Botan::HMAC_RNG::~HMAC_RNG | ( | ) | 
Definition at line 217 of file hmac_rng.cpp.
| 
 | 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 129 of file hmac_rng.cpp.
References reseed(), and Botan::Buffered_Computation::update().
| 
 | virtual | 
Add this entropy source to the RNG object
| source | the entropy source which will be retained and used by RNG | 
Implements Botan::RandomNumberGenerator.
Definition at line 140 of file hmac_rng.cpp.
| 
 | virtual | 
Clear all internally held values of this RNG.
Implements Botan::RandomNumberGenerator.
Definition at line 148 of file hmac_rng.cpp.
References Botan::Algorithm::clear(), and Botan::zeroise().
| 
 | inlinevirtual | 
Check whether this RNG is seeded.
Reimplemented from Botan::RandomNumberGenerator.
Definition at line 31 of file hmac_rng.h.
Referenced by randomize().
| 
 | staticinherited | 
| 
 | virtual | 
Return the name of this object
Implements Botan::RandomNumberGenerator.
Definition at line 161 of file hmac_rng.cpp.
References Botan::MessageAuthenticationCode::name().
Referenced by randomize().
| 
 | inherited | 
Return a random byte
Definition at line 19 of file rng.cpp.
References Botan::RandomNumberGenerator::randomize().
| 
 | inlineinherited | 
Return a random vector
| bytes | number of bytes in the result | 
Definition at line 40 of file rng.h.
References Botan::MemoryRegion< T >::size().
Referenced by Botan::ANSI_X931_RNG::randomize().
| 
 | 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 38 of file hmac_rng.cpp.
References Botan::copy_mem(), is_seeded(), name(), and reseed().
| 
 | 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 66 of file hmac_rng.cpp.
References Botan::Entropy_Accumulator::bits_collected(), Botan::Buffered_Computation::final(), Botan::Entropy_Accumulator::polling_goal_achieved(), Botan::SymmetricAlgorithm::set_key(), Botan::Buffered_Computation::update(), and Botan::zeroise().
Referenced by add_entropy(), and randomize().
 1.8.13
 1.8.13