9 #ifndef BOTAN_AEAD_GCM_H__
10 #define BOTAN_AEAD_GCM_H__
12 #include <botan/aead.h>
13 #include <botan/block_cipher.h>
14 #include <botan/stream_cipher.h>
26 void set_associated_data(
const uint8_t ad[],
size_t ad_len)
override;
28 std::string name()
const override;
30 size_t update_granularity()
const override;
37 size_t tag_size()
const override {
return m_tag_size; }
39 void clear()
override;
41 void reset()
override;
43 std::string provider()
const override;
47 const size_t m_BS = 16;
52 std::unique_ptr<StreamCipher>
m_ctr;
55 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
override;
57 void key_schedule(
const uint8_t key[],
size_t length)
override;
74 {
return input_length + tag_size(); }
78 size_t process(uint8_t buf[],
size_t size)
override;
98 BOTAN_ASSERT(input_length >= tag_size(),
"Sufficient input");
99 return input_length - tag_size();
104 size_t process(uint8_t buf[],
size_t size)
override;
116 void set_associated_data(
const uint8_t ad[],
size_t ad_len);
120 void start(
const uint8_t nonce[],
size_t len);
125 void update(
const uint8_t in[],
size_t len);
132 void clear()
override;
136 std::string
name()
const override {
return "GHASH"; }
139 const uint8_t input[],
size_t input_len);
142 size_t ad_len,
size_t pt_len);
150 void key_schedule(
const uint8_t key[],
size_t key_len)
override;
155 size_t m_text_len = 0;
secure_vector< uint8_t > m_H
secure_vector< uint8_t > m_ghash
std::unique_ptr< StreamCipher > m_ctr
Key_Length_Specification key_spec() const override
GCM_Decryption(BlockCipher *cipher, size_t tag_size=16)
size_t minimum_final_size() const override
#define BOTAN_ASSERT(expr, assertion_made)
std::vector< T, secure_allocator< T >> secure_vector
size_t output_length(size_t input_length) const override
GCM_Encryption(BlockCipher *cipher, size_t tag_size=16)
const std::string m_cipher_name
secure_vector< uint8_t > m_H_ad
size_t tag_size() const override
std::unique_ptr< GHASH > m_ghash
size_t minimum_final_size() const override
std::string name() const override
size_t output_length(size_t input_length) const override
bool valid_nonce_length(size_t) const override