13#include <botan/tls_messages.h>
14#include <botan/internal/tls_messages_internal.h>
16#include <botan/tls_alert.h>
17#include <botan/tls_exceptn.h>
18#include <botan/tls_policy.h>
19#include <botan/internal/ct_utils.h>
20#include <botan/internal/tls_reader.h>
42 const auto lastbytes = std::span{random}.last(downgrade_signal_length);
56 const uint8_t major_version = reader.
get_byte();
57 const uint8_t minor_version = reader.
get_byte();
77 m_extensions.deserialize(reader,
92 return (
extensions().has<Supported_Versions>()) ? Protocol_Version::TLS_V13 : m_legacy_version;
106 std::vector<uint8_t> buf;
109 buf.push_back(
m_data->legacy_version().major_version());
110 buf.push_back(
m_data->legacy_version().minor_version());
118 buf.push_back(
m_data->comp_method());
130 return m_data->legacy_version();
138 return m_data->comp_method();
142 return m_data->session_id();
146 return m_data->ciphersuite();
150 return m_data->extensions().extension_types();
154 return m_data->extensions();
162 if(!
m_data->version().is_pre_tls_13()) {
163 throw TLS_Exception(Alert::ProtocolVersion,
"Expected server hello of (D)TLS 1.2 or lower");
174 return Protocol_Version::TLS_V11;
177 return Protocol_Version::TLS_V12;
#define BOTAN_ASSERT_NOMSG(expr)
virtual bool allow_tls13() const
bool is_pre_tls_13() const
Server_Hello_12_Shim(const std::vector< uint8_t > &buf)
Protocol_Version selected_version() const final
std::optional< Protocol_Version > random_signals_downgrade() const
Server_Hello_Internal(const std::vector< uint8_t > &buf)
const Extensions & extensions() const
Protocol_Version version() const
Server_Hello(const Server_Hello &)=delete
uint16_t ciphersuite() const
std::vector< uint8_t > serialize() const override
std::set< Extension_Code > extension_types() const
Handshake_Type type() const override
const Session_ID & session_id() const
const std::vector< uint8_t > & random() const
uint8_t compression_method() const
std::unique_ptr< Server_Hello_Internal > m_data
const Extensions & extensions() const
Protocol_Version legacy_version() const
std::vector< T > get_range(size_t len_bytes, size_t min_elems, size_t max_elems)
std::vector< T > get_fixed(size_t size)
constexpr CT::Mask< T > is_equal(const T x[], const T y[], size_t len)
constexpr uint64_t DOWNGRADE_TLS12
void append_tls_length_value(std::vector< uint8_t, Alloc > &buf, const T *vals, size_t vals_size, size_t tag_size)
std::vector< uint8_t > make_hello_random(RandomNumberGenerator &rng, Callbacks &cb, const Policy &policy)
Strong< std::vector< uint8_t >, struct Session_ID_ > Session_ID
holds a TLS 1.2 session ID for stateful resumption
std::vector< uint8_t > make_server_hello_random(RandomNumberGenerator &rng, Protocol_Version offered_version, Callbacks &cb, const Policy &policy)
constexpr uint64_t DOWNGRADE_TLS11
constexpr std::array< uint8_t, 32 > HELLO_RETRY_REQUEST_MARKER
constexpr uint8_t get_byte(T input)
constexpr auto store_be(ParamTs &&... params)
constexpr auto load_be(ParamTs &&... params)