9 #ifndef BOTAN_AEAD_CHACHA20_POLY1305_H__
10 #define BOTAN_AEAD_CHACHA20_POLY1305_H__
12 #include <botan/aead.h>
13 #include <botan/stream_cipher.h>
14 #include <botan/mac.h>
27 void set_associated_data(
const uint8_t ad[],
size_t ad_len)
override;
29 std::string
name()
const override {
return "ChaCha20Poly1305"; }
36 bool valid_nonce_length(
size_t n)
const override;
38 size_t tag_size()
const override {
return 16; }
40 void clear()
override;
42 void reset()
override;
51 size_t m_nonce_len = 0;
52 size_t m_ctext_len = 0;
55 void update_len(
size_t len);
57 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
override;
59 void key_schedule(
const uint8_t key[],
size_t length)
override;
69 {
return input_length + tag_size(); }
73 size_t process(uint8_t buf[],
size_t size)
override;
86 BOTAN_ASSERT(input_length >= tag_size(),
"Sufficient input");
87 return input_length - tag_size();
92 size_t process(uint8_t buf[],
size_t size)
override;
std::unique_ptr< MessageAuthenticationCode > m_poly1305
std::unique_ptr< StreamCipher > m_chacha
#define BOTAN_ASSERT(expr, assertion_made)
size_t minimum_final_size() const override
std::vector< T, secure_allocator< T >> secure_vector
size_t minimum_final_size() const override
size_t tag_size() const override
secure_vector< uint8_t > m_ad
bool cfrg_version() const
size_t output_length(size_t input_length) const override
size_t output_length(size_t input_length) const override
Key_Length_Specification key_spec() const override
std::string name() const override
size_t update_granularity() const override