9 #ifndef BOTAN_TLS_CBC_HMAC_AEAD_H__
10 #define BOTAN_TLS_CBC_HMAC_AEAD_H__
12 #include <botan/aead.h>
13 #include <botan/block_cipher.h>
14 #include <botan/mac.h>
27 size_t process(uint8_t buf[],
size_t sz)
override final;
29 std::string name()
const override final;
31 void set_associated_data(
const uint8_t ad[],
size_t ad_len)
override;
33 size_t update_granularity()
const override final;
37 bool valid_nonce_length(
size_t nl)
const override final;
39 size_t tag_size() const override final {
return m_tag_size; }
43 void clear() override final;
45 void reset() override final;
50 const
std::
string& mac_name,
53 bool use_encrypt_then_mac);
55 size_t cipher_keylen()
const {
return m_cipher_keylen; }
57 size_t iv_size()
const {
return m_iv_size; }
78 std::vector<uint8_t> assoc_data_with_len(uint16_t len);
81 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
override final;
83 void key_schedule(
const uint8_t key[],
size_t length)
override final;
86 const std::string m_mac_name;
87 size_t m_cipher_keylen;
92 bool m_use_encrypt_then_mac;
94 std::unique_ptr<BlockCipher> m_cipher;
95 std::unique_ptr<MessageAuthenticationCode>
m_mac;
98 std::vector<uint8_t> m_ad;
111 const size_t cipher_keylen,
112 const std::string& mac_algo,
113 const size_t mac_keylen,
114 bool use_explicit_iv,
115 bool use_encrypt_then_mac) :
121 use_encrypt_then_mac)
124 void set_associated_data(
const uint8_t ad[],
size_t ad_len)
override;
126 size_t output_length(
size_t input_length)
const override;
132 void cbc_encrypt_record(uint8_t record_contents[],
size_t record_len);
144 const size_t cipher_keylen,
145 const std::string& mac_algo,
146 const size_t mac_keylen,
147 bool use_explicit_iv,
148 bool use_encrypt_then_mac) :
154 use_encrypt_then_mac)
157 size_t output_length(
size_t input_length)
const override;
164 void cbc_decrypt_record(uint8_t record_contents[],
size_t record_len);
166 void perform_additional_compressions(
size_t plen,
size_t padlen);
BlockCipher & cipher() const
std::unique_ptr< MessageAuthenticationCode > m_mac
std::string m_cipher_name
TLS_CBC_HMAC_AEAD_Decryption(const std::string &cipher_algo, const size_t cipher_keylen, const std::string &mac_algo, const size_t mac_keylen, bool use_explicit_iv, bool use_encrypt_then_mac)
size_t block_size() const
size_t tag_size() const overridefinal
MessageAuthenticationCode & mac() const
secure_vector< uint8_t > & cbc_state()
size_t minimum_final_size() const override
std::vector< T, secure_allocator< T >> secure_vector
#define BOTAN_ASSERT_NONNULL(ptr)
size_t mac_keylen() const
TLS_CBC_HMAC_AEAD_Encryption(const std::string &cipher_algo, const size_t cipher_keylen, const std::string &mac_algo, const size_t mac_keylen, bool use_explicit_iv, bool use_encrypt_then_mac)
std::vector< uint8_t > & assoc_data()
size_t minimum_final_size() const override
bool use_encrypt_then_mac() const
secure_vector< uint8_t > & msg()
size_t default_nonce_length() const overridefinal