112 s3->
hs->config->handoff =
false;
140 ssl->
config->cipher_list ? ssl->
config->cipher_list->ciphers.get()
141 : ssl->
ctx->cipher_list->ciphers.get();
143 for (
const SSL_CIPHER *configured_cipher : configured) {
152 ssl->
config->cipher_list = bssl::MakeUnique<SSLCipherPreferenceList>();
153 if (!ssl->
config->cipher_list->Init(*ssl->
ctx->cipher_list)) {
157 for (
const SSL_CIPHER *unsupported_cipher : unsupported.get()) {
158 ssl->
config->cipher_list->Remove(unsupported_cipher);
169 if (!supported_curves.
Init(
CBS_len(&curves) / 2)) {
178 supported_curves[
idx++] = curve;
183 if (!new_configured_curves.
Init(configured_curves.
size())) {
187 for (
uint16_t configured_curve : configured_curves) {
189 for (
uint16_t supported_curve : supported_curves) {
190 if (supported_curve == configured_curve) {
196 new_configured_curves[
idx++] = configured_curve;
211 bool supports_alps =
false;
220 supports_alps =
true;
224 if (!supports_alps) {
225 ssl->
config->alps_configs.clear();
235 ssl->
config->quic_transport_params.size() > 0 || ssl->
ctx->ech_keys;
243 CBS seq, handoff_cbs(handoff);
251 CBS transcript, hs_buf;
270 if (
CBS_len(&transcript) != 0) {
271 s3->
hs->transcript.Update(transcript);
274 s3->
hs->handback =
true;
306 size_t hostname_len = 0;
308 hostname_len = strlen(s3->
hostname.get());
313 transcript = s3->
hs->transcript.buffer();
315 size_t write_iv_len = 0;
316 const uint8_t *write_iv =
nullptr;
324 size_t read_iv_len = 0;
325 const uint8_t *read_iv =
nullptr;
341 static const uint8_t kUnusedChannelID[64] = {0};
366 sizeof(kUnusedChannelID)) ||
381 !s3->
hs->key_shares[0]->Serialize(&key_share)) {
449 uint64_t handback_version, unused_token_binding_param, cipher, type_u64;
451 CBS seq, read_seq, write_seq, server_rand, client_rand, read_iv, write_iv,
452 next_proto, alpn, hostname, unused_channel_id, transcript, key_share;
453 int session_reused, channel_id_negotiated, cert_request,
454 extended_master_secret, ticket_expected, unused_token_binding,
458 CBS handback_cbs(handback);
520 CBS client_handshake_secret, server_handshake_secret, client_traffic_secret_0,
521 server_traffic_secret_0, secret, exporter_secret, early_traffic_secret;
523 int used_hello_retry_request, accept_psk_mode;
524 uint64_t early_data, early_data_reason;
555 static_cast<ssl_early_data_reason_t
>(early_data_reason);
560 switch (early_data_type) {
597 if (!session_reused) {
603 if (session_reused) {
622 const size_t hostname_len =
CBS_len(&hostname);
623 if (hostname_len == 0) {
626 char *hostname_str =
nullptr;
711 using namespace bssl;
725 size_t client_hello_len,
727 size_t capabilities_len) {
735 UniquePtr<SSL_HANDSHAKE_HINTS> hints = MakeUnique<SSL_HANDSHAKE_HINTS>();
736 if (hints ==
nullptr ||
747 ScopedCBB client_hello_cbb;
748 CBB client_hello_body;
749 if (!ssl->
method->init_message(ssl, client_hello_cbb.get(),
751 !
CBB_add_bytes(&client_hello_body, client_hello, client_hello_len) ||
752 !ssl->
method->finish_message(ssl, client_hello_cbb.get(),
753 &client_hello_msg)) {
759 client_hello_msg.
size())) {
763 s3->
hs->hints_requested =
true;
896 UniquePtr<SSL_HANDSHAKE_HINTS> hints_obj = MakeUnique<SSL_HANDSHAKE_HINTS>();
897 if (hints_obj ==
nullptr) {
901 CBS cbs, seq, server_random, key_share, signature_hint, ticket, ignore_psk,
903 int has_server_random, has_key_share, has_signature_hint, has_ticket,
904 has_ignore_psk, has_cert_compression;
922 if (has_server_random && !hints_obj->server_random.CopyFrom(server_random)) {
930 group_id == 0 || group_id > 0xffff ||
932 !hints_obj->key_share_public_key.CopyFrom(
public_key) ||
934 !hints_obj->key_share_secret.CopyFrom(secret)) {
938 hints_obj->key_share_group_id =
static_cast<uint16_t>(group_id);
941 if (has_signature_hint) {
945 sig_alg == 0 || sig_alg > 0xffff ||
947 !hints_obj->signature_input.CopyFrom(
input) ||
949 !hints_obj->signature_spki.CopyFrom(spki) ||
951 !hints_obj->signature.CopyFrom(signature)) {
955 hints_obj->signature_algorithm =
static_cast<uint16_t>(sig_alg);
958 if (has_ticket && !hints_obj->decrypted_psk.CopyFrom(ticket)) {
962 if (has_ignore_psk) {
963 if (
CBS_len(&ignore_psk) != 0) {
966 hints_obj->ignore_psk =
true;
969 if (has_cert_compression) {
973 alg == 0 || alg > 0xffff ||
975 !hints_obj->cert_compression_input.CopyFrom(
input) ||
977 !hints_obj->cert_compression_output.CopyFrom(
output)) {
981 hints_obj->cert_compression_alg_id =
static_cast<uint16_t>(alg);