tls13_client.cc
Go to the documentation of this file.
1 /* Copyright (c) 2016, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #include <openssl/ssl.h>
16 
17 #include <assert.h>
18 #include <limits.h>
19 #include <string.h>
20 
21 #include <utility>
22 
23 #include <openssl/bytestring.h>
24 #include <openssl/digest.h>
25 #include <openssl/err.h>
26 #include <openssl/mem.h>
27 #include <openssl/sha.h>
28 #include <openssl/stack.h>
29 
30 #include "../crypto/internal.h"
31 #include "internal.h"
32 
33 
35 
52 };
53 
54 static const uint8_t kZeroes[EVP_MAX_MD_SIZE] = {0};
55 
56 // end_of_early_data closes the early data stream for |hs| and switches the
57 // encryption level to |level|. It returns true on success and false on error.
58 static bool close_early_data(SSL_HANDSHAKE *hs, ssl_encryption_level_t level) {
59  SSL *const ssl = hs->ssl;
60  assert(hs->in_early_data);
61 
62  // Note |can_early_write| may already be false if |SSL_write| exceeded the
63  // early data write limit.
64  hs->can_early_write = false;
65 
66  // 0-RTT write states on the client differ between TLS 1.3, DTLS 1.3, and
67  // QUIC. TLS 1.3 has one write encryption level at a time. 0-RTT write keys
68  // overwrite the null cipher and defer handshake write keys. While a
69  // HelloRetryRequest can cause us to rewind back to the null cipher, sequence
70  // numbers have no effect, so we can install a "new" null cipher.
71  //
72  // In QUIC and DTLS 1.3, 0-RTT write state cannot override or defer the normal
73  // write state. The two ClientHello sequence numbers must align, and handshake
74  // write keys must be installed early to ACK the EncryptedExtensions.
75  //
76  // We do not currently implement DTLS 1.3 and, in QUIC, the caller handles
77  // 0-RTT data, so we can skip installing 0-RTT keys and act as if there is one
78  // write level. If we implement DTLS 1.3, we'll need to model this better.
79  if (ssl->quic_method == nullptr) {
81  bssl::UniquePtr<SSLAEADContext> null_ctx =
83  if (!null_ctx ||
84  !ssl->method->set_write_state(ssl, ssl_encryption_initial,
85  std::move(null_ctx),
86  /*secret_for_quic=*/{})) {
87  return false;
88  }
89  ssl->s3->aead_write_ctx->SetVersionIfNullCipher(ssl->version);
90  } else {
93  hs->new_session.get(),
94  hs->client_handshake_secret())) {
95  return false;
96  }
97  }
98  }
99 
100  assert(ssl->s3->write_level == level);
101  return true;
102 }
103 
105  ParsedServerHello *out, uint8_t *out_alert,
106  const SSLMessage &msg) {
107  if (!ssl_parse_server_hello(out, out_alert, msg)) {
108  return false;
109  }
110  // The RFC8446 version of the structure fixes some legacy values.
111  // Additionally, the session ID must echo the original one.
112  if (out->legacy_version != TLS1_2_VERSION ||
113  out->compression_method != 0 ||
114  !CBS_mem_equal(&out->session_id, hs->session_id, hs->session_id_len) ||
115  CBS_len(&out->extensions) == 0) {
117  *out_alert = SSL_AD_DECODE_ERROR;
118  return false;
119  }
120  return true;
121 }
122 
123 static bool is_hello_retry_request(const ParsedServerHello &server_hello) {
124  return Span<const uint8_t>(server_hello.random) == kHelloRetryRequest;
125 }
126 
127 static bool check_ech_confirmation(const SSL_HANDSHAKE *hs, bool *out_accepted,
128  uint8_t *out_alert,
129  const ParsedServerHello &server_hello) {
130  const bool is_hrr = is_hello_retry_request(server_hello);
131  size_t offset;
132  if (is_hrr) {
133  // We check for an unsolicited extension when parsing all of them.
135  if (!ssl_parse_extensions(&server_hello.extensions, out_alert, {&ech},
136  /*ignore_unknown=*/true)) {
137  return false;
138  }
139  if (!ech.present) {
140  *out_accepted = false;
141  return true;
142  }
145  *out_alert = SSL_AD_DECODE_ERROR;
146  return false;
147  }
148  offset = CBS_data(&ech.data) - CBS_data(&server_hello.raw);
149  } else {
151  }
152 
153  if (!hs->selected_ech_config) {
154  *out_accepted = false;
155  return true;
156  }
157 
159  if (!ssl_ech_accept_confirmation(hs, expected, hs->inner_client_random,
160  hs->inner_transcript, is_hrr,
161  server_hello.raw, offset)) {
162  *out_alert = SSL_AD_INTERNAL_ERROR;
163  return false;
164  }
165 
166  *out_accepted = CRYPTO_memcmp(CBS_data(&server_hello.raw) + offset, expected,
167  sizeof(expected)) == 0;
168  return true;
169 }
170 
172  SSL *const ssl = hs->ssl;
173  assert(ssl->s3->have_version);
174  SSLMessage msg;
175  if (!ssl->method->get_message(ssl, &msg)) {
176  return ssl_hs_read_message;
177  }
178 
179  // Queue up a ChangeCipherSpec for whenever we next send something. This
180  // will be before the second ClientHello. If we offered early data, this was
181  // already done.
182  if (!hs->early_data_offered &&
183  !ssl->method->add_change_cipher_spec(ssl)) {
184  return ssl_hs_error;
185  }
186 
187  ParsedServerHello server_hello;
189  if (!parse_server_hello_tls13(hs, &server_hello, &alert, msg)) {
190  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
191  return ssl_hs_error;
192  }
193 
194  // The cipher suite must be one we offered. We currently offer all supported
195  // TLS 1.3 ciphers, so check the version.
196  const SSL_CIPHER *cipher = SSL_get_cipher_by_value(server_hello.cipher_suite);
197  if (cipher == nullptr ||
202  return ssl_hs_error;
203  }
204 
205  hs->new_cipher = cipher;
206 
207  const bool is_hrr = is_hello_retry_request(server_hello);
208  if (!hs->transcript.InitHash(ssl_protocol_version(ssl), hs->new_cipher) ||
209  (is_hrr && !hs->transcript.UpdateForHelloRetryRequest())) {
210  return ssl_hs_error;
211  }
212  if (hs->selected_ech_config) {
214  hs->new_cipher) ||
215  (is_hrr && !hs->inner_transcript.UpdateForHelloRetryRequest())) {
216  return ssl_hs_error;
217  }
218  }
219 
220  // Determine which ClientHello the server is responding to. Run
221  // |check_ech_confirmation| unconditionally, so we validate the extension
222  // contents.
223  bool ech_accepted;
224  if (!check_ech_confirmation(hs, &ech_accepted, &alert, server_hello)) {
225  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
226  return ssl_hs_error;
227  }
228  if (hs->selected_ech_config) {
229  ssl->s3->ech_status = ech_accepted ? ssl_ech_accepted : ssl_ech_rejected;
230  }
231 
232  if (!is_hrr) {
234  return ssl_hs_ok;
235  }
236 
237  // The ECH extension, if present, was already parsed by
238  // |check_ech_confirmation|.
244  &server_hello.extensions, &alert,
245  {&cookie, &key_share, &supported_versions, &ech_unused},
246  /*ignore_unknown=*/false)) {
247  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
248  return ssl_hs_error;
249  }
250 
251  if (!cookie.present && !key_share.present) {
254  return ssl_hs_error;
255  }
256  if (cookie.present) {
257  CBS cookie_value;
258  if (!CBS_get_u16_length_prefixed(&cookie.data, &cookie_value) ||
259  CBS_len(&cookie_value) == 0 ||
260  CBS_len(&cookie.data) != 0) {
263  return ssl_hs_error;
264  }
265 
266  if (!hs->cookie.CopyFrom(cookie_value)) {
267  return ssl_hs_error;
268  }
269  }
270 
271  if (key_share.present) {
272  uint16_t group_id;
273  if (!CBS_get_u16(&key_share.data, &group_id) ||
274  CBS_len(&key_share.data) != 0) {
277  return ssl_hs_error;
278  }
279 
280  // The group must be supported.
281  if (!tls1_check_group_id(hs, group_id)) {
284  return ssl_hs_error;
285  }
286 
287  // Check that the HelloRetryRequest does not request a key share that was
288  // provided in the initial ClientHello.
289  if (hs->key_shares[0]->GroupID() == group_id ||
290  (hs->key_shares[1] && hs->key_shares[1]->GroupID() == group_id)) {
293  return ssl_hs_error;
294  }
295 
296  if (!ssl_setup_key_shares(hs, group_id)) {
297  return ssl_hs_error;
298  }
299  }
300 
301  // Although we now know whether ClientHelloInner was used, we currently
302  // maintain both transcripts up to ServerHello. We could swap transcripts
303  // early, but then ClientHello construction and |check_ech_confirmation|
304  // become more complex.
305  if (!ssl_hash_message(hs, msg)) {
306  return ssl_hs_error;
307  }
308  if (ssl->s3->ech_status == ssl_ech_accepted &&
309  !hs->inner_transcript.Update(msg.raw)) {
310  return ssl_hs_error;
311  }
312 
313  // HelloRetryRequest should be the end of the flight.
314  if (ssl->method->has_unprocessed_handshake_data(ssl)) {
317  return ssl_hs_error;
318  }
319 
320  ssl->method->next_message(ssl);
321  ssl->s3->used_hello_retry_request = true;
323  // 0-RTT is rejected if we receive a HelloRetryRequest.
324  if (hs->in_early_data) {
325  ssl->s3->early_data_reason = ssl_early_data_hello_retry_request;
327  return ssl_hs_error;
328  }
330  }
331  return ssl_hs_ok;
332 }
333 
335  // Any 0-RTT keys must have been discarded.
336  assert(hs->ssl->s3->write_level == ssl_encryption_initial);
337 
338  // Build the second ClientHelloInner, if applicable. The second ClientHello
339  // uses an empty string for |enc|.
340  if (hs->ssl->s3->ech_status == ssl_ech_accepted &&
341  !ssl_encrypt_client_hello(hs, {})) {
342  return ssl_hs_error;
343  }
344 
345  if (!ssl_add_client_hello(hs)) {
346  return ssl_hs_error;
347  }
348 
351  return ssl_hs_flush;
352 }
353 
355  SSL *const ssl = hs->ssl;
356  SSLMessage msg;
357  if (!ssl->method->get_message(ssl, &msg)) {
358  return ssl_hs_read_message;
359  }
360  ParsedServerHello server_hello;
362  if (!parse_server_hello_tls13(hs, &server_hello, &alert, msg)) {
363  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
364  return ssl_hs_error;
365  }
366 
367  // Forbid a second HelloRetryRequest.
368  if (is_hello_retry_request(server_hello)) {
371  return ssl_hs_error;
372  }
373 
374  // Check the cipher suite, in case this is after HelloRetryRequest.
375  if (SSL_CIPHER_get_value(hs->new_cipher) != server_hello.cipher_suite) {
378  return ssl_hs_error;
379  }
380 
381  if (ssl->s3->ech_status == ssl_ech_accepted) {
382  if (ssl->s3->used_hello_retry_request) {
383  // HelloRetryRequest and ServerHello must accept ECH consistently.
384  bool ech_accepted;
385  if (!check_ech_confirmation(hs, &ech_accepted, &alert, server_hello)) {
386  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
387  return ssl_hs_error;
388  }
389  if (!ech_accepted) {
392  return ssl_hs_error;
393  }
394  }
395 
398  // Report the inner random value through |SSL_get_client_random|.
399  OPENSSL_memcpy(ssl->s3->client_random, hs->inner_client_random,
401  }
402 
403  OPENSSL_memcpy(ssl->s3->server_random, CBS_data(&server_hello.random),
405 
406  // When offering ECH, |ssl->session| is only offered in ClientHelloInner.
407  const bool pre_shared_key_allowed =
408  ssl->session != nullptr && ssl->s3->ech_status != ssl_ech_rejected;
410  pre_shared_key(TLSEXT_TYPE_pre_shared_key, pre_shared_key_allowed),
412  if (!ssl_parse_extensions(&server_hello.extensions, &alert,
413  {&key_share, &pre_shared_key, &supported_versions},
414  /*ignore_unknown=*/false)) {
415  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
416  return ssl_hs_error;
417  }
418 
419  // Recheck supported_versions, in case this is after HelloRetryRequest.
421  if (!supported_versions.present ||
423  CBS_len(&supported_versions.data) != 0 ||
424  version != ssl->version) {
427  return ssl_hs_error;
428  }
429 
430  alert = SSL_AD_DECODE_ERROR;
431  if (pre_shared_key.present) {
433  &pre_shared_key.data)) {
434  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
435  return ssl_hs_error;
436  }
437 
438  if (ssl->session->ssl_version != ssl->version) {
441  return ssl_hs_error;
442  }
443 
444  if (ssl->session->cipher->algorithm_prf != hs->new_cipher->algorithm_prf) {
447  return ssl_hs_error;
448  }
449 
450  if (!ssl_session_is_context_valid(hs, ssl->session.get())) {
451  // This is actually a client application bug.
455  return ssl_hs_error;
456  }
457 
458  ssl->s3->session_reused = true;
459  hs->can_release_private_key = true;
460  // Only authentication information carries over in TLS 1.3.
461  hs->new_session =
463  if (!hs->new_session) {
465  return ssl_hs_error;
466  }
467  ssl_set_session(ssl, NULL);
468 
469  // Resumption incorporates fresh key material, so refresh the timeout.
470  ssl_session_renew_timeout(ssl, hs->new_session.get(),
471  ssl->session_ctx->session_psk_dhe_timeout);
472  } else if (!ssl_get_new_session(hs)) {
474  return ssl_hs_error;
475  }
476 
477  hs->new_session->cipher = hs->new_cipher;
478 
479  // Set up the key schedule and incorporate the PSK into the running secret.
480  size_t hash_len = EVP_MD_size(
483  hs, ssl->s3->session_reused
484  ? MakeConstSpan(hs->new_session->secret,
485  hs->new_session->secret_length)
486  : MakeConstSpan(kZeroes, hash_len))) {
487  return ssl_hs_error;
488  }
489 
490  if (!key_share.present) {
491  // We do not support psk_ke and thus always require a key share.
494  return ssl_hs_error;
495  }
496 
497  // Resolve ECDHE and incorporate it into the secret.
498  Array<uint8_t> dhe_secret;
499  alert = SSL_AD_DECODE_ERROR;
500  if (!ssl_ext_key_share_parse_serverhello(hs, &dhe_secret, &alert,
501  &key_share.data)) {
502  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
503  return ssl_hs_error;
504  }
505 
506  if (!tls13_advance_key_schedule(hs, dhe_secret) ||
507  !ssl_hash_message(hs, msg) ||
509  return ssl_hs_error;
510  }
511 
512  // If currently sending early data over TCP, we defer installing client
513  // traffic keys to when the early data stream is closed. See
514  // |close_early_data|. Note if the server has already rejected 0-RTT via
515  // HelloRetryRequest, |in_early_data| is already false.
516  if (!hs->in_early_data || ssl->quic_method != nullptr) {
518  hs->new_session.get(),
519  hs->client_handshake_secret())) {
520  return ssl_hs_error;
521  }
522  }
523 
525  hs->new_session.get(),
526  hs->server_handshake_secret())) {
527  return ssl_hs_error;
528  }
529 
530  ssl->method->next_message(ssl);
532  return ssl_hs_ok;
533 }
534 
536  SSL *const ssl = hs->ssl;
537  SSLMessage msg;
538  if (!ssl->method->get_message(ssl, &msg)) {
539  return ssl_hs_read_message;
540  }
542  return ssl_hs_error;
543  }
544 
545  CBS body = msg.body, extensions;
546  if (!CBS_get_u16_length_prefixed(&body, &extensions) ||
547  CBS_len(&body) != 0) {
550  return ssl_hs_error;
551  }
552 
555  return ssl_hs_error;
556  }
557 
558  if (ssl->s3->early_data_accepted) {
559  // The extension parser checks the server resumed the session.
560  assert(ssl->s3->session_reused);
561  // If offering ECH, the server may not accept early data with
562  // ClientHelloOuter. We do not offer sessions with ClientHelloOuter, so this
563  // this should be implied by checking |session_reused|.
564  assert(ssl->s3->ech_status != ssl_ech_rejected);
565 
566  if (hs->early_session->cipher != hs->new_session->cipher) {
569  return ssl_hs_error;
570  }
571  if (MakeConstSpan(hs->early_session->early_alpn) !=
572  ssl->s3->alpn_selected) {
575  return ssl_hs_error;
576  }
577  // Channel ID is incompatible with 0-RTT. The ALPS extension should be
578  // negotiated implicitly.
579  if (hs->channel_id_negotiated ||
580  hs->new_session->has_application_settings) {
583  return ssl_hs_error;
584  }
585  hs->new_session->has_application_settings =
586  hs->early_session->has_application_settings;
587  if (!hs->new_session->local_application_settings.CopyFrom(
588  hs->early_session->local_application_settings) ||
589  !hs->new_session->peer_application_settings.CopyFrom(
590  hs->early_session->peer_application_settings)) {
592  return ssl_hs_error;
593  }
594  }
595 
596  // Store the negotiated ALPN in the session.
597  if (!hs->new_session->early_alpn.CopyFrom(ssl->s3->alpn_selected)) {
599  return ssl_hs_error;
600  }
601 
602  if (!ssl_hash_message(hs, msg)) {
603  return ssl_hs_error;
604  }
605 
606  ssl->method->next_message(ssl);
608  if (hs->in_early_data && !ssl->s3->early_data_accepted) {
610  return ssl_hs_error;
611  }
613  }
614  return ssl_hs_ok;
615 }
616 
618  SSL *const ssl = hs->ssl;
619  // CertificateRequest may only be sent in non-resumption handshakes.
620  if (ssl->s3->session_reused) {
621  if (ssl->ctx->reverify_on_resume && !ssl->s3->early_data_accepted) {
623  return ssl_hs_ok;
624  }
626  return ssl_hs_ok;
627  }
628 
629  SSLMessage msg;
630  if (!ssl->method->get_message(ssl, &msg)) {
631  return ssl_hs_read_message;
632  }
633 
634  // CertificateRequest is optional.
635  if (msg.type != SSL3_MT_CERTIFICATE_REQUEST) {
637  return ssl_hs_ok;
638  }
639 
640 
643  CBS body = msg.body, context, extensions, supported_signature_algorithms;
645  if (!CBS_get_u8_length_prefixed(&body, &context) ||
646  // The request context is always empty during the handshake.
647  CBS_len(&context) != 0 ||
649  CBS_len(&body) != 0 ||
650  !ssl_parse_extensions(&extensions, &alert, {&sigalgs, &ca},
651  /*ignore_unknown=*/true) ||
652  !sigalgs.present ||
653  !CBS_get_u16_length_prefixed(&sigalgs.data,
654  &supported_signature_algorithms) ||
655  !tls1_parse_peer_sigalgs(hs, &supported_signature_algorithms)) {
656  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
658  return ssl_hs_error;
659  }
660 
661  if (ca.present) {
662  hs->ca_names = ssl_parse_client_CA_list(ssl, &alert, &ca.data);
663  if (!hs->ca_names) {
664  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
665  return ssl_hs_error;
666  }
667  } else {
668  hs->ca_names.reset(sk_CRYPTO_BUFFER_new_null());
669  if (!hs->ca_names) {
672  return ssl_hs_error;
673  }
674  }
675 
676  hs->cert_request = true;
677  ssl->ctx->x509_method->hs_flush_cached_ca_names(hs);
678 
679  if (!ssl_hash_message(hs, msg)) {
680  return ssl_hs_error;
681  }
682 
683  ssl->method->next_message(ssl);
685  return ssl_hs_ok;
686 }
687 
689  SSL *const ssl = hs->ssl;
690  SSLMessage msg;
691  if (!ssl->method->get_message(ssl, &msg)) {
692  return ssl_hs_read_message;
693  }
694 
695  if (msg.type != SSL3_MT_COMPRESSED_CERTIFICATE &&
697  return ssl_hs_error;
698  }
699 
700  if (!tls13_process_certificate(hs, msg, false /* certificate required */) ||
701  !ssl_hash_message(hs, msg)) {
702  return ssl_hs_error;
703  }
704 
705  ssl->method->next_message(ssl);
707  return ssl_hs_ok;
708 }
709 
711  SSL *const ssl = hs->ssl;
712  SSLMessage msg;
713  if (!ssl->method->get_message(ssl, &msg)) {
714  return ssl_hs_read_message;
715  }
716  switch (ssl_verify_peer_cert(hs)) {
717  case ssl_verify_ok:
718  break;
719  case ssl_verify_invalid:
720  return ssl_hs_error;
721  case ssl_verify_retry:
724  }
725 
728  !ssl_hash_message(hs, msg)) {
729  return ssl_hs_error;
730  }
731 
732  ssl->method->next_message(ssl);
734  return ssl_hs_ok;
735 }
736 
738  switch (ssl_reverify_peer_cert(hs, /*send_alert=*/true)) {
739  case ssl_verify_ok:
740  break;
741  case ssl_verify_invalid:
742  return ssl_hs_error;
743  case ssl_verify_retry:
746  }
748  return ssl_hs_ok;
749 }
750 
752  SSL *const ssl = hs->ssl;
753  SSLMessage msg;
754  if (!ssl->method->get_message(ssl, &msg)) {
755  return ssl_hs_read_message;
756  }
758  !tls13_process_finished(hs, msg, false /* don't use saved value */) ||
759  !ssl_hash_message(hs, msg) ||
760  // Update the secret to the master secret and derive traffic keys.
762  hs, MakeConstSpan(kZeroes, hs->transcript.DigestLen())) ||
764  return ssl_hs_error;
765  }
766 
767  // Finished should be the end of the flight.
768  if (ssl->method->has_unprocessed_handshake_data(ssl)) {
771  return ssl_hs_error;
772  }
773 
774  ssl->method->next_message(ssl);
776  return ssl_hs_ok;
777 }
778 
780  SSL *const ssl = hs->ssl;
781 
782  if (ssl->s3->early_data_accepted) {
783  // QUIC omits the EndOfEarlyData message. See RFC 9001, section 8.3.
784  if (ssl->quic_method == nullptr) {
785  ScopedCBB cbb;
786  CBB body;
787  if (!ssl->method->init_message(ssl, cbb.get(), &body,
789  !ssl_add_message_cbb(ssl, cbb.get())) {
790  return ssl_hs_error;
791  }
792  }
793 
795  return ssl_hs_error;
796  }
797  }
798 
800  return ssl_hs_ok;
801 }
802 
804  SSL_HANDSHAKE *hs) {
805  SSL *const ssl = hs->ssl;
806  // For now, only one extension uses client EncryptedExtensions. This function
807  // may be generalized if others use it in the future.
808  if (hs->new_session->has_application_settings &&
809  !ssl->s3->early_data_accepted) {
810  ScopedCBB cbb;
811  CBB body, extensions, extension;
812  if (!ssl->method->init_message(ssl, cbb.get(), &body,
818  hs->new_session->local_application_settings.data(),
819  hs->new_session->local_application_settings.size()) ||
820  !ssl_add_message_cbb(ssl, cbb.get())) {
821  return ssl_hs_error;
822  }
823  }
824 
826  return ssl_hs_ok;
827 }
828 
830  SSL *const ssl = hs->ssl;
831 
832  // The peer didn't request a certificate.
833  if (!hs->cert_request) {
835  return ssl_hs_ok;
836  }
837 
838  if (ssl->s3->ech_status == ssl_ech_rejected) {
839  // Do not send client certificates on ECH reject. We have not authenticated
840  // the server for the name that can learn the certificate.
841  SSL_certs_clear(ssl);
842  } else if (hs->config->cert->cert_cb != nullptr) {
843  // Call cert_cb to update the certificate.
844  int rv = hs->config->cert->cert_cb(ssl, hs->config->cert->cert_cb_arg);
845  if (rv == 0) {
848  return ssl_hs_error;
849  }
850  if (rv < 0) {
852  return ssl_hs_x509_lookup;
853  }
854  }
855 
856  if (!ssl_on_certificate_selected(hs) ||
857  !tls13_add_certificate(hs)) {
858  return ssl_hs_error;
859  }
860 
862  return ssl_hs_ok;
863 }
864 
866  // Don't send CertificateVerify if there is no certificate.
867  if (!ssl_has_certificate(hs)) {
869  return ssl_hs_ok;
870  }
871 
872  switch (tls13_add_certificate_verify(hs)) {
875  return ssl_hs_ok;
876 
880 
882  return ssl_hs_error;
883  }
884 
885  assert(0);
886  return ssl_hs_error;
887 }
888 
890  SSL *const ssl = hs->ssl;
891  hs->can_release_private_key = true;
892 
893  // Send a Channel ID assertion if necessary.
894  if (hs->channel_id_negotiated) {
895  ScopedCBB cbb;
896  CBB body;
897  if (!ssl->method->init_message(ssl, cbb.get(), &body, SSL3_MT_CHANNEL_ID) ||
898  !tls1_write_channel_id(hs, &body) ||
899  !ssl_add_message_cbb(ssl, cbb.get())) {
900  return ssl_hs_error;
901  }
902  }
903 
904  // Send a Finished message.
905  if (!tls13_add_finished(hs)) {
906  return ssl_hs_error;
907  }
908 
909  // Derive the final keys and enable them.
911  hs->new_session.get(),
912  hs->client_traffic_secret_0()) ||
914  hs->new_session.get(),
915  hs->server_traffic_secret_0()) ||
917  return ssl_hs_error;
918  }
919 
920  hs->tls13_state = state_done;
921  return ssl_hs_flush;
922 }
923 
925  while (hs->tls13_state != state_done) {
927  enum client_hs_state_t state =
928  static_cast<enum client_hs_state_t>(hs->tls13_state);
929  switch (state) {
932  break;
935  break;
938  break;
941  break;
944  break;
947  break;
950  break;
953  break;
956  break;
959  break;
962  break;
965  break;
968  break;
971  break;
972  case state_done:
973  ret = ssl_hs_ok;
974  break;
975  }
976 
977  if (hs->tls13_state != state) {
979  }
980 
981  if (ret != ssl_hs_ok) {
982  return ret;
983  }
984  }
985 
986  return ssl_hs_ok;
987 }
988 
990  enum client_hs_state_t state =
991  static_cast<enum client_hs_state_t>(hs->tls13_state);
992  switch (state) {
994  return "TLS 1.3 client read_hello_retry_request";
996  return "TLS 1.3 client send_second_client_hello";
998  return "TLS 1.3 client read_server_hello";
1000  return "TLS 1.3 client read_encrypted_extensions";
1002  return "TLS 1.3 client read_certificate_request";
1004  return "TLS 1.3 client read_server_certificate";
1006  return "TLS 1.3 client read_server_certificate_verify";
1008  return "TLS 1.3 client server_certificate_reverify";
1010  return "TLS 1.3 client read_server_finished";
1012  return "TLS 1.3 client send_end_of_early_data";
1014  return "TLS 1.3 client send_client_encrypted_extensions";
1016  return "TLS 1.3 client send_client_certificate";
1018  return "TLS 1.3 client send_client_certificate_verify";
1020  return "TLS 1.3 client complete_second_flight";
1021  case state_done:
1022  return "TLS 1.3 client done";
1023  }
1024 
1025  return "TLS 1.3 client unknown";
1026 }
1027 
1029  if (ssl->s3->write_shutdown != ssl_shutdown_none) {
1030  // Ignore tickets on shutdown. Callers tend to indiscriminately call
1031  // |SSL_shutdown| before destroying an |SSL|, at which point calling the new
1032  // session callback may be confusing.
1033  return true;
1034  }
1035 
1036  CBS body = msg.body;
1037  UniquePtr<SSL_SESSION> session = tls13_create_session_with_ticket(ssl, &body);
1038  if (!session) {
1039  return false;
1040  }
1041 
1042  if ((ssl->session_ctx->session_cache_mode & SSL_SESS_CACHE_CLIENT) &&
1043  ssl->session_ctx->new_session_cb != NULL &&
1044  ssl->session_ctx->new_session_cb(ssl, session.get())) {
1045  // |new_session_cb|'s return value signals that it took ownership.
1046  session.release();
1047  }
1048 
1049  return true;
1050 }
1051 
1052 UniquePtr<SSL_SESSION> tls13_create_session_with_ticket(SSL *ssl, CBS *body) {
1053  UniquePtr<SSL_SESSION> session = SSL_SESSION_dup(
1054  ssl->s3->established_session.get(), SSL_SESSION_INCLUDE_NONAUTH);
1055  if (!session) {
1056  return nullptr;
1057  }
1058 
1059  ssl_session_rebase_time(ssl, session.get());
1060 
1061  uint32_t server_timeout;
1062  CBS ticket_nonce, ticket, extensions;
1063  if (!CBS_get_u32(body, &server_timeout) ||
1064  !CBS_get_u32(body, &session->ticket_age_add) ||
1065  !CBS_get_u8_length_prefixed(body, &ticket_nonce) ||
1066  !CBS_get_u16_length_prefixed(body, &ticket) ||
1067  !session->ticket.CopyFrom(ticket) ||
1069  CBS_len(body) != 0) {
1072  return nullptr;
1073  }
1074 
1075  // Cap the renewable lifetime by the server advertised value. This avoids
1076  // wasting bandwidth on 0-RTT when we know the server will reject it.
1077  if (session->timeout > server_timeout) {
1078  session->timeout = server_timeout;
1079  }
1080 
1081  if (!tls13_derive_session_psk(session.get(), ticket_nonce)) {
1082  return nullptr;
1083  }
1084 
1086  uint8_t alert = SSL_AD_DECODE_ERROR;
1087  if (!ssl_parse_extensions(&extensions, &alert, {&early_data},
1088  /*ignore_unknown=*/true)) {
1089  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
1090  return nullptr;
1091  }
1092 
1093  if (early_data.present) {
1094  if (!CBS_get_u32(&early_data.data, &session->ticket_max_early_data) ||
1095  CBS_len(&early_data.data) != 0) {
1098  return nullptr;
1099  }
1100 
1101  // QUIC does not use the max_early_data_size parameter and always sets it to
1102  // a fixed value. See RFC 9001, section 4.6.1.
1103  if (ssl->quic_method != nullptr &&
1104  session->ticket_max_early_data != 0xffffffff) {
1107  return nullptr;
1108  }
1109  }
1110 
1111  // Historically, OpenSSL filled in fake session IDs for ticket-based sessions.
1112  // Envoy's tests depend on this, although perhaps they shouldn't.
1113  SHA256(CBS_data(&ticket), CBS_len(&ticket), session->session_id);
1114  session->session_id_length = SHA256_DIGEST_LENGTH;
1115 
1116  session->ticket_age_add_valid = true;
1117  session->not_resumable = false;
1118 
1119  return session;
1120 }
1121 
SSL_HANDSHAKE::inner_client_random
uint8_t inner_client_random[SSL3_RANDOM_SIZE]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1830
tls13_add_finished
bool tls13_add_finished(SSL_HANDSHAKE *hs)
Definition: tls13_both.cc:642
ssl_send_alert
void ssl_send_alert(SSL *ssl, int level, int desc)
Definition: s3_pkt.cc:379
ssl_cipher_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:520
ssl_has_certificate
bool ssl_has_certificate(const SSL_HANDSHAKE *hs)
Definition: ssl_cert.cc:340
SSL_AD_UNEXPECTED_MESSAGE
#define SSL_AD_UNEXPECTED_MESSAGE
Definition: ssl.h:3795
ssl_parse_client_CA_list
UniquePtr< STACK_OF(CRYPTO_BUFFER)> ssl_parse_client_CA_list(SSL *ssl, uint8_t *out_alert, CBS *cbs)
Definition: ssl_cert.cc:618
SSLTranscript::UpdateForHelloRetryRequest
bool UpdateForHelloRetryRequest()
Definition: ssl_transcript.cc:183
SSL3_MT_FINISHED
#define SSL3_MT_FINISHED
Definition: ssl3.h:310
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
SSL_R_SECOND_SERVERHELLO_VERSION_MISMATCH
#define SSL_R_SECOND_SERVERHELLO_VERSION_MISMATCH
Definition: ssl.h:5555
CBS_get_u16
#define CBS_get_u16
Definition: boringssl_prefix_symbols.h:1073
tls13_derive_session_psk
bool tls13_derive_session_psk(SSL_SESSION *session, Span< const uint8_t > nonce)
Definition: tls13_enc.cc:374
SSLTranscript::InitHash
bool InitHash(uint16_t version, const SSL_CIPHER *cipher)
Definition: ssl_transcript.cc:161
SSL_R_ALPN_MISMATCH_ON_EARLY_DATA
#define SSL_R_ALPN_MISMATCH_ON_EARLY_DATA
Definition: ssl.h:5544
cbs_st
Definition: bytestring.h:39
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:2001
ParsedServerHello::cipher_suite
uint16_t cipher_suite
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2170
SSL_CB_CONNECT_LOOP
#define SSL_CB_CONNECT_LOOP
Definition: ssl.h:4289
state_read_encrypted_extensions
@ state_read_encrypted_extensions
Definition: tls13_client.cc:40
state_send_client_certificate_verify
@ state_send_client_certificate_verify
Definition: tls13_client.cc:49
Array::data
const T * data() const
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:274
tls1_write_channel_id
bool tls1_write_channel_id(SSL_HANDSHAKE *hs, CBB *cbb)
Definition: extensions.cc:4179
SSL_HANDSHAKE::session_id_len
uint8_t session_id_len
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2059
ssl_verify_ok
ssl_verify_ok
Definition: ssl.h:2412
CBS_data
#define CBS_data
Definition: boringssl_prefix_symbols.h:1057
tls13_client_handshake_state
const char * tls13_client_handshake_state(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:989
uint16_t
unsigned short uint16_t
Definition: stdint-msvc2008.h:79
state_server_certificate_reverify
@ state_server_certificate_reverify
Definition: tls13_client.cc:44
SSL_HANDSHAKE::new_cipher
const SSL_CIPHER * new_cipher
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1933
SSL_CIPHER_get_value
#define SSL_CIPHER_get_value
Definition: boringssl_prefix_symbols.h:57
ssl_done_writing_client_hello
void ssl_done_writing_client_hello(SSL_HANDSHAKE *hs)
Definition: handshake_client.cc:435
SSL_HANDSHAKE::inner_transcript
SSLTranscript inner_transcript
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1826
SSL_R_PARSE_TLSEXT
#define SSL_R_PARSE_TLSEXT
Definition: ssl.h:5457
SSL3_MT_CERTIFICATE_VERIFY
#define SSL3_MT_CERTIFICATE_VERIFY
Definition: ssl3.h:308
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
internal.h
ssl_private_key_failure
ssl_private_key_failure
Definition: ssl.h:1236
state_read_server_finished
@ state_read_server_finished
Definition: tls13_client.cc:45
string.h
TLSEXT_TYPE_early_data
#define TLSEXT_TYPE_early_data
Definition: tls1.h:231
CBS_get_u32
#define CBS_get_u32
Definition: boringssl_prefix_symbols.h:1078
CBB_add_u16_length_prefixed
#define CBB_add_u16_length_prefixed
Definition: boringssl_prefix_symbols.h:1028
ssl_cipher_st::algorithm_prf
uint32_t algorithm_prf
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:533
tls1_parse_peer_sigalgs
bool tls1_parse_peer_sigalgs(SSL_HANDSHAKE *hs, const CBS *in_sigalgs)
Definition: extensions.cc:4029
SSL_HANDSHAKE::ssl
SSL * ssl
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1726
ssl_hs_x509_lookup
@ ssl_hs_x509_lookup
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1618
SSL_HANDSHAKE::sent
uint32_t sent
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1802
CBS_mem_equal
#define CBS_mem_equal
Definition: boringssl_prefix_symbols.h:1090
SSL_AD_INTERNAL_ERROR
#define SSL_AD_INTERNAL_ERROR
Definition: ssl.h:3815
SSL_HANDSHAKE::server_handshake_secret
Span< uint8_t > server_handshake_secret()
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1785
SSL_R_EXCESS_HANDSHAKE_DATA
#define SSL_R_EXCESS_HANDSHAKE_DATA
Definition: ssl.h:5522
ssl_verify_retry
ssl_verify_retry
Definition: ssl.h:2414
CBS_get_u8_length_prefixed
#define CBS_get_u8_length_prefixed
Definition: boringssl_prefix_symbols.h:1083
ssl_hs_ok
@ ssl_hs_ok
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1611
TLSEXT_TYPE_cookie
#define TLSEXT_TYPE_cookie
Definition: tls1.h:233
ssl_parse_server_hello
bool ssl_parse_server_hello(ParsedServerHello *out, uint8_t *out_alert, const SSLMessage &msg)
Definition: handshake_client.cc:648
ECH_CONFIRMATION_SIGNAL_LEN
#define ECH_CONFIRMATION_SIGNAL_LEN
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1515
ParsedServerHello::random
CBS random
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2168
ssl_parse_serverhello_tlsext
bool ssl_parse_serverhello_tlsext(SSL_HANDSHAKE *hs, const CBS *cbs)
Definition: extensions.cc:3793
CBS_len
#define CBS_len
Definition: boringssl_prefix_symbols.h:1089
SSL_CONFIG::cert
UniquePtr< CERT > cert
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2986
tls1_check_group_id
bool tls1_check_group_id(const SSL_HANDSHAKE *hs, uint16_t group_id)
Definition: extensions.cc:408
SSL_HANDSHAKE::early_session
UniquePtr< SSL_SESSION > early_session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1920
SSL_R_UNEXPECTED_EXTENSION_ON_EARLY_DATA
#define SSL_R_UNEXPECTED_EXTENSION_ON_EARLY_DATA
Definition: ssl.h:5546
do_complete_second_flight
static enum ssl_hs_wait_t do_complete_second_flight(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:889
SSL_HANDSHAKE::selected_ech_config
UniquePtr< ECHConfig > selected_ech_config
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1930
SSL3_MT_CERTIFICATE
#define SSL3_MT_CERTIFICATE
Definition: ssl3.h:304
version
Definition: version.py:1
SSL3_MT_ENCRYPTED_EXTENSIONS
#define SSL3_MT_ENCRYPTED_EXTENSIONS
Definition: ssl3.h:303
SSL_HANDSHAKE::extensions
union SSL_HANDSHAKE::@373 extensions
do_read_server_finished
static enum ssl_hs_wait_t do_read_server_finished(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:751
ssl_add_client_hello
bool ssl_add_client_hello(SSL_HANDSHAKE *hs)
Definition: handshake_client.cc:323
SSL_AD_ILLEGAL_PARAMETER
#define SSL_AD_ILLEGAL_PARAMETER
Definition: ssl.h:3807
ssl_ech_accept_confirmation
bool ssl_ech_accept_confirmation(const SSL_HANDSHAKE *hs, Span< uint8_t > out, Span< const uint8_t > client_random, const SSLTranscript &transcript, bool is_hrr, Span< const uint8_t > msg, size_t offset)
Definition: tls13_enc.cc:540
ssl_ech_accepted
@ ssl_ech_accepted
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2614
SSL_HANDSHAKE::new_session
UniquePtr< SSL_SESSION > new_session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1916
SSL3_RANDOM_SIZE
#define SSL3_RANDOM_SIZE
Definition: ssl3.h:204
check_ech_confirmation
static bool check_ech_confirmation(const SSL_HANDSHAKE *hs, bool *out_accepted, uint8_t *out_alert, const ParsedServerHello &server_hello)
Definition: tls13_client.cc:127
do_send_client_certificate_verify
static enum ssl_hs_wait_t do_send_client_certificate_verify(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:865
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
state_read_hello_retry_request
@ state_read_hello_retry_request
Definition: tls13_client.cc:37
tls13_add_certificate
bool tls13_add_certificate(SSL_HANDSHAKE *hs)
Definition: tls13_both.cc:399
ssl_shutdown_none
@ ssl_shutdown_none
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2604
Array::CopyFrom
bool CopyFrom(Span< const T > in)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:338
ssl_st::quic_method
const SSL_QUIC_METHOD * quic_method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3769
SSLExtension
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2222
tls13_create_session_with_ticket
UniquePtr< SSL_SESSION > tls13_create_session_with_ticket(SSL *ssl, CBS *body)
Definition: tls13_client.cc:1052
ssl_st::session
bssl::UniquePtr< SSL_SESSION > session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3750
tls13_process_certificate
bool tls13_process_certificate(SSL_HANDSHAKE *hs, const SSLMessage &msg, bool allow_anonymous)
Definition: tls13_both.cc:107
SSL3_MT_CHANNEL_ID
#define SSL3_MT_CHANNEL_ID
Definition: ssl3.h:316
do_send_client_encrypted_extensions
static enum ssl_hs_wait_t do_send_client_encrypted_extensions(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:803
SSL_R_UNEXPECTED_MESSAGE
#define SSL_R_UNEXPECTED_MESSAGE
Definition: ssl.h:5490
ssl_set_session
void ssl_set_session(SSL *ssl, SSL_SESSION *session)
Definition: ssl_session.cc:788
tls13_init_key_schedule
bool tls13_init_key_schedule(SSL_HANDSHAKE *hs, Span< const uint8_t > psk)
Definition: tls13_enc.cc:61
SSL_HANDSHAKE::can_early_write
bool can_early_write
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2000
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
TLSEXT_TYPE_supported_versions
#define TLSEXT_TYPE_supported_versions
Definition: tls1.h:232
bytestring.h
SSL_HANDSHAKE::inner_extensions_sent
uint32_t inner_extensions_sent
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1810
SSL_HANDSHAKE::session_id
uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2058
CBB_add_u16
#define CBB_add_u16
Definition: boringssl_prefix_symbols.h:1027
kHelloRetryRequest
const uint8_t kHelloRetryRequest[SSL3_RANDOM_SIZE]
Definition: tls13_both.cc:40
do_read_hello_retry_request
static enum ssl_hs_wait_t do_read_hello_retry_request(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:171
sk_CRYPTO_BUFFER_new_null
#define sk_CRYPTO_BUFFER_new_null
Definition: boringssl_prefix_symbols.h:557
SSL_HANDSHAKE
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1720
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
Array< uint8_t >
ssl_hash_message
bool ssl_hash_message(SSL_HANDSHAKE *hs, const SSLMessage &msg)
Definition: handshake.cc:260
SSL_HANDSHAKE::channel_id_negotiated
bool channel_id_negotiated
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2041
ssl_hs_certificate_verify
@ ssl_hs_certificate_verify
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1626
ssl_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3698
SSLExtension::present
bool present
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2230
ssl_hs_wait_t
ssl_hs_wait_t
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1609
EVP_MD_size
#define EVP_MD_size
Definition: boringssl_prefix_symbols.h:1579
do_server_certificate_reverify
static enum ssl_hs_wait_t do_server_certificate_reverify(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:737
ssl_encryption_initial
ssl_encryption_initial
Definition: ssl.h:3282
sha.h
kZeroes
static const uint8_t kZeroes[EVP_MAX_MD_SIZE]
Definition: tls13_client.cc:54
do_read_server_certificate
static enum ssl_hs_wait_t do_read_server_certificate(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:688
conf.version
string version
Definition: doc/python/sphinx/conf.py:36
do_send_second_client_hello
static enum ssl_hs_wait_t do_send_second_client_hello(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:334
SSL_is_dtls
#define SSL_is_dtls
Definition: boringssl_prefix_symbols.h:402
TLSEXT_TYPE_signature_algorithms
#define TLSEXT_TYPE_signature_algorithms
Definition: tls1.h:192
OPENSSL_memcpy
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:819
BSSL_NAMESPACE_END
#define BSSL_NAMESPACE_END
Definition: base.h:480
SSL_SESSION_DUP_AUTH_ONLY
#define SSL_SESSION_DUP_AUTH_ONLY
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3170
do_send_client_certificate
static enum ssl_hs_wait_t do_send_client_certificate(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:829
SSL_HANDSHAKE::client_traffic_secret_0
Span< uint8_t > client_traffic_secret_0()
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1788
SSL_AD_MISSING_EXTENSION
#define SSL_AD_MISSING_EXTENSION
Definition: ssl.h:3819
ssl_verify_invalid
ssl_verify_invalid
Definition: ssl.h:2413
SSL_HANDSHAKE::ca_names
UniquePtr< STACK_OF(CRYPTO_BUFFER)> ca_names
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1897
err.h
tls13_derive_application_secrets
bool tls13_derive_application_secrets(SSL_HANDSHAKE *hs)
Definition: tls13_enc.cc:278
SSL_R_WRONG_CURVE
#define SSL_R_WRONG_CURVE
Definition: ssl.h:5510
ssl_protocol_version
uint16_t ssl_protocol_version(const SSL *ssl)
Definition: ssl_versions.cc:251
SSLAEADContext::CreateNullCipher
static UniquePtr< SSLAEADContext > CreateNullCipher(bool is_dtls)
Definition: ssl_aead_ctx.cc:51
ssl_hs_early_data_rejected
@ ssl_hs_early_data_rejected
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1623
SSL_CIPHER_get_min_version
#define SSL_CIPHER_get_min_version
Definition: boringssl_prefix_symbols.h:52
evp_aead_open
@ evp_aead_open
Definition: aead.h:430
TLSEXT_TYPE_key_share
#define TLSEXT_TYPE_key_share
Definition: tls1.h:237
evp_aead_seal
@ evp_aead_seal
Definition: aead.h:431
ssl_on_certificate_selected
bool ssl_on_certificate_selected(SSL_HANDSHAKE *hs)
Definition: ssl_cert.cc:726
state_send_client_encrypted_extensions
@ state_send_client_encrypted_extensions
Definition: tls13_client.cc:47
conf.extensions
list extensions
Definition: doc/python/sphinx/conf.py:54
SSL_SESSION_dup
OPENSSL_EXPORT UniquePtr< SSL_SESSION > SSL_SESSION_dup(SSL_SESSION *session, int dup_flags)
Definition: ssl_session.cc:191
state_read_server_certificate
@ state_read_server_certificate
Definition: tls13_client.cc:42
do_read_server_hello
static enum ssl_hs_wait_t do_read_server_hello(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:354
state_send_client_certificate
@ state_send_client_certificate
Definition: tls13_client.cc:48
SSL_HANDSHAKE::server_traffic_secret_0
Span< uint8_t > server_traffic_secret_0()
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1791
state_send_end_of_early_data
@ state_send_end_of_early_data
Definition: tls13_client.cc:46
SSL_SESS_CACHE_CLIENT
#define SSL_SESS_CACHE_CLIENT
Definition: ssl.h:1937
Span< const uint8_t >
SSL_HANDSHAKE::can_release_private_key
bool can_release_private_key
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2037
SSL_HANDSHAKE::transcript
SSLTranscript transcript
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1821
do_read_certificate_request
static enum ssl_hs_wait_t do_read_certificate_request(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:617
ssl_hs_read_message
@ ssl_hs_read_message
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1613
state_read_server_hello
@ state_read_server_hello
Definition: tls13_client.cc:39
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
SSL3_AL_FATAL
#define SSL3_AL_FATAL
Definition: ssl3.h:280
SSL_HANDSHAKE::early_data_offered
bool early_data_offered
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1992
do_read_server_certificate_verify
static enum ssl_hs_wait_t do_read_server_certificate_verify(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:710
ssl.h
SSL_R_MISSING_KEY_SHARE
#define SSL_R_MISSING_KEY_SHARE
Definition: ssl.h:5525
SSL_HANDSHAKE::cert_request
bool cert_request
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1965
ssl_session_is_context_valid
int ssl_session_is_context_valid(const SSL_HANDSHAKE *hs, const SSL_SESSION *session)
Definition: ssl_session.cc:583
SHA256
#define SHA256
Definition: boringssl_prefix_symbols.h:2154
tls13_advance_key_schedule
bool tls13_advance_key_schedule(SSL_HANDSHAKE *hs, Span< const uint8_t > in)
Definition: tls13_enc.cc:123
SSLMessage
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1140
ssl_session_renew_timeout
void ssl_session_renew_timeout(SSL *ssl, SSL_SESSION *session, uint32_t timeout)
Definition: ssl_session.cc:319
tls13_process_certificate_verify
bool tls13_process_certificate_verify(SSL_HANDSHAKE *hs, const SSLMessage &msg)
Definition: tls13_both.cc:327
SSL_R_OLD_SESSION_PRF_HASH_MISMATCH
#define SSL_R_OLD_SESSION_PRF_HASH_MISMATCH
Definition: ssl.h:5535
CBB_add_bytes
#define CBB_add_bytes
Definition: boringssl_prefix_symbols.h:1025
TLS1_2_VERSION
#define TLS1_2_VERSION
Definition: ssl.h:652
BSSL_NAMESPACE_BEGIN
Definition: trust_token_test.cc:45
ssl_st::s3
bssl::SSL3_STATE * s3
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3730
digest.h
state_read_server_certificate_verify
@ state_read_server_certificate_verify
Definition: tls13_client.cc:43
ssl_hs_flush
@ ssl_hs_flush
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1614
ssl_get_new_session
bool ssl_get_new_session(SSL_HANDSHAKE *hs)
Definition: ssl_session.cc:352
SSL_HANDSHAKE::config
SSL_CONFIG * config
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1729
ssl_reverify_peer_cert
enum ssl_verify_result_t ssl_reverify_peer_cert(SSL_HANDSHAKE *hs, bool send_alert)
Definition: handshake.cc:423
tls13_process_new_session_ticket
bool tls13_process_new_session_ticket(SSL *ssl, const SSLMessage &msg)
Definition: tls13_client.cc:1028
ssl_encryption_application
ssl_encryption_application
Definition: ssl.h:3285
SSL_R_CIPHER_MISMATCH_ON_EARLY_DATA
#define SSL_R_CIPHER_MISMATCH_ON_EARLY_DATA
Definition: ssl.h:5571
ssl_hs_private_key_operation
@ ssl_hs_private_key_operation
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1619
SSL_CONFIG::ech_grease_enabled
bool ech_grease_enabled
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3048
SSLExtension::data
CBS data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2231
SSL_AD_DECODE_ERROR
#define SSL_AD_DECODE_ERROR
Definition: ssl.h:3810
ssl_ech_confirmation_signal_hello_offset
size_t ssl_ech_confirmation_signal_hello_offset(const SSL *ssl)
Definition: tls13_enc.cc:531
SSL_certs_clear
#define SSL_certs_clear
Definition: boringssl_prefix_symbols.h:288
ssl_private_key_success
ssl_private_key_success
Definition: ssl.h:1234
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
SSL_HANDSHAKE::cookie
Array< uint8_t > cookie
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1833
ssl_ext_pre_shared_key_parse_serverhello
bool ssl_ext_pre_shared_key_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert, CBS *contents)
Definition: extensions.cc:2007
CBS_get_u16_length_prefixed
#define CBS_get_u16_length_prefixed
Definition: boringssl_prefix_symbols.h:1074
SSL_HANDSHAKE::key_shares
UniquePtr< SSLKeyShare > key_shares[2]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1818
SHA256_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH
Definition: sha.h:155
ssl_early_data_hello_retry_request
ssl_early_data_hello_retry_request
Definition: ssl.h:3571
SSLTranscript::Update
bool Update(Span< const uint8_t > in)
Definition: ssl_transcript.cc:220
ssl_check_message_type
bool ssl_check_message_type(SSL *ssl, const SSLMessage &msg, int type)
Definition: handshake.cc:209
parse_server_hello_tls13
static bool parse_server_hello_tls13(const SSL_HANDSHAKE *hs, ParsedServerHello *out, uint8_t *out_alert, const SSLMessage &msg)
Definition: tls13_client.cc:104
EVP_MAX_MD_SIZE
#define EVP_MAX_MD_SIZE
Definition: digest.h:156
tls13_process_finished
bool tls13_process_finished(SSL_HANDSHAKE *hs, const SSLMessage &msg, bool use_saved_value)
Definition: tls13_both.cc:369
ssl_setup_key_shares
bool ssl_setup_key_shares(SSL_HANDSHAKE *hs, uint16_t override_group_id)
Definition: extensions.cc:2263
client_hs_state_t
client_hs_state_t
Definition: tls13_client.cc:36
ssl_session_rebase_time
void ssl_session_rebase_time(SSL *ssl, SSL_SESSION *session)
Definition: ssl_session.cc:290
ssl_add_message_cbb
bool ssl_add_message_cbb(SSL *ssl, CBB *cbb)
Definition: handshake.cc:220
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
ParsedServerHello
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2165
SSL3_MT_COMPRESSED_CERTIFICATE
#define SSL3_MT_COMPRESSED_CERTIFICATE
Definition: ssl3.h:314
ssl_ech_rejected
@ ssl_ech_rejected
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2616
do_send_end_of_early_data
static enum ssl_hs_wait_t do_send_end_of_early_data(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:779
ParsedServerHello::extensions
CBS extensions
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2172
SSL_get_cipher_by_value
#define SSL_get_cipher_by_value
Definition: boringssl_prefix_symbols.h:328
ssl_st::method
const bssl::SSL_PROTOCOL_METHOD * method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3706
SSL_HANDSHAKE::client_handshake_secret
Span< uint8_t > client_handshake_secret()
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1782
state_done
@ state_done
Definition: tls13_client.cc:51
SSL3_MT_END_OF_EARLY_DATA
#define SSL3_MT_END_OF_EARLY_DATA
Definition: ssl3.h:302
ssl_parse_extensions
bool ssl_parse_extensions(const CBS *cbs, uint8_t *out_alert, std::initializer_list< SSLExtension * > extensions, bool ignore_unknown)
Definition: handshake.cc:269
SSL_R_INCONSISTENT_ECH_NEGOTIATION
#define SSL_R_INCONSISTENT_ECH_NEGOTIATION
Definition: ssl.h:5588
state_send_second_client_hello
@ state_send_second_client_hello
Definition: tls13_client.cc:38
ssl_verify_peer_cert
enum ssl_verify_result_t ssl_verify_peer_cert(SSL_HANDSHAKE *hs)
Definition: handshake.cc:323
state_complete_second_flight
@ state_complete_second_flight
Definition: tls13_client.cc:50
ssl_encrypt_client_hello
bool ssl_encrypt_client_hello(SSL_HANDSHAKE *hs, Span< const uint8_t > enc)
Definition: encrypted_client_hello.cc:748
TLSEXT_TYPE_application_settings
#define TLSEXT_TYPE_application_settings
Definition: tls1.h:247
SSL_R_WRONG_CIPHER_RETURNED
#define SSL_R_WRONG_CIPHER_RETURNED
Definition: ssl.h:5509
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
TLSEXT_TYPE_encrypted_client_hello
#define TLSEXT_TYPE_encrypted_client_hello
Definition: tls1.h:251
tls13_client_handshake
enum ssl_hs_wait_t tls13_client_handshake(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:924
SSL_R_DECODE_ERROR
#define SSL_R_DECODE_ERROR
Definition: ssl.h:5405
mem.h
do_read_encrypted_extensions
static enum ssl_hs_wait_t do_read_encrypted_extensions(SSL_HANDSHAKE *hs)
Definition: tls13_client.cc:535
tls13_derive_resumption_secret
bool tls13_derive_resumption_secret(SSL_HANDSHAKE *hs)
Definition: tls13_enc.cc:323
SSL_HANDSHAKE::tls13_state
int tls13_state
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1741
ssl_st::session_ctx
bssl::UniquePtr< SSL_CTX > session_ctx
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3758
ssl_do_info_callback
void ssl_do_info_callback(const SSL *ssl, int type, int value)
Definition: ssl_lib.cc:316
ssl_ext_key_share_parse_serverhello
bool ssl_ext_key_share_parse_serverhello(SSL_HANDSHAKE *hs, Array< uint8_t > *out_secret, uint8_t *out_alert, CBS *contents)
Definition: extensions.cc:2350
client.level
level
Definition: examples/python/async_streaming/client.py:118
is_hello_retry_request
static bool is_hello_retry_request(const ParsedServerHello &server_hello)
Definition: tls13_client.cc:123
state_read_certificate_request
@ state_read_certificate_request
Definition: tls13_client.cc:41
SSL_R_OLD_SESSION_VERSION_NOT_RETURNED
#define SSL_R_OLD_SESSION_VERSION_NOT_RETURNED
Definition: ssl.h:5455
TLSEXT_TYPE_pre_shared_key
#define TLSEXT_TYPE_pre_shared_key
Definition: tls1.h:230
ssl_hs_error
@ ssl_hs_error
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1610
tls13_set_traffic_key
bool tls13_set_traffic_key(SSL *ssl, enum ssl_encryption_level_t level, enum evp_aead_direction_t direction, const SSL_SESSION *session, Span< const uint8_t > traffic_secret)
Definition: tls13_enc.cc:156
SSL_R_EMPTY_HELLO_RETRY_REQUEST
#define SSL_R_EMPTY_HELLO_RETRY_REQUEST
Definition: ssl.h:5549
SSL_SESSION_INCLUDE_NONAUTH
#define SSL_SESSION_INCLUDE_NONAUTH
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3172
ssl_encryption_handshake
ssl_encryption_handshake
Definition: ssl.h:3284
SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
Definition: ssl.h:5369
ssl_st::version
uint16_t version
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3715
SSL_HANDSHAKE::in_early_data
bool in_early_data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1989
ssl_st::ctx
bssl::UniquePtr< SSL_CTX > ctx
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3754
close_early_data
static bool close_early_data(SSL_HANDSHAKE *hs, ssl_encryption_level_t level)
Definition: tls13_client.cc:58
SSL_CIPHER_get_max_version
#define SSL_CIPHER_get_max_version
Definition: boringssl_prefix_symbols.h:51
CRYPTO_memcmp
#define CRYPTO_memcmp
Definition: boringssl_prefix_symbols.h:1178
tls13_derive_handshake_secrets
bool tls13_derive_handshake_secrets(SSL_HANDSHAKE *hs)
Definition: tls13_enc.cc:262
TLSEXT_TYPE_certificate_authorities
#define TLSEXT_TYPE_certificate_authorities
Definition: tls1.h:235
SSL_R_CERT_CB_ERROR
#define SSL_R_CERT_CB_ERROR
Definition: ssl.h:5394
ERR_R_MALLOC_FAILURE
#define ERR_R_MALLOC_FAILURE
Definition: err.h:371
offset
voidpf uLong offset
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:142
tls13_add_certificate_verify
enum ssl_private_key_result_t tls13_add_certificate_verify(SSL_HANDSHAKE *hs)
Definition: tls13_both.cc:562
SSLTranscript::DigestLen
size_t DigestLen() const
Definition: ssl_transcript.cc:175
ParsedServerHello::raw
CBS raw
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2166
stack.h
SSL3_MT_CERTIFICATE_REQUEST
#define SSL3_MT_CERTIFICATE_REQUEST
Definition: ssl3.h:306
ssl_get_handshake_digest
const EVP_MD * ssl_get_handshake_digest(uint16_t version, const SSL_CIPHER *cipher)
Definition: ssl_cipher.cc:637
ssl_private_key_retry
ssl_private_key_retry
Definition: ssl.h:1235
absl::MakeConstSpan
constexpr Span< const T > MakeConstSpan(T *ptr, size_t size) noexcept
Definition: abseil-cpp/absl/types/span.h:707
cbb_st
Definition: bytestring.h:375
supported_versions
static const char *const supported_versions[]
Definition: src/core/ext/transport/chttp2/alpn/alpn.cc:28


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:39