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>
25 std::string
name()
const final;
27 void set_associated_data_n(
size_t idx, std::span<const uint8_t> ad)
override;
29 size_t update_granularity()
const final;
31 size_t ideal_granularity()
const final;
35 bool valid_nonce_length(
size_t nl)
const final;
45 bool has_keying_material() const
final;
54 bool use_encrypt_then_mac);
56 size_t cipher_keylen()
const {
return m_cipher_keylen; }
60 size_t iv_size()
const {
return m_iv_size; }
81 std::vector<uint8_t> assoc_data_with_len(uint16_t len);
84 void start_msg(
const uint8_t nonce[],
size_t nonce_len)
final;
85 size_t process_msg(uint8_t buf[],
size_t sz)
final;
87 void key_schedule(std::span<const uint8_t> key)
final;
90 const std::string m_mac_name;
91 size_t m_cipher_keylen;
96 bool m_use_encrypt_then_mac;
99 std::unique_ptr<Cipher_Mode> m_cbc;
100 std::unique_ptr<MessageAuthenticationCode> m_mac;
103 std::vector<uint8_t> m_ad;
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) {}
128 void set_associated_data_n(
size_t idx, std::span<const uint8_t> ad)
override;
130 size_t output_length(
size_t input_length)
const override;
147 std::unique_ptr<MessageAuthenticationCode> mac,
148 const size_t cipher_keylen,
149 const size_t mac_keylen,
151 bool use_encrypt_then_mac) :
158 use_encrypt_then_mac) {}
160 size_t output_length(
size_t input_length)
const override;
167 void cbc_decrypt_record(uint8_t record_contents[],
size_t record_len);
169 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
size_t default_nonce_length() const final
bool use_encrypt_then_mac() const
bool is_datagram_protocol() const
std::vector< uint8_t > & assoc_data()
secure_vector< uint8_t > & msg()
MessageAuthenticationCode & mac() const
Cipher_Mode & cbc() const
size_t tag_size() const 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