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>
15#include <botan/tls_version.h>
28 std::string
name()
const override final;
30 void set_associated_data_n(
size_t idx, std::span<const uint8_t> ad)
override;
32 size_t update_granularity()
const override final;
34 size_t ideal_granularity()
const override final;
38 bool valid_nonce_length(
size_t nl)
const override final;
44 void clear() override
final;
46 void reset() override
final;
48 bool has_keying_material() const override
final;
56 bool use_encrypt_then_mac);
58 size_t cipher_keylen()
const {
return m_cipher_keylen; }
60 size_t iv_size()
const {
return m_iv_size; }
79 std::vector<uint8_t> assoc_data_with_len(uint16_t len);
82 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
override final;
83 size_t process_msg(uint8_t buf[],
size_t sz)
override final;
85 void key_schedule(
const uint8_t key[],
size_t length)
override final;
88 const std::string m_mac_name;
89 size_t m_cipher_keylen;
94 bool m_use_encrypt_then_mac;
97 std::unique_ptr<Cipher_Mode> m_cbc;
98 std::unique_ptr<MessageAuthenticationCode> m_mac;
101 std::vector<uint8_t> m_ad;
114 std::unique_ptr<BlockCipher> cipher,
115 std::unique_ptr<MessageAuthenticationCode> mac,
116 const size_t cipher_keylen,
117 const size_t mac_keylen,
119 bool use_encrypt_then_mac) :
126 use_encrypt_then_mac)
129 void set_associated_data_n(
size_t idx, std::span<const uint8_t> ad)
override;
131 size_t output_length(
size_t input_length)
const override;
138 size_t padding_length);
150 std::unique_ptr<MessageAuthenticationCode> mac,
151 const size_t cipher_keylen,
152 const size_t mac_keylen,
154 bool use_encrypt_then_mac) :
161 use_encrypt_then_mac)
164 size_t output_length(
size_t input_length)
const override;
171 void cbc_decrypt_record(uint8_t record_contents[],
size_t record_len);
173 void perform_additional_compressions(
size_t plen,
size_t padlen);
#define BOTAN_ASSERT_NONNULL(ptr)
TLS_CBC_HMAC_AEAD_Decryption(std::unique_ptr< BlockCipher > cipher, std::unique_ptr< MessageAuthenticationCode > mac, const size_t cipher_keylen, const size_t mac_keylen, const Protocol_Version version, bool use_encrypt_then_mac)
size_t minimum_final_size() const override
TLS_CBC_HMAC_AEAD_Encryption(std::unique_ptr< BlockCipher > cipher, std::unique_ptr< MessageAuthenticationCode > mac, const size_t cipher_keylen, const size_t mac_keylen, const Protocol_Version version, bool use_encrypt_then_mac)
size_t minimum_final_size() const override
size_t block_size() const
secure_vector< uint8_t > & cbc_state()
size_t mac_keylen() const
bool use_encrypt_then_mac() const
bool is_datagram_protocol() const
std::vector< uint8_t > & assoc_data()
secure_vector< uint8_t > & msg()
size_t tag_size() const override final
MessageAuthenticationCode & mac() const
Cipher_Mode & cbc() const
size_t default_nonce_length() const override final
std::string m_cipher_name
int(* final)(unsigned char *, CTX *)
uint16_t check_tls_cbc_padding(const uint8_t record[], size_t record_len)
std::vector< T, secure_allocator< T > > secure_vector