10#include <botan/tls_messages_12.h>
12#include <botan/tls_callbacks.h>
13#include <botan/tls_extensions_12.h>
14#include <botan/tls_policy.h>
15#include <botan/internal/tls_handshake_hash.h>
16#include <botan/internal/tls_handshake_io.h>
17#include <botan/internal/tls_messages_internal.h>
27 const std::vector<uint8_t>& reneg_info,
32 server_settings.protocol_version(),
39 m_data->extensions().add(new Extended_Master_Secret);
44 m_data->extensions().add(new Certificate_Status_Request);
48 m_data->extensions().add(new Application_Layer_Protocol_Notification(next_protocol));
54 m_data->extensions().add(new Encrypt_then_MAC);
58 m_data->extensions().add(new Supported_Point_Formats(policy.use_ecc_point_compression()));
62 m_data->extensions().add(new Renegotiation_Extension(reneg_info));
66 m_data->extensions().add(new Session_Ticket_Extension());
69 if(
m_data->legacy_version().is_datagram_protocol()) {
70 const std::vector<uint16_t> server_srtp = policy.srtp_profiles();
71 const std::vector<uint16_t> client_srtp = client_hello.srtp_profiles();
73 if(!server_srtp.empty() && !client_srtp.empty()) {
76 for(auto s_srtp : server_srtp) {
77 for(auto c_srtp : client_srtp) {
78 if(shared == 0 && s_srtp == c_srtp) {
85 m_data->extensions().add(new SRTP_Protection_Profiles(shared));
93 hash.update(io.send(*
this));
102 const std::vector<uint8_t>& reneg_info,
104 const Session& resumed_session,
105 bool offer_session_ticket,
110 resumed_session.ciphersuite_code(),
114 m_data->extensions().add(new Extended_Master_Secret);
118 m_data->extensions().add(new Application_Layer_Protocol_Notification(next_protocol));
122 const Ciphersuite c = resumed_session.ciphersuite();
123 if(c.cbc_ciphersuite()) {
124 m_data->extensions().add(new Encrypt_then_MAC);
128 if(resumed_session.ciphersuite().ecc_ciphersuite() &&
130 m_data->extensions().add(new Supported_Point_Formats(policy.use_ecc_point_compression()));
133 if(client_hello.secure_renegotiation()) {
134 m_data->extensions().add(new Renegotiation_Extension(reneg_info));
137 if(client_hello.supports_session_ticket() && offer_session_ticket) {
138 m_data->extensions().add(new Session_Ticket_Extension());
144 hash.update(io.send(*
this));
158 return reneg->renegotiation_info();
160 return std::vector<uint8_t>();
181 auto prof = srtp->profiles();
182 if(prof.size() != 1 || prof[0] == 0) {
183 throw Decoding_Error(
"Server sent malformed DTLS-SRTP extension");
193 return alpn->single_protocol();
200 return ecc_formats->prefers_compressed();
217 throw Decoding_Error(
"Server_Hello_Done: Must be empty, and is not");
225 return std::vector<uint8_t>();
static std::optional< Ciphersuite > by_id(uint16_t suite)
bool supports_encrypt_then_mac() const
bool supports_cert_status_message() const
bool secure_renegotiation() const
bool supports_extended_master_secret() const
bool supports_session_ticket() const
bool supports_alpn() const
std::set< Extension_Code > extension_types() const
void update(const uint8_t in[], size_t length)
virtual std::vector< uint8_t > send(const Handshake_Message &msg)=0
virtual std::vector< uint8_t > serialize() const =0
virtual bool negotiate_encrypt_then_mac() const
virtual bool support_cert_status_message() const
bool offer_session_ticket() const
bool supports_session_ticket() const
bool supports_extended_master_secret() const
bool prefers_compressed_ec_points() const
uint16_t srtp_profile() const
bool supports_encrypt_then_mac() const
bool supports_certificate_status_message() const
std::string next_protocol() const
std::vector< uint8_t > renegotiation_info() const
bool secure_renegotiation() const
Server_Hello_12(Handshake_IO &io, Handshake_Hash &hash, const Policy &policy, Callbacks &cb, RandomNumberGenerator &rng, const std::vector< uint8_t > &secure_reneg_info, const Client_Hello_12 &client_hello, const Settings &settings, std::string_view next_protocol)
Server_Hello_Done(Handshake_IO &io, Handshake_Hash &hash)
uint16_t ciphersuite() const
const Session_ID & session_id() const
std::unique_ptr< Server_Hello_Internal > m_data
std::vector< uint8_t > make_hello_random(RandomNumberGenerator &rng, Callbacks &cb, const Policy &policy)
std::vector< uint8_t > make_server_hello_random(RandomNumberGenerator &rng, Protocol_Version offered_version, Callbacks &cb, const Policy &policy)