8#include <botan/chacha_rng.h>
28 size_t reseed_interval) :
38 size_t reseed_interval) :
39 Stateful_RNG(underlying_rng, entropy_sources, reseed_interval)
47 size_t reseed_interval) :
55void ChaCha_RNG::clear_state()
57 m_hmac->set_key(std::vector<uint8_t>(m_hmac->output_length(), 0x00));
58 m_chacha->set_key(m_hmac->final());
61void ChaCha_RNG::generate_output(uint8_t output[],
size_t output_len,
62 const uint8_t input[],
size_t input_len)
69 m_chacha->write_keystream(output, output_len);
72void ChaCha_RNG::update(
const uint8_t input[],
size_t input_len)
74 m_hmac->update(input, input_len);
75 m_chacha->set_key(m_hmac->final());
77 secure_vector<uint8_t> mac_key(m_hmac->output_length());
78 m_chacha->write_keystream(mac_key.data(), mac_key.size());
79 m_hmac->set_key(mac_key);
size_t security_level() const override
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(const std::string &algo_spec, const std::string &provider="")
void clear() override final
void add_entropy(const uint8_t input[], size_t input_len) override final
static std::unique_ptr< StreamCipher > create_or_throw(const std::string &algo_spec, const std::string &provider="")
int(* update)(CTX *, const void *, CC_LONG len)
std::vector< T, secure_allocator< T > > secure_vector