8#include <botan/chacha_rng.h>
34 size_t reseed_interval) :
35 Stateful_RNG(underlying_rng, entropy_sources, reseed_interval) {
48void ChaCha_RNG::clear_state() {
49 m_hmac->set_key(std::vector<uint8_t>(m_hmac->output_length(), 0x00));
50 m_chacha->set_key(m_hmac->final());
53void ChaCha_RNG::generate_output(std::span<uint8_t> output, std::span<const uint8_t> input) {
60 m_chacha->write_keystream(output);
63void ChaCha_RNG::update(std::span<const uint8_t> input) {
64 m_hmac->update(input);
65 m_chacha->set_key(m_hmac->final());
66 const auto mac_key = m_chacha->keystream_bytes(m_hmac->output_length());
67 m_hmac->set_key(mac_key);
#define BOTAN_ASSERT_NOMSG(expr)
size_t security_level() const override
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(std::string_view algo_spec, std::string_view provider="")
void add_entropy(std::span< const uint8_t > input)
static std::unique_ptr< StreamCipher > create_or_throw(std::string_view algo_spec, std::string_view provider="")
int(* update)(CTX *, const void *, CC_LONG len)