9#ifndef BOTAN_TLS_RECORDS_H_
10#define BOTAN_TLS_RECORDS_H_
12#include <botan/assert.h>
13#include <botan/secmem.h>
14#include <botan/tls_algos.h>
15#include <botan/tls_magic.h>
16#include <botan/tls_version.h>
49 std::span<uint8_t>
get() {
return std::span{m_nonce}.first(m_len); }
51 std::span<const uint8_t>
get()
const {
return std::span{m_nonce}.first(m_len); }
54 std::array<uint8_t, MAX_NONCE_LEN> m_nonce{};
71 bool uses_encrypt_then_mac);
90 std::array<uint8_t, 13>
format_ad(uint64_t seq,
93 uint16_t ptext_length);
102 std::unique_ptr<AEAD_Mode> m_aead;
104 std::vector<uint8_t> m_nonce;
106 size_t m_nonce_bytes_from_handshake;
107 size_t m_nonce_bytes_from_record;
117 size_t needed()
const {
return m_needed; }
154 Protocol_Version record_version,
155 uint64_t record_sequence,
156 const uint8_t* message,
172 Protocol_Version record_version,
173 uint64_t record_sequence,
174 const uint8_t* message,
176 Connection_Cipher_State& cipherstate,
188 const uint8_t input[],
194 bool allow_epoch0_restart);
#define BOTAN_ASSERT_NOMSG(expr)
#define BOTAN_ASSERT_NONNULL(ptr)
#define BOTAN_ARG_CHECK(expr, msg)
Record_Nonce aead_nonce(uint64_t seq, RandomNumberGenerator &rng) const
Connection_Cipher_State(const Connection_Cipher_State &other)=delete
size_t nonce_bytes_from_record() const
Nonce_Format nonce_format() const
size_t nonce_bytes_from_handshake() const
Connection_Cipher_State & operator=(Connection_Cipher_State &&other)=delete
~Connection_Cipher_State()
std::array< uint8_t, 13 > format_ad(uint64_t seq, Record_Type type, Protocol_Version version, uint16_t ptext_length)
Connection_Cipher_State(Protocol_Version version, Connection_Side which_side, bool is_our_side, const Ciphersuite &suite, const Session_Keys &keys, bool uses_encrypt_then_mac)
Connection_Cipher_State(Connection_Cipher_State &&other)=delete
Connection_Cipher_State & operator=(const Connection_Cipher_State &other)=delete
static constexpr size_t MAX_NONCE_LEN
std::span< const uint8_t > get() const
std::span< uint8_t > get()
void write_unencrypted_record(secure_vector< uint8_t > &output, Record_Type record_type, Protocol_Version version, uint64_t record_sequence, const uint8_t *message, size_t message_len)
std::function< std::shared_ptr< Connection_Cipher_State >(uint16_t)> get_cipherstate_fn
void write_record(secure_vector< uint8_t > &output, Record_Type record_type, Protocol_Version version, uint64_t record_sequence, const uint8_t *message, size_t message_len, Connection_Cipher_State &cs, RandomNumberGenerator &rng)
Record_Header read_record(TLS_Flavor flavor, secure_vector< uint8_t > &readbuf, const uint8_t input[], size_t input_len, size_t &consumed, secure_vector< uint8_t > &recbuf, Connection_Sequence_Numbers *sequence_numbers, const get_cipherstate_fn &get_cipherstate, bool allow_epoch0_restart)
std::vector< T, secure_allocator< T > > secure_vector