ssl_lib.cc
Go to the documentation of this file.
1 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
2  * All rights reserved.
3  *
4  * This package is an SSL implementation written
5  * by Eric Young (eay@cryptsoft.com).
6  * The implementation was written so as to conform with Netscapes SSL.
7  *
8  * This library is free for commercial and non-commercial use as long as
9  * the following conditions are aheared to. The following conditions
10  * apply to all code found in this distribution, be it the RC4, RSA,
11  * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12  * included with this distribution is covered by the same copyright terms
13  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14  *
15  * Copyright remains Eric Young's, and as such any Copyright notices in
16  * the code are not to be removed.
17  * If this package is used in a product, Eric Young should be given attribution
18  * as the author of the parts of the library used.
19  * This can be in the form of a textual message at program startup or
20  * in documentation (online or textual) provided with the package.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions
24  * are met:
25  * 1. Redistributions of source code must retain the copyright
26  * notice, this list of conditions and the following disclaimer.
27  * 2. Redistributions in binary form must reproduce the above copyright
28  * notice, this list of conditions and the following disclaimer in the
29  * documentation and/or other materials provided with the distribution.
30  * 3. All advertising materials mentioning features or use of this software
31  * must display the following acknowledgement:
32  * "This product includes cryptographic software written by
33  * Eric Young (eay@cryptsoft.com)"
34  * The word 'cryptographic' can be left out if the rouines from the library
35  * being used are not cryptographic related :-).
36  * 4. If you include any Windows specific code (or a derivative thereof) from
37  * the apps directory (application code) you must include an acknowledgement:
38  * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50  * SUCH DAMAGE.
51  *
52  * The licence and distribution terms for any publically available version or
53  * derivative of this code cannot be changed. i.e. this code cannot simply be
54  * copied and put under another distribution licence
55  * [including the GNU Public Licence.]
56  */
57 /* ====================================================================
58  * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
59  *
60  * Redistribution and use in source and binary forms, with or without
61  * modification, are permitted provided that the following conditions
62  * are met:
63  *
64  * 1. Redistributions of source code must retain the above copyright
65  * notice, this list of conditions and the following disclaimer.
66  *
67  * 2. Redistributions in binary form must reproduce the above copyright
68  * notice, this list of conditions and the following disclaimer in
69  * the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3. All advertising materials mentioning features or use of this
73  * software must display the following acknowledgment:
74  * "This product includes software developed by the OpenSSL Project
75  * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
76  *
77  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
78  * endorse or promote products derived from this software without
79  * prior written permission. For written permission, please contact
80  * openssl-core@openssl.org.
81  *
82  * 5. Products derived from this software may not be called "OpenSSL"
83  * nor may "OpenSSL" appear in their names without prior written
84  * permission of the OpenSSL Project.
85  *
86  * 6. Redistributions of any form whatsoever must retain the following
87  * acknowledgment:
88  * "This product includes software developed by the OpenSSL Project
89  * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
90  *
91  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
92  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
94  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
95  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
96  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
97  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
98  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
99  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
100  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
102  * OF THE POSSIBILITY OF SUCH DAMAGE.
103  * ====================================================================
104  *
105  * This product includes cryptographic software written by Eric Young
106  * (eay@cryptsoft.com). This product includes software written by Tim
107  * Hudson (tjh@cryptsoft.com).
108  *
109  */
110 /* ====================================================================
111  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
112  * ECC cipher suite support in OpenSSL originally developed by
113  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
114  */
115 /* ====================================================================
116  * Copyright 2005 Nokia. All rights reserved.
117  *
118  * The portions of the attached software ("Contribution") is developed by
119  * Nokia Corporation and is licensed pursuant to the OpenSSL open source
120  * license.
121  *
122  * The Contribution, originally written by Mika Kousa and Pasi Eronen of
123  * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
124  * support (see RFC 4279) to OpenSSL.
125  *
126  * No patent licenses or other rights except those expressly stated in
127  * the OpenSSL open source license shall be deemed granted or received
128  * expressly, by implication, estoppel, or otherwise.
129  *
130  * No assurances are provided by Nokia that the Contribution does not
131  * infringe the patent or other intellectual property rights of any third
132  * party or that the license provides you with all the necessary rights
133  * to make use of the Contribution.
134  *
135  * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
136  * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
137  * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
138  * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
139  * OTHERWISE. */
140 
141 #include <openssl/ssl.h>
142 
143 #include <assert.h>
144 #include <stdlib.h>
145 #include <string.h>
146 
147 #include <openssl/bytestring.h>
148 #include <openssl/crypto.h>
149 #include <openssl/err.h>
150 #include <openssl/lhash.h>
151 #include <openssl/mem.h>
152 #include <openssl/rand.h>
153 
154 #include "internal.h"
155 #include "../crypto/internal.h"
156 
157 #if defined(OPENSSL_WINDOWS)
158 #include <sys/timeb.h>
159 #else
160 #include <sys/socket.h>
161 #include <sys/time.h>
162 #endif
163 
164 
166 
167 // |SSL_R_UNKNOWN_PROTOCOL| is no longer emitted, but continue to define it
168 // to avoid downstream churn.
169 OPENSSL_DECLARE_ERROR_REASON(SSL, UNKNOWN_PROTOCOL)
170 
171 // The following errors are no longer emitted, but are used in nginx without
172 // #ifdefs.
173 OPENSSL_DECLARE_ERROR_REASON(SSL, BLOCK_CIPHER_PAD_IS_WRONG)
174 OPENSSL_DECLARE_ERROR_REASON(SSL, NO_CIPHERS_SPECIFIED)
175 
176 // Some error codes are special. Ensure the make_errors.go script never
177 // regresses this.
178 static_assert(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION ==
180  "alert reason code mismatch");
181 
182 // kMaxHandshakeSize is the maximum size, in bytes, of a handshake message.
183 static const size_t kMaxHandshakeSize = (1u << 24) - 1;
184 
189 
191  uint8_t *ptr;
192  size_t len;
193  if (!CBB_finish(cbb, &ptr, &len)) {
195  return false;
196  }
197  out->Reset(ptr, len);
198  return true;
199 }
200 
202  // Functions which use |SSL_get_error| must reset I/O and error state on
203  // entry.
204  ssl->s3->rwstate = SSL_ERROR_NONE;
205  ERR_clear_error();
207 }
208 
210  ssl->s3->read_shutdown = ssl_shutdown_error;
211  ssl->s3->read_error.reset(ERR_save_state());
212 }
213 
214 static bool check_read_error(const SSL *ssl) {
215  if (ssl->s3->read_shutdown == ssl_shutdown_error) {
216  ERR_restore_state(ssl->s3->read_error.get());
217  return false;
218  }
219  return true;
220 }
221 
222 bool ssl_can_write(const SSL *ssl) {
223  return !SSL_in_init(ssl) || ssl->s3->hs->can_early_write;
224 }
225 
226 bool ssl_can_read(const SSL *ssl) {
227  return !SSL_in_init(ssl) || ssl->s3->hs->can_early_read;
228 }
229 
230 ssl_open_record_t ssl_open_handshake(SSL *ssl, size_t *out_consumed,
231  uint8_t *out_alert, Span<uint8_t> in) {
232  *out_consumed = 0;
233  if (!check_read_error(ssl)) {
234  *out_alert = 0;
235  return ssl_open_record_error;
236  }
237  auto ret = ssl->method->open_handshake(ssl, out_consumed, out_alert, in);
238  if (ret == ssl_open_record_error) {
239  ssl_set_read_error(ssl);
240  }
241  return ret;
242 }
243 
245  uint8_t *out_alert,
246  Span<uint8_t> in) {
247  *out_consumed = 0;
248  if (!check_read_error(ssl)) {
249  *out_alert = 0;
250  return ssl_open_record_error;
251  }
252  auto ret =
253  ssl->method->open_change_cipher_spec(ssl, out_consumed, out_alert, in);
254  if (ret == ssl_open_record_error) {
255  ssl_set_read_error(ssl);
256  }
257  return ret;
258 }
259 
261  size_t *out_consumed, uint8_t *out_alert,
262  Span<uint8_t> in) {
263  *out_consumed = 0;
264  if (!check_read_error(ssl)) {
265  *out_alert = 0;
266  return ssl_open_record_error;
267  }
268  auto ret = ssl->method->open_app_data(ssl, out, out_consumed, out_alert, in);
269  if (ret == ssl_open_record_error) {
270  ssl_set_read_error(ssl);
271  }
272  return ret;
273 }
274 
275 static bool cbb_add_hex(CBB *cbb, Span<const uint8_t> in) {
276  static const char hextable[] = "0123456789abcdef";
277  uint8_t *out;
278 
279  if (!CBB_add_space(cbb, &out, in.size() * 2)) {
280  return false;
281  }
282 
283  for (uint8_t b : in) {
284  *(out++) = (uint8_t)hextable[b >> 4];
285  *(out++) = (uint8_t)hextable[b & 0xf];
286  }
287 
288  return true;
289 }
290 
291 bool ssl_log_secret(const SSL *ssl, const char *label,
292  Span<const uint8_t> secret) {
293  if (ssl->ctx->keylog_callback == NULL) {
294  return true;
295  }
296 
297  ScopedCBB cbb;
299  if (!CBB_init(cbb.get(), strlen(label) + 1 + SSL3_RANDOM_SIZE * 2 + 1 +
300  secret.size() * 2 + 1) ||
301  !CBB_add_bytes(cbb.get(), reinterpret_cast<const uint8_t *>(label),
302  strlen(label)) ||
303  !CBB_add_u8(cbb.get(), ' ') ||
304  !cbb_add_hex(cbb.get(), ssl->s3->client_random) ||
305  !CBB_add_u8(cbb.get(), ' ') ||
306  !cbb_add_hex(cbb.get(), secret) ||
307  !CBB_add_u8(cbb.get(), 0 /* NUL */) ||
308  !CBBFinishArray(cbb.get(), &line)) {
309  return false;
310  }
311 
312  ssl->ctx->keylog_callback(ssl, reinterpret_cast<const char *>(line.data()));
313  return true;
314 }
315 
316 void ssl_do_info_callback(const SSL *ssl, int type, int value) {
317  void (*cb)(const SSL *ssl, int type, int value) = NULL;
318  if (ssl->info_callback != NULL) {
319  cb = ssl->info_callback;
320  } else if (ssl->ctx->info_callback != NULL) {
321  cb = ssl->ctx->info_callback;
322  }
323 
324  if (cb != NULL) {
325  cb(ssl, type, value);
326  }
327 }
328 
329 void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type,
331  if (ssl->msg_callback == NULL) {
332  return;
333  }
334 
335  // |version| is zero when calling for |SSL3_RT_HEADER| and |SSL2_VERSION| for
336  // a V2ClientHello.
337  int version;
338  switch (content_type) {
339  case 0:
340  // V2ClientHello
342  break;
343  case SSL3_RT_HEADER:
344  version = 0;
345  break;
346  default:
347  version = SSL_version(ssl);
348  }
349 
350  ssl->msg_callback(is_write, version, content_type, in.data(), in.size(),
351  const_cast<SSL *>(ssl), ssl->msg_callback_arg);
352 }
353 
354 void ssl_get_current_time(const SSL *ssl, struct OPENSSL_timeval *out_clock) {
355  // TODO(martinkr): Change callers to |ssl_ctx_get_current_time| and drop the
356  // |ssl| arg from |current_time_cb| if possible.
357  ssl_ctx_get_current_time(ssl->ctx.get(), out_clock);
358 }
359 
361  struct OPENSSL_timeval *out_clock) {
362  if (ctx->current_time_cb != NULL) {
363  // TODO(davidben): Update current_time_cb to use OPENSSL_timeval. See
364  // https://crbug.com/boringssl/155.
365  struct timeval clock;
366  ctx->current_time_cb(nullptr /* ssl */, &clock);
367  if (clock.tv_sec < 0) {
368  assert(0);
369  out_clock->tv_sec = 0;
370  out_clock->tv_usec = 0;
371  } else {
372  out_clock->tv_sec = (uint64_t)clock.tv_sec;
373  out_clock->tv_usec = (uint32_t)clock.tv_usec;
374  }
375  return;
376  }
377 
378 #if defined(BORINGSSL_UNSAFE_DETERMINISTIC_MODE)
379  out_clock->tv_sec = 1234;
380  out_clock->tv_usec = 1234;
381 #elif defined(OPENSSL_WINDOWS)
382  struct _timeb time;
383  _ftime(&time);
384  if (time.time < 0) {
385  assert(0);
386  out_clock->tv_sec = 0;
387  out_clock->tv_usec = 0;
388  } else {
389  out_clock->tv_sec = time.time;
390  out_clock->tv_usec = time.millitm * 1000;
391  }
392 #else
393  struct timeval clock;
394  gettimeofday(&clock, NULL);
395  if (clock.tv_sec < 0) {
396  assert(0);
397  out_clock->tv_sec = 0;
398  out_clock->tv_usec = 0;
399  } else {
400  out_clock->tv_sec = (uint64_t)clock.tv_sec;
401  out_clock->tv_usec = (uint32_t)clock.tv_usec;
402  }
403 #endif
404 }
405 
407  ctx->handoff = on;
408 }
409 
410 static bool ssl_can_renegotiate(const SSL *ssl) {
411  if (ssl->server || SSL_is_dtls(ssl)) {
412  return false;
413  }
414 
415  if (ssl->s3->have_version &&
417  return false;
418  }
419 
420  // The config has already been shed.
421  if (!ssl->config) {
422  return false;
423  }
424 
425  switch (ssl->renegotiate_mode) {
428  return false;
429 
432  return true;
434  return ssl->s3->total_renegotiations == 0;
435  }
436 
437  assert(0);
438  return false;
439 }
440 
442  if (ssl->s3->hs != nullptr ||
443  ssl->config == nullptr ||
444  !ssl->config->shed_handshake_config ||
445  ssl_can_renegotiate(ssl)) {
446  return;
447  }
448 
449  ssl->config.reset();
450 }
451 
452 void SSL_set_handoff_mode(SSL *ssl, bool on) {
453  if (!ssl->config) {
454  return;
455  }
456  ssl->config->handoff = on;
457 }
458 
459 bool SSL_get_traffic_secrets(const SSL *ssl,
460  Span<const uint8_t> *out_read_traffic_secret,
461  Span<const uint8_t> *out_write_traffic_secret) {
462  if (SSL_version(ssl) < TLS1_3_VERSION) {
464  return false;
465  }
466 
467  if (!ssl->s3->initial_handshake_complete) {
469  return false;
470  }
471 
472  *out_read_traffic_secret = Span<const uint8_t>(
473  ssl->s3->read_traffic_secret, ssl->s3->read_traffic_secret_len);
474  *out_write_traffic_secret = Span<const uint8_t>(
475  ssl->s3->write_traffic_secret, ssl->s3->write_traffic_secret_len);
476 
477  return true;
478 }
479 
481 
482 using namespace bssl;
483 
484 int SSL_library_init(void) {
486  return 1;
487 }
488 
491  return 1;
492 }
493 
494 static uint32_t ssl_session_hash(const SSL_SESSION *sess) {
495  return ssl_hash_session_id(
497 }
498 
499 static int ssl_session_cmp(const SSL_SESSION *a, const SSL_SESSION *b) {
500  if (a->session_id_length != b->session_id_length) {
501  return 1;
502  }
503 
504  return OPENSSL_memcmp(a->session_id, b->session_id, a->session_id_length);
505 }
506 
509  x509_method(ssl_method->x509_method),
510  retain_only_sha256_of_client_certs(false),
511  quiet_shutdown(false),
512  ocsp_stapling_enabled(false),
513  signed_cert_timestamps_enabled(false),
514  channel_id_enabled(false),
515  grease_enabled(false),
516  permute_extensions(false),
517  allow_unknown_alpn_protos(false),
518  false_start_allowed_without_alpn(false),
519  handoff(false),
520  enable_early_data(false) {
523 }
524 
526  // Free the internal session cache. Note that this calls the caller-supplied
527  // remove callback, so we must do it before clearing ex_data. (See ticket
528  // [openssl.org #212].)
529  SSL_CTX_flush_sessions(this, 0);
530 
532 
534  lh_SSL_SESSION_free(sessions);
535  x509_method->ssl_ctx_free(this);
536 }
537 
539  if (method == NULL) {
541  return nullptr;
542  }
543 
544  UniquePtr<SSL_CTX> ret = MakeUnique<SSL_CTX>(method);
545  if (!ret) {
546  return nullptr;
547  }
548 
549  ret->cert = MakeUnique<CERT>(method->x509_method);
550  ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp);
551  ret->client_CA.reset(sk_CRYPTO_BUFFER_new_null());
552  if (ret->cert == nullptr ||
553  ret->sessions == nullptr ||
554  ret->client_CA == nullptr ||
555  !ret->x509_method->ssl_ctx_new(ret.get())) {
556  return nullptr;
557  }
558 
560  // Lock the SSL_CTX to the specified version, for compatibility with
561  // legacy uses of SSL_METHOD.
562  !SSL_CTX_set_max_proto_version(ret.get(), method->version) ||
563  !SSL_CTX_set_min_proto_version(ret.get(), method->version)) {
565  return nullptr;
566  }
567 
568  return ret.release();
569 }
570 
572  CRYPTO_refcount_inc(&ctx->references);
573  return 1;
574 }
575 
577  if (ctx == NULL ||
578  !CRYPTO_refcount_dec_and_test_zero(&ctx->references)) {
579  return;
580  }
581 
582  ctx->~ssl_ctx_st();
583  OPENSSL_free(ctx);
584 }
585 
587  : method(ctx_arg->method),
588  max_send_fragment(ctx_arg->max_send_fragment),
589  msg_callback(ctx_arg->msg_callback),
590  msg_callback_arg(ctx_arg->msg_callback_arg),
591  ctx(UpRef(ctx_arg)),
592  session_ctx(UpRef(ctx_arg)),
593  options(ctx->options),
594  mode(ctx->mode),
595  max_cert_list(ctx->max_cert_list),
596  server(false),
597  quiet_shutdown(ctx->quiet_shutdown),
598  enable_early_data(ctx->enable_early_data) {
600 }
601 
604  // |config| refers to |this|, so we must release it earlier.
605  config.reset();
606  if (method != NULL) {
607  method->ssl_free(this);
608  }
609 }
610 
612  if (ctx == nullptr) {
614  return nullptr;
615  }
616 
617  UniquePtr<SSL> ssl = MakeUnique<SSL>(ctx);
618  if (ssl == nullptr) {
619  return nullptr;
620  }
621 
622  ssl->config = MakeUnique<SSL_CONFIG>(ssl.get());
623  if (ssl->config == nullptr) {
624  return nullptr;
625  }
626  ssl->config->conf_min_version = ctx->conf_min_version;
627  ssl->config->conf_max_version = ctx->conf_max_version;
628 
629  ssl->config->cert = ssl_cert_dup(ctx->cert.get());
630  if (ssl->config->cert == nullptr) {
631  return nullptr;
632  }
633 
634  ssl->config->verify_mode = ctx->verify_mode;
635  ssl->config->verify_callback = ctx->default_verify_callback;
636  ssl->config->custom_verify_callback = ctx->custom_verify_callback;
637  ssl->config->retain_only_sha256_of_client_certs =
638  ctx->retain_only_sha256_of_client_certs;
639  ssl->config->permute_extensions = ctx->permute_extensions;
640 
641  if (!ssl->config->supported_group_list.CopyFrom(ctx->supported_group_list) ||
642  !ssl->config->alpn_client_proto_list.CopyFrom(
643  ctx->alpn_client_proto_list) ||
644  !ssl->config->verify_sigalgs.CopyFrom(ctx->verify_sigalgs)) {
645  return nullptr;
646  }
647 
648  if (ctx->psk_identity_hint) {
649  ssl->config->psk_identity_hint.reset(
650  OPENSSL_strdup(ctx->psk_identity_hint.get()));
651  if (ssl->config->psk_identity_hint == nullptr) {
652  return nullptr;
653  }
654  }
655  ssl->config->psk_client_callback = ctx->psk_client_callback;
656  ssl->config->psk_server_callback = ctx->psk_server_callback;
657 
658  ssl->config->channel_id_enabled = ctx->channel_id_enabled;
659  ssl->config->channel_id_private = UpRef(ctx->channel_id_private);
660 
661  ssl->config->signed_cert_timestamps_enabled =
662  ctx->signed_cert_timestamps_enabled;
663  ssl->config->ocsp_stapling_enabled = ctx->ocsp_stapling_enabled;
664  ssl->config->handoff = ctx->handoff;
665  ssl->quic_method = ctx->quic_method;
666 
667  if (!ssl->method->ssl_new(ssl.get()) ||
668  !ssl->ctx->x509_method->ssl_new(ssl->s3->hs.get())) {
669  return nullptr;
670  }
671 
672  return ssl.release();
673 }
674 
676  : ssl(ssl_arg),
677  ech_grease_enabled(false),
678  signed_cert_timestamps_enabled(false),
679  ocsp_stapling_enabled(false),
680  channel_id_enabled(false),
681  enforce_rsa_key_usage(false),
682  retain_only_sha256_of_client_certs(false),
683  handoff(false),
684  shed_handshake_config(false),
685  jdk11_workaround(false),
686  quic_use_legacy_codepoint(false),
687  permute_extensions(false) {
688  assert(ssl);
689 }
690 
692  if (ssl->ctx != nullptr) {
693  ssl->ctx->x509_method->ssl_config_free(this);
694  }
695 }
696 
697 void SSL_free(SSL *ssl) {
698  Delete(ssl);
699 }
700 
702  ssl->server = false;
704 }
705 
707  ssl->server = true;
709 }
710 
711 void SSL_set0_rbio(SSL *ssl, BIO *rbio) {
712  ssl->rbio.reset(rbio);
713 }
714 
715 void SSL_set0_wbio(SSL *ssl, BIO *wbio) {
716  ssl->wbio.reset(wbio);
717 }
718 
719 void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
720  // For historical reasons, this function has many different cases in ownership
721  // handling.
722 
723  // If nothing has changed, do nothing
724  if (rbio == SSL_get_rbio(ssl) && wbio == SSL_get_wbio(ssl)) {
725  return;
726  }
727 
728  // If the two arguments are equal, one fewer reference is granted than
729  // taken.
730  if (rbio != NULL && rbio == wbio) {
731  BIO_up_ref(rbio);
732  }
733 
734  // If only the wbio is changed, adopt only one reference.
735  if (rbio == SSL_get_rbio(ssl)) {
736  SSL_set0_wbio(ssl, wbio);
737  return;
738  }
739 
740  // There is an asymmetry here for historical reasons. If only the rbio is
741  // changed AND the rbio and wbio were originally different, then we only adopt
742  // one reference.
743  if (wbio == SSL_get_wbio(ssl) && SSL_get_rbio(ssl) != SSL_get_wbio(ssl)) {
744  SSL_set0_rbio(ssl, rbio);
745  return;
746  }
747 
748  // Otherwise, adopt both references.
749  SSL_set0_rbio(ssl, rbio);
750  SSL_set0_wbio(ssl, wbio);
751 }
752 
753 BIO *SSL_get_rbio(const SSL *ssl) { return ssl->rbio.get(); }
754 
755 BIO *SSL_get_wbio(const SSL *ssl) { return ssl->wbio.get(); }
756 
758  enum ssl_encryption_level_t level) {
759  // Limits flights to 16K by default when there are no large
760  // (certificate-carrying) messages.
761  static const size_t kDefaultLimit = 16384;
762 
763  switch (level) {
765  return kDefaultLimit;
767  // QUIC does not send EndOfEarlyData.
768  return 0;
770  if (ssl->server) {
771  // Servers may receive Certificate message if configured to request
772  // client certificates.
773  if (!!(ssl->config->verify_mode & SSL_VERIFY_PEER) &&
774  ssl->max_cert_list > kDefaultLimit) {
775  return ssl->max_cert_list;
776  }
777  } else {
778  // Clients may receive both Certificate message and a CertificateRequest
779  // message.
780  if (2*ssl->max_cert_list > kDefaultLimit) {
781  return 2*ssl->max_cert_list;
782  }
783  }
784  return kDefaultLimit;
786  // Note there is not actually a bound on the number of NewSessionTickets
787  // one may send in a row. This level may need more involved flow
788  // control. See https://github.com/quicwg/base-drafts/issues/1834.
789  return kDefaultLimit;
790  }
791 
792  return 0;
793 }
794 
795 enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl) {
796  return ssl->s3->read_level;
797 }
798 
799 enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl) {
800  return ssl->s3->write_level;
801 }
802 
803 int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
804  const uint8_t *data, size_t len) {
805  if (ssl->quic_method == nullptr) {
807  return 0;
808  }
809 
810  if (level != ssl->s3->read_level) {
812  return 0;
813  }
814 
815  size_t new_len = (ssl->s3->hs_buf ? ssl->s3->hs_buf->length : 0) + len;
816  if (new_len < len ||
817  new_len > SSL_quic_max_handshake_flight_len(ssl, level)) {
819  return 0;
820  }
821 
823 }
824 
827 
828  if (ssl->do_handshake == NULL) {
830  return -1;
831  }
832 
833  if (!SSL_in_init(ssl)) {
834  return 1;
835  }
836 
837  // Run the handshake.
838  SSL_HANDSHAKE *hs = ssl->s3->hs.get();
839 
840  bool early_return = false;
841  int ret = ssl_run_handshake(hs, &early_return);
844  if (ret <= 0) {
845  return ret;
846  }
847 
848  // Destroy the handshake object if the handshake has completely finished.
849  if (!early_return) {
850  ssl->s3->hs.reset();
852  }
853 
854  return 1;
855 }
856 
857 int SSL_connect(SSL *ssl) {
858  if (ssl->do_handshake == NULL) {
859  // Not properly initialized yet
861  }
862 
863  return SSL_do_handshake(ssl);
864 }
865 
866 int SSL_accept(SSL *ssl) {
867  if (ssl->do_handshake == NULL) {
868  // Not properly initialized yet
870  }
871 
872  return SSL_do_handshake(ssl);
873 }
874 
875 static int ssl_do_post_handshake(SSL *ssl, const SSLMessage &msg) {
876  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
877  return tls13_post_handshake(ssl, msg);
878  }
879 
880  // Check for renegotiation on the server before parsing to use the correct
881  // error. Renegotiation is triggered by a different message for servers.
882  if (ssl->server) {
885  return 0;
886  }
887 
888  if (msg.type != SSL3_MT_HELLO_REQUEST || CBS_len(&msg.body) != 0) {
891  return 0;
892  }
893 
895  return 1; // Ignore the HelloRequest.
896  }
897 
898  ssl->s3->renegotiate_pending = true;
900  return 1; // Handle it later.
901  }
902 
903  if (!SSL_renegotiate(ssl)) {
905  return 0;
906  }
907 
908  return 1;
909 }
910 
913 
914  if (SSL_in_init(ssl)) {
916  return 0;
917  }
918 
919  // Replay post-handshake message errors.
920  if (!check_read_error(ssl)) {
921  return 0;
922  }
923 
924  // Process any buffered post-handshake messages.
925  SSLMessage msg;
926  while (ssl->method->get_message(ssl, &msg)) {
927  // Handle the post-handshake message and try again.
928  if (!ssl_do_post_handshake(ssl, msg)) {
929  ssl_set_read_error(ssl);
930  return 0;
931  }
932  ssl->method->next_message(ssl);
933  }
934 
935  return 1;
936 }
937 
938 static int ssl_read_impl(SSL *ssl) {
940 
941  if (ssl->do_handshake == NULL) {
943  return -1;
944  }
945 
946  // Replay post-handshake message errors.
947  if (!check_read_error(ssl)) {
948  return -1;
949  }
950 
951  while (ssl->s3->pending_app_data.empty()) {
952  if (ssl->s3->renegotiate_pending) {
953  ssl->s3->rwstate = SSL_ERROR_WANT_RENEGOTIATE;
954  return -1;
955  }
956 
957  // Complete the current handshake, if any. False Start will cause
958  // |SSL_do_handshake| to return mid-handshake, so this may require multiple
959  // iterations.
960  while (!ssl_can_read(ssl)) {
961  int ret = SSL_do_handshake(ssl);
962  if (ret < 0) {
963  return ret;
964  }
965  if (ret == 0) {
967  return -1;
968  }
969  }
970 
971  // Process any buffered post-handshake messages.
972  SSLMessage msg;
973  if (ssl->method->get_message(ssl, &msg)) {
974  // If we received an interrupt in early read (EndOfEarlyData), loop again
975  // for the handshake to process it.
976  if (SSL_in_init(ssl)) {
977  ssl->s3->hs->can_early_read = false;
978  continue;
979  }
980 
981  // Handle the post-handshake message and try again.
982  if (!ssl_do_post_handshake(ssl, msg)) {
983  ssl_set_read_error(ssl);
984  return -1;
985  }
986  ssl->method->next_message(ssl);
987  continue; // Loop again. We may have begun a new handshake.
988  }
989 
991  size_t consumed = 0;
992  auto ret = ssl_open_app_data(ssl, &ssl->s3->pending_app_data, &consumed,
993  &alert, ssl->s3->read_buffer.span());
994  bool retry;
995  int bio_ret = ssl_handle_open_record(ssl, &retry, ret, consumed, alert);
996  if (bio_ret <= 0) {
997  return bio_ret;
998  }
999  if (!retry) {
1000  assert(!ssl->s3->pending_app_data.empty());
1001  ssl->s3->key_update_count = 0;
1002  }
1003  }
1004 
1005  return 1;
1006 }
1007 
1008 int SSL_read(SSL *ssl, void *buf, int num) {
1009  int ret = SSL_peek(ssl, buf, num);
1010  if (ret <= 0) {
1011  return ret;
1012  }
1013  // TODO(davidben): In DTLS, should the rest of the record be discarded? DTLS
1014  // is not a stream. See https://crbug.com/boringssl/65.
1015  ssl->s3->pending_app_data =
1016  ssl->s3->pending_app_data.subspan(static_cast<size_t>(ret));
1017  if (ssl->s3->pending_app_data.empty()) {
1018  ssl->s3->read_buffer.DiscardConsumed();
1019  }
1020  return ret;
1021 }
1022 
1023 int SSL_peek(SSL *ssl, void *buf, int num) {
1024  if (ssl->quic_method != nullptr) {
1026  return -1;
1027  }
1028 
1029  int ret = ssl_read_impl(ssl);
1030  if (ret <= 0) {
1031  return ret;
1032  }
1033  if (num <= 0) {
1034  return num;
1035  }
1036  size_t todo =
1037  std::min(ssl->s3->pending_app_data.size(), static_cast<size_t>(num));
1038  OPENSSL_memcpy(buf, ssl->s3->pending_app_data.data(), todo);
1039  return static_cast<int>(todo);
1040 }
1041 
1042 int SSL_write(SSL *ssl, const void *buf, int num) {
1043  ssl_reset_error_state(ssl);
1044 
1045  if (ssl->quic_method != nullptr) {
1047  return -1;
1048  }
1049 
1050  if (ssl->do_handshake == NULL) {
1052  return -1;
1053  }
1054 
1055  int ret = 0;
1056  bool needs_handshake = false;
1057  do {
1058  // If necessary, complete the handshake implicitly.
1059  if (!ssl_can_write(ssl)) {
1060  ret = SSL_do_handshake(ssl);
1061  if (ret < 0) {
1062  return ret;
1063  }
1064  if (ret == 0) {
1066  return -1;
1067  }
1068  }
1069 
1070  ret = ssl->method->write_app_data(ssl, &needs_handshake,
1071  (const uint8_t *)buf, num);
1072  } while (needs_handshake);
1073  return ret;
1074 }
1075 
1076 int SSL_key_update(SSL *ssl, int request_type) {
1077  ssl_reset_error_state(ssl);
1078 
1079  if (ssl->do_handshake == NULL) {
1081  return 0;
1082  }
1083 
1084  if (ssl->ctx->quic_method != nullptr) {
1086  return 0;
1087  }
1088 
1089  if (!ssl->s3->initial_handshake_complete) {
1091  return 0;
1092  }
1093 
1094  if (ssl_protocol_version(ssl) < TLS1_3_VERSION) {
1096  return 0;
1097  }
1098 
1099  if (!ssl->s3->key_update_pending &&
1100  !tls13_add_key_update(ssl, request_type)) {
1101  return 0;
1102  }
1103 
1104  return 1;
1105 }
1106 
1107 int SSL_shutdown(SSL *ssl) {
1108  ssl_reset_error_state(ssl);
1109 
1110  if (ssl->do_handshake == NULL) {
1112  return -1;
1113  }
1114 
1115  // If we are in the middle of a handshake, silently succeed. Consumers often
1116  // call this function before |SSL_free|, whether the handshake succeeded or
1117  // not. We assume the caller has already handled failed handshakes.
1118  if (SSL_in_init(ssl)) {
1119  return 1;
1120  }
1121 
1122  if (ssl->quiet_shutdown) {
1123  // Do nothing if configured not to send a close_notify.
1124  ssl->s3->write_shutdown = ssl_shutdown_close_notify;
1125  ssl->s3->read_shutdown = ssl_shutdown_close_notify;
1126  return 1;
1127  }
1128 
1129  // This function completes in two stages. It sends a close_notify and then it
1130  // waits for a close_notify to come in. Perform exactly one action and return
1131  // whether or not it succeeds.
1132 
1133  if (ssl->s3->write_shutdown != ssl_shutdown_close_notify) {
1134  // Send a close_notify.
1136  return -1;
1137  }
1138  } else if (ssl->s3->alert_dispatch) {
1139  // Finish sending the close_notify.
1140  if (ssl->method->dispatch_alert(ssl) <= 0) {
1141  return -1;
1142  }
1143  } else if (ssl->s3->read_shutdown != ssl_shutdown_close_notify) {
1144  if (SSL_is_dtls(ssl)) {
1145  // Bidirectional shutdown doesn't make sense for an unordered
1146  // transport. DTLS alerts also aren't delivered reliably, so we may even
1147  // time out because the peer never received our close_notify. Report to
1148  // the caller that the channel has fully shut down.
1149  if (ssl->s3->read_shutdown == ssl_shutdown_error) {
1150  ERR_restore_state(ssl->s3->read_error.get());
1151  return -1;
1152  }
1153  ssl->s3->read_shutdown = ssl_shutdown_close_notify;
1154  } else {
1155  // Process records until an error, close_notify, or application data.
1156  if (ssl_read_impl(ssl) > 0) {
1157  // We received some unexpected application data.
1159  return -1;
1160  }
1161  if (ssl->s3->read_shutdown != ssl_shutdown_close_notify) {
1162  return -1;
1163  }
1164  }
1165  }
1166 
1167  // Return 0 for unidirectional shutdown and 1 for bidirectional shutdown.
1168  return ssl->s3->read_shutdown == ssl_shutdown_close_notify;
1169 }
1170 
1172  if (ssl->s3->alert_dispatch) {
1173  if (ssl->s3->send_alert[0] != SSL3_AL_FATAL ||
1174  ssl->s3->send_alert[1] != alert) {
1175  // We are already attempting to write a different alert.
1177  return -1;
1178  }
1179  return ssl->method->dispatch_alert(ssl);
1180  }
1181 
1182  return ssl_send_alert_impl(ssl, SSL3_AL_FATAL, alert);
1183 }
1184 
1186  size_t params_len) {
1187  return ssl->config && ssl->config->quic_transport_params.CopyFrom(
1188  MakeConstSpan(params, params_len));
1189 }
1190 
1192  const uint8_t **out_params,
1193  size_t *out_params_len) {
1194  *out_params = ssl->s3->peer_quic_transport_params.data();
1195  *out_params_len = ssl->s3->peer_quic_transport_params.size();
1196 }
1197 
1199  size_t context_len) {
1200  return ssl->config && ssl->config->quic_early_data_context.CopyFrom(
1201  MakeConstSpan(context, context_len));
1202 }
1203 
1205  ctx->enable_early_data = !!enabled;
1206 }
1207 
1208 void SSL_set_early_data_enabled(SSL *ssl, int enabled) {
1209  ssl->enable_early_data = !!enabled;
1210 }
1211 
1212 int SSL_in_early_data(const SSL *ssl) {
1213  if (ssl->s3->hs == NULL) {
1214  return 0;
1215  }
1216  return ssl->s3->hs->in_early_data;
1217 }
1218 
1219 int SSL_early_data_accepted(const SSL *ssl) {
1220  return ssl->s3->early_data_accepted;
1221 }
1222 
1224  SSL_HANDSHAKE *hs = ssl->s3->hs.get();
1225  if (hs == NULL ||
1227  abort();
1228  }
1229 
1230  hs->wait = ssl_hs_ok;
1231  hs->in_early_data = false;
1232  hs->early_session.reset();
1233 
1234  // Discard any unfinished writes from the perspective of |SSL_write|'s
1235  // retry. The handshake will transparently flush out the pending record
1236  // (discarded by the server) to keep the framing correct.
1237  ssl->s3->wpend_pending = false;
1238 }
1239 
1240 enum ssl_early_data_reason_t SSL_get_early_data_reason(const SSL *ssl) {
1241  return ssl->s3->early_data_reason;
1242 }
1243 
1244 const char *SSL_early_data_reason_string(enum ssl_early_data_reason_t reason) {
1245  switch (reason) {
1247  return "unknown";
1249  return "disabled";
1251  return "accepted";
1253  return "protocol_version";
1255  return "peer_declined";
1257  return "no_session_offered";
1259  return "session_not_resumed";
1261  return "unsupported_for_session";
1263  return "hello_retry_request";
1265  return "alpn_mismatch";
1267  return "channel_id";
1269  return "ticket_age_skew";
1271  return "quic_parameter_mismatch";
1273  return "alps_mismatch";
1274  }
1275 
1276  return nullptr;
1277 }
1278 
1279 static int bio_retry_reason_to_error(int reason) {
1280  switch (reason) {
1281  case BIO_RR_CONNECT:
1282  return SSL_ERROR_WANT_CONNECT;
1283  case BIO_RR_ACCEPT:
1284  return SSL_ERROR_WANT_ACCEPT;
1285  default:
1286  return SSL_ERROR_SYSCALL;
1287  }
1288 }
1289 
1290 int SSL_get_error(const SSL *ssl, int ret_code) {
1291  if (ret_code > 0) {
1292  return SSL_ERROR_NONE;
1293  }
1294 
1295  // Make things return SSL_ERROR_SYSCALL when doing SSL_do_handshake etc,
1296  // where we do encode the error
1298  if (err != 0) {
1299  if (ERR_GET_LIB(err) == ERR_LIB_SYS) {
1300  return SSL_ERROR_SYSCALL;
1301  }
1302  return SSL_ERROR_SSL;
1303  }
1304 
1305  if (ret_code == 0) {
1306  if (ssl->s3->read_shutdown == ssl_shutdown_close_notify) {
1307  return SSL_ERROR_ZERO_RETURN;
1308  }
1309  // An EOF was observed which violates the protocol, and the underlying
1310  // transport does not participate in the error queue. Bubble up to the
1311  // caller.
1312  return SSL_ERROR_SYSCALL;
1313  }
1314 
1315  switch (ssl->s3->rwstate) {
1318  case SSL_ERROR_HANDOFF:
1319  case SSL_ERROR_HANDBACK:
1327  return ssl->s3->rwstate;
1328 
1329  case SSL_ERROR_WANT_READ: {
1330  if (ssl->quic_method) {
1331  return SSL_ERROR_WANT_READ;
1332  }
1333  BIO *bio = SSL_get_rbio(ssl);
1334  if (BIO_should_read(bio)) {
1335  return SSL_ERROR_WANT_READ;
1336  }
1337 
1338  if (BIO_should_write(bio)) {
1339  // TODO(davidben): OpenSSL historically checked for writes on the read
1340  // BIO. Can this be removed?
1341  return SSL_ERROR_WANT_WRITE;
1342  }
1343 
1344  if (BIO_should_io_special(bio)) {
1346  }
1347 
1348  break;
1349  }
1350 
1351  case SSL_ERROR_WANT_WRITE: {
1352  BIO *bio = SSL_get_wbio(ssl);
1353  if (BIO_should_write(bio)) {
1354  return SSL_ERROR_WANT_WRITE;
1355  }
1356 
1357  if (BIO_should_read(bio)) {
1358  // TODO(davidben): OpenSSL historically checked for reads on the write
1359  // BIO. Can this be removed?
1360  return SSL_ERROR_WANT_READ;
1361  }
1362 
1363  if (BIO_should_io_special(bio)) {
1365  }
1366 
1367  break;
1368  }
1369  }
1370 
1371  return SSL_ERROR_SYSCALL;
1372 }
1373 
1374 const char *SSL_error_description(int err) {
1375  switch (err) {
1376  case SSL_ERROR_NONE:
1377  return "NONE";
1378  case SSL_ERROR_SSL:
1379  return "SSL";
1380  case SSL_ERROR_WANT_READ:
1381  return "WANT_READ";
1382  case SSL_ERROR_WANT_WRITE:
1383  return "WANT_WRITE";
1385  return "WANT_X509_LOOKUP";
1386  case SSL_ERROR_SYSCALL:
1387  return "SYSCALL";
1388  case SSL_ERROR_ZERO_RETURN:
1389  return "ZERO_RETURN";
1391  return "WANT_CONNECT";
1392  case SSL_ERROR_WANT_ACCEPT:
1393  return "WANT_ACCEPT";
1395  return "PENDING_SESSION";
1397  return "PENDING_CERTIFICATE";
1399  return "WANT_PRIVATE_KEY_OPERATION";
1401  return "PENDING_TICKET";
1403  return "EARLY_DATA_REJECTED";
1405  return "WANT_CERTIFICATE_VERIFY";
1406  case SSL_ERROR_HANDOFF:
1407  return "HANDOFF";
1408  case SSL_ERROR_HANDBACK:
1409  return "HANDBACK";
1411  return "WANT_RENEGOTIATE";
1413  return "HANDSHAKE_HINTS_READY";
1414  default:
1415  return nullptr;
1416  }
1417 }
1418 
1420  ctx->options |= options;
1421  return ctx->options;
1422 }
1423 
1425  ctx->options &= ~options;
1426  return ctx->options;
1427 }
1428 
1429 uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) { return ctx->options; }
1430 
1432  ssl->options |= options;
1433  return ssl->options;
1434 }
1435 
1437  ssl->options &= ~options;
1438  return ssl->options;
1439 }
1440 
1441 uint32_t SSL_get_options(const SSL *ssl) { return ssl->options; }
1442 
1444  ctx->mode |= mode;
1445  return ctx->mode;
1446 }
1447 
1449  ctx->mode &= ~mode;
1450  return ctx->mode;
1451 }
1452 
1453 uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return ctx->mode; }
1454 
1456  ssl->mode |= mode;
1457  return ssl->mode;
1458 }
1459 
1461  ssl->mode &= ~mode;
1462  return ssl->mode;
1463 }
1464 
1465 uint32_t SSL_get_mode(const SSL *ssl) { return ssl->mode; }
1466 
1468  ctx->pool = pool;
1469 }
1470 
1471 int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
1472  size_t max_out) {
1473  *out_len = 0;
1474  OPENSSL_memset(out, 0, max_out);
1475 
1476  // tls-unique is not defined for TLS 1.3.
1477  if (!ssl->s3->initial_handshake_complete ||
1479  return 0;
1480  }
1481 
1482  // The tls-unique value is the first Finished message in the handshake, which
1483  // is the client's in a full handshake and the server's for a resumption. See
1484  // https://tools.ietf.org/html/rfc5929#section-3.1.
1485  const uint8_t *finished = ssl->s3->previous_client_finished;
1486  size_t finished_len = ssl->s3->previous_client_finished_len;
1487  if (ssl->session != NULL) {
1488  // tls-unique is broken for resumed sessions unless EMS is used.
1489  if (!ssl->session->extended_master_secret) {
1490  return 0;
1491  }
1492  finished = ssl->s3->previous_server_finished;
1493  finished_len = ssl->s3->previous_server_finished_len;
1494  }
1495 
1496  *out_len = finished_len;
1497  if (finished_len > max_out) {
1498  *out_len = max_out;
1499  }
1500 
1501  OPENSSL_memcpy(out, finished, *out_len);
1502  return 1;
1503 }
1504 
1505 static int set_session_id_context(CERT *cert, const uint8_t *sid_ctx,
1506  size_t sid_ctx_len) {
1507  if (sid_ctx_len > sizeof(cert->sid_ctx)) {
1509  return 0;
1510  }
1511 
1512  static_assert(sizeof(cert->sid_ctx) < 256, "sid_ctx too large");
1513  cert->sid_ctx_length = (uint8_t)sid_ctx_len;
1514  OPENSSL_memcpy(cert->sid_ctx, sid_ctx, sid_ctx_len);
1515  return 1;
1516 }
1517 
1519  size_t sid_ctx_len) {
1520  return set_session_id_context(ctx->cert.get(), sid_ctx, sid_ctx_len);
1521 }
1522 
1523 int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
1524  size_t sid_ctx_len) {
1525  if (!ssl->config) {
1526  return 0;
1527  }
1528  return set_session_id_context(ssl->config->cert.get(), sid_ctx, sid_ctx_len);
1529 }
1530 
1531 const uint8_t *SSL_get0_session_id_context(const SSL *ssl, size_t *out_len) {
1532  if (!ssl->config) {
1533  assert(ssl->config);
1534  *out_len = 0;
1535  return NULL;
1536  }
1537  *out_len = ssl->config->cert->sid_ctx_length;
1538  return ssl->config->cert->sid_ctx;
1539 }
1540 
1541 void SSL_certs_clear(SSL *ssl) {
1542  if (!ssl->config) {
1543  return;
1544  }
1545  ssl_cert_clear_certs(ssl->config->cert.get());
1546 }
1547 
1548 int SSL_get_fd(const SSL *ssl) { return SSL_get_rfd(ssl); }
1549 
1550 int SSL_get_rfd(const SSL *ssl) {
1551  int ret = -1;
1553  if (b != NULL) {
1554  BIO_get_fd(b, &ret);
1555  }
1556  return ret;
1557 }
1558 
1559 int SSL_get_wfd(const SSL *ssl) {
1560  int ret = -1;
1562  if (b != NULL) {
1563  BIO_get_fd(b, &ret);
1564  }
1565  return ret;
1566 }
1567 
1568 int SSL_set_fd(SSL *ssl, int fd) {
1569  BIO *bio = BIO_new(BIO_s_socket());
1570  if (bio == NULL) {
1572  return 0;
1573  }
1574  BIO_set_fd(bio, fd, BIO_NOCLOSE);
1575  SSL_set_bio(ssl, bio, bio);
1576  return 1;
1577 }
1578 
1579 int SSL_set_wfd(SSL *ssl, int fd) {
1580  BIO *rbio = SSL_get_rbio(ssl);
1581  if (rbio == NULL || BIO_method_type(rbio) != BIO_TYPE_SOCKET ||
1582  BIO_get_fd(rbio, NULL) != fd) {
1583  BIO *bio = BIO_new(BIO_s_socket());
1584  if (bio == NULL) {
1586  return 0;
1587  }
1588  BIO_set_fd(bio, fd, BIO_NOCLOSE);
1589  SSL_set0_wbio(ssl, bio);
1590  } else {
1591  // Copy the rbio over to the wbio.
1592  BIO_up_ref(rbio);
1593  SSL_set0_wbio(ssl, rbio);
1594  }
1595 
1596  return 1;
1597 }
1598 
1599 int SSL_set_rfd(SSL *ssl, int fd) {
1600  BIO *wbio = SSL_get_wbio(ssl);
1601  if (wbio == NULL || BIO_method_type(wbio) != BIO_TYPE_SOCKET ||
1602  BIO_get_fd(wbio, NULL) != fd) {
1603  BIO *bio = BIO_new(BIO_s_socket());
1604  if (bio == NULL) {
1606  return 0;
1607  }
1608  BIO_set_fd(bio, fd, BIO_NOCLOSE);
1609  SSL_set0_rbio(ssl, bio);
1610  } else {
1611  // Copy the wbio over to the rbio.
1612  BIO_up_ref(wbio);
1613  SSL_set0_rbio(ssl, wbio);
1614  }
1615  return 1;
1616 }
1617 
1618 static size_t copy_finished(void *out, size_t out_len, const uint8_t *in,
1619  size_t in_len) {
1620  if (out_len > in_len) {
1621  out_len = in_len;
1622  }
1623  OPENSSL_memcpy(out, in, out_len);
1624  return in_len;
1625 }
1626 
1627 size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count) {
1628  if (!ssl->s3->initial_handshake_complete ||
1630  return 0;
1631  }
1632 
1633  if (ssl->server) {
1634  return copy_finished(buf, count, ssl->s3->previous_server_finished,
1635  ssl->s3->previous_server_finished_len);
1636  }
1637 
1638  return copy_finished(buf, count, ssl->s3->previous_client_finished,
1639  ssl->s3->previous_client_finished_len);
1640 }
1641 
1642 size_t SSL_get_peer_finished(const SSL *ssl, void *buf, size_t count) {
1643  if (!ssl->s3->initial_handshake_complete ||
1645  return 0;
1646  }
1647 
1648  if (ssl->server) {
1649  return copy_finished(buf, count, ssl->s3->previous_client_finished,
1650  ssl->s3->previous_client_finished_len);
1651  }
1652 
1653  return copy_finished(buf, count, ssl->s3->previous_server_finished,
1654  ssl->s3->previous_server_finished_len);
1655 }
1656 
1657 int SSL_get_verify_mode(const SSL *ssl) {
1658  if (!ssl->config) {
1659  assert(ssl->config);
1660  return -1;
1661  }
1662  return ssl->config->verify_mode;
1663 }
1664 
1665 int SSL_get_extms_support(const SSL *ssl) {
1666  // TLS 1.3 does not require extended master secret and always reports as
1667  // supporting it.
1668  if (!ssl->s3->have_version) {
1669  return 0;
1670  }
1671  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
1672  return 1;
1673  }
1674 
1675  // If the initial handshake completed, query the established session.
1676  if (ssl->s3->established_session != NULL) {
1677  return ssl->s3->established_session->extended_master_secret;
1678  }
1679 
1680  // Otherwise, query the in-progress handshake.
1681  if (ssl->s3->hs != NULL) {
1682  return ssl->s3->hs->extended_master_secret;
1683  }
1684  assert(0);
1685  return 0;
1686 }
1687 
1688 int SSL_CTX_get_read_ahead(const SSL_CTX *ctx) { return 0; }
1689 
1690 int SSL_get_read_ahead(const SSL *ssl) { return 0; }
1691 
1692 int SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes) { return 1; }
1693 
1694 int SSL_set_read_ahead(SSL *ssl, int yes) { return 1; }
1695 
1696 int SSL_pending(const SSL *ssl) {
1697  return static_cast<int>(ssl->s3->pending_app_data.size());
1698 }
1699 
1700 int SSL_has_pending(const SSL *ssl) {
1701  return SSL_pending(ssl) != 0 || !ssl->s3->read_buffer.empty();
1702 }
1703 
1705  return ssl_cert_check_private_key(ctx->cert.get(),
1706  ctx->cert->privatekey.get());
1707 }
1708 
1709 int SSL_check_private_key(const SSL *ssl) {
1710  if (!ssl->config) {
1711  return 0;
1712  }
1713  return ssl_cert_check_private_key(ssl->config->cert.get(),
1714  ssl->config->cert->privatekey.get());
1715 }
1716 
1717 long SSL_get_default_timeout(const SSL *ssl) {
1719 }
1720 
1722  // Caller-initiated renegotiation is not supported.
1723  if (!ssl->s3->renegotiate_pending) {
1725  return 0;
1726  }
1727 
1728  if (!ssl_can_renegotiate(ssl)) {
1730  return 0;
1731  }
1732 
1733  // We should not have told the caller to release the private key.
1734  assert(!SSL_can_release_private_key(ssl));
1735 
1736  // Renegotiation is only supported at quiescent points in the application
1737  // protocol, namely in HTTPS, just before reading the HTTP response.
1738  // Require the record-layer be idle and avoid complexities of sending a
1739  // handshake record while an application_data record is being written.
1740  if (!ssl->s3->write_buffer.empty() ||
1741  ssl->s3->write_shutdown != ssl_shutdown_none) {
1743  return 0;
1744  }
1745 
1746  // Begin a new handshake.
1747  if (ssl->s3->hs != nullptr) {
1749  return 0;
1750  }
1751  ssl->s3->hs = ssl_handshake_new(ssl);
1752  if (ssl->s3->hs == nullptr) {
1753  return 0;
1754  }
1755 
1756  ssl->s3->renegotiate_pending = false;
1757  ssl->s3->total_renegotiations++;
1758  return 1;
1759 }
1760 
1762  return SSL_in_init(ssl) && ssl->s3->initial_handshake_complete;
1763 }
1764 
1766  return ssl->s3->total_renegotiations;
1767 }
1768 
1770  return ctx->max_cert_list;
1771 }
1772 
1773 void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, size_t max_cert_list) {
1774  if (max_cert_list > kMaxHandshakeSize) {
1775  max_cert_list = kMaxHandshakeSize;
1776  }
1777  ctx->max_cert_list = (uint32_t)max_cert_list;
1778 }
1779 
1780 size_t SSL_get_max_cert_list(const SSL *ssl) {
1781  return ssl->max_cert_list;
1782 }
1783 
1784 void SSL_set_max_cert_list(SSL *ssl, size_t max_cert_list) {
1785  if (max_cert_list > kMaxHandshakeSize) {
1786  max_cert_list = kMaxHandshakeSize;
1787  }
1788  ssl->max_cert_list = (uint32_t)max_cert_list;
1789 }
1790 
1791 int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment) {
1792  if (max_send_fragment < 512) {
1793  max_send_fragment = 512;
1794  }
1795  if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
1796  max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
1797  }
1798  ctx->max_send_fragment = (uint16_t)max_send_fragment;
1799 
1800  return 1;
1801 }
1802 
1803 int SSL_set_max_send_fragment(SSL *ssl, size_t max_send_fragment) {
1804  if (max_send_fragment < 512) {
1805  max_send_fragment = 512;
1806  }
1807  if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
1808  max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
1809  }
1810  ssl->max_send_fragment = (uint16_t)max_send_fragment;
1811 
1812  return 1;
1813 }
1814 
1815 int SSL_set_mtu(SSL *ssl, unsigned mtu) {
1816  if (!SSL_is_dtls(ssl) || mtu < dtls1_min_mtu()) {
1817  return 0;
1818  }
1819  ssl->d1->mtu = mtu;
1820  return 1;
1821 }
1822 
1824  if (!ssl->s3->have_version) {
1825  return 0;
1826  }
1827  return ssl_protocol_version(ssl) >= TLS1_3_VERSION ||
1828  ssl->s3->send_connection_binding;
1829 }
1830 
1832  MutexReadLock lock(const_cast<CRYPTO_MUTEX *>(&ctx->lock));
1833  return lh_SSL_SESSION_num_items(ctx->sessions);
1834 }
1835 
1836 unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, unsigned long size) {
1837  unsigned long ret = ctx->session_cache_size;
1838  ctx->session_cache_size = size;
1839  return ret;
1840 }
1841 
1842 unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx) {
1843  return ctx->session_cache_size;
1844 }
1845 
1847  int ret = ctx->session_cache_mode;
1848  ctx->session_cache_mode = mode;
1849  return ret;
1850 }
1851 
1853  return ctx->session_cache_mode;
1854 }
1855 
1856 
1858  if (out == NULL) {
1859  return 48;
1860  }
1861  if (len != 48) {
1863  return 0;
1864  }
1865 
1866  // The default ticket keys are initialized lazily. Trigger a key
1867  // rotation to initialize them.
1869  return 0;
1870  }
1871 
1872  uint8_t *out_bytes = reinterpret_cast<uint8_t *>(out);
1873  MutexReadLock lock(&ctx->lock);
1874  OPENSSL_memcpy(out_bytes, ctx->ticket_key_current->name, 16);
1875  OPENSSL_memcpy(out_bytes + 16, ctx->ticket_key_current->hmac_key, 16);
1876  OPENSSL_memcpy(out_bytes + 32, ctx->ticket_key_current->aes_key, 16);
1877  return 1;
1878 }
1879 
1880 int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
1881  if (in == NULL) {
1882  return 48;
1883  }
1884  if (len != 48) {
1886  return 0;
1887  }
1888  auto key = MakeUnique<TicketKey>();
1889  if (!key) {
1890  return 0;
1891  }
1892  const uint8_t *in_bytes = reinterpret_cast<const uint8_t *>(in);
1893  OPENSSL_memcpy(key->name, in_bytes, 16);
1894  OPENSSL_memcpy(key->hmac_key, in_bytes + 16, 16);
1895  OPENSSL_memcpy(key->aes_key, in_bytes + 32, 16);
1896  // Disable automatic key rotation for manually-configured keys. This is now
1897  // the caller's responsibility.
1898  key->next_rotation_tv_sec = 0;
1899  ctx->ticket_key_current = std::move(key);
1900  ctx->ticket_key_prev.reset();
1901  return 1;
1902 }
1903 
1905  SSL_CTX *ctx, int (*callback)(SSL *ssl, uint8_t *key_name, uint8_t *iv,
1906  EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx,
1907  int encrypt)) {
1908  ctx->ticket_key_cb = callback;
1909  return 1;
1910 }
1911 
1912 int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves, size_t curves_len) {
1913  return tls1_set_curves(&ctx->supported_group_list,
1914  MakeConstSpan(curves, curves_len));
1915 }
1916 
1917 int SSL_set1_curves(SSL *ssl, const int *curves, size_t curves_len) {
1918  if (!ssl->config) {
1919  return 0;
1920  }
1921  return tls1_set_curves(&ssl->config->supported_group_list,
1922  MakeConstSpan(curves, curves_len));
1923 }
1924 
1925 int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves) {
1926  return tls1_set_curves_list(&ctx->supported_group_list, curves);
1927 }
1928 
1929 int SSL_set1_curves_list(SSL *ssl, const char *curves) {
1930  if (!ssl->config) {
1931  return 0;
1932  }
1933  return tls1_set_curves_list(&ssl->config->supported_group_list, curves);
1934 }
1935 
1937  // TODO(davidben): This checks the wrong session if there is a renegotiation
1938  // in progress.
1939  SSL_SESSION *session = SSL_get_session(ssl);
1940  if (session == NULL) {
1941  return 0;
1942  }
1943 
1944  return session->group_id;
1945 }
1946 
1947 int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh) {
1948  return 1;
1949 }
1950 
1951 int SSL_set_tmp_dh(SSL *ssl, const DH *dh) {
1952  return 1;
1953 }
1954 
1956  return ctx->cipher_list->ciphers.get();
1957 }
1958 
1959 int SSL_CTX_cipher_in_group(const SSL_CTX *ctx, size_t i) {
1960  if (i >= sk_SSL_CIPHER_num(ctx->cipher_list->ciphers.get())) {
1961  return 0;
1962  }
1963  return ctx->cipher_list->in_group_flags[i];
1964 }
1965 
1966 STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
1967  if (ssl == NULL) {
1968  return NULL;
1969  }
1970  if (ssl->config == NULL) {
1971  assert(ssl->config);
1972  return NULL;
1973  }
1974 
1975  return ssl->config->cipher_list ? ssl->config->cipher_list->ciphers.get()
1976  : ssl->ctx->cipher_list->ciphers.get();
1977 }
1978 
1979 const char *SSL_get_cipher_list(const SSL *ssl, int n) {
1980  if (ssl == NULL) {
1981  return NULL;
1982  }
1983 
1984  STACK_OF(SSL_CIPHER) *sk = SSL_get_ciphers(ssl);
1985  if (sk == NULL || n < 0 || (size_t)n >= sk_SSL_CIPHER_num(sk)) {
1986  return NULL;
1987  }
1988 
1989  const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, n);
1990  if (c == NULL) {
1991  return NULL;
1992  }
1993 
1994  return c->name;
1995 }
1996 
1998  return ssl_create_cipher_list(&ctx->cipher_list, str, false /* not strict */);
1999 }
2000 
2002  return ssl_create_cipher_list(&ctx->cipher_list, str, true /* strict */);
2003 }
2004 
2005 int SSL_set_cipher_list(SSL *ssl, const char *str) {
2006  if (!ssl->config) {
2007  return 0;
2008  }
2009  return ssl_create_cipher_list(&ssl->config->cipher_list, str,
2010  false /* not strict */);
2011 }
2012 
2013 int SSL_set_strict_cipher_list(SSL *ssl, const char *str) {
2014  if (!ssl->config) {
2015  return 0;
2016  }
2017  return ssl_create_cipher_list(&ssl->config->cipher_list, str,
2018  true /* strict */);
2019 }
2020 
2021 const char *SSL_get_servername(const SSL *ssl, const int type) {
2023  return NULL;
2024  }
2025 
2026  // Historically, |SSL_get_servername| was also the configuration getter
2027  // corresponding to |SSL_set_tlsext_host_name|.
2028  if (ssl->hostname != nullptr) {
2029  return ssl->hostname.get();
2030  }
2031 
2032  return ssl->s3->hostname.get();
2033 }
2034 
2035 int SSL_get_servername_type(const SSL *ssl) {
2036  if (SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name) == NULL) {
2037  return -1;
2038  }
2040 }
2041 
2043  SSL_CTX *ctx, int mode,
2044  enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert)) {
2045  ctx->verify_mode = mode;
2046  ctx->custom_verify_callback = callback;
2047 }
2048 
2050  SSL *ssl, int mode,
2051  enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert)) {
2052  if (!ssl->config) {
2053  return;
2054  }
2055  ssl->config->verify_mode = mode;
2056  ssl->config->custom_verify_callback = callback;
2057 }
2058 
2060  ctx->signed_cert_timestamps_enabled = true;
2061 }
2062 
2064  if (!ssl->config) {
2065  return;
2066  }
2067  ssl->config->signed_cert_timestamps_enabled = true;
2068 }
2069 
2071  ctx->ocsp_stapling_enabled = true;
2072 }
2073 
2075  if (!ssl->config) {
2076  return;
2077  }
2078  ssl->config->ocsp_stapling_enabled = true;
2079 }
2080 
2082  size_t *out_len) {
2083  SSL_SESSION *session = SSL_get_session(ssl);
2084  if (ssl->server || !session || !session->signed_cert_timestamp_list) {
2085  *out_len = 0;
2086  *out = NULL;
2087  return;
2088  }
2089 
2091  *out_len = CRYPTO_BUFFER_len(session->signed_cert_timestamp_list.get());
2092 }
2093 
2094 void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
2095  size_t *out_len) {
2096  SSL_SESSION *session = SSL_get_session(ssl);
2097  if (ssl->server || !session || !session->ocsp_response) {
2098  *out_len = 0;
2099  *out = NULL;
2100  return;
2101  }
2102 
2103  *out = CRYPTO_BUFFER_data(session->ocsp_response.get());
2104  *out_len = CRYPTO_BUFFER_len(session->ocsp_response.get());
2105 }
2106 
2107 int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
2108  ssl->hostname.reset();
2109  if (name == nullptr) {
2110  return 1;
2111  }
2112 
2113  size_t len = strlen(name);
2114  if (len == 0 || len > TLSEXT_MAXLEN_host_name) {
2116  return 0;
2117  }
2118  ssl->hostname.reset(OPENSSL_strdup(name));
2119  if (ssl->hostname == nullptr) {
2121  return 0;
2122  }
2123  return 1;
2124 }
2125 
2127  SSL_CTX *ctx, int (*callback)(SSL *ssl, int *out_alert, void *arg)) {
2128  ctx->servername_callback = callback;
2129  return 1;
2130 }
2131 
2133  ctx->servername_arg = arg;
2134  return 1;
2135 }
2136 
2137 int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
2138  unsigned peer_len, const uint8_t *supported,
2139  unsigned supported_len) {
2140  const uint8_t *result;
2141  int status;
2142 
2143  // For each protocol in peer preference order, see if we support it.
2144  for (unsigned i = 0; i < peer_len;) {
2145  for (unsigned j = 0; j < supported_len;) {
2146  if (peer[i] == supported[j] &&
2147  OPENSSL_memcmp(&peer[i + 1], &supported[j + 1], peer[i]) == 0) {
2148  // We found a match
2149  result = &peer[i];
2151  goto found;
2152  }
2153  j += supported[j];
2154  j++;
2155  }
2156  i += peer[i];
2157  i++;
2158  }
2159 
2160  // There's no overlap between our protocols and the peer's list.
2161  result = supported;
2163 
2164 found:
2165  *out = (uint8_t *)result + 1;
2166  *out_len = result[0];
2167  return status;
2168 }
2169 
2170 void SSL_get0_next_proto_negotiated(const SSL *ssl, const uint8_t **out_data,
2171  unsigned *out_len) {
2172  *out_data = ssl->s3->next_proto_negotiated.data();
2173  *out_len = ssl->s3->next_proto_negotiated.size();
2174 }
2175 
2177  SSL_CTX *ctx,
2178  int (*cb)(SSL *ssl, const uint8_t **out, unsigned *out_len, void *arg),
2179  void *arg) {
2180  ctx->next_protos_advertised_cb = cb;
2181  ctx->next_protos_advertised_cb_arg = arg;
2182 }
2183 
2185  SSL_CTX *ctx, int (*cb)(SSL *ssl, uint8_t **out, uint8_t *out_len,
2186  const uint8_t *in, unsigned in_len, void *arg),
2187  void *arg) {
2188  ctx->next_proto_select_cb = cb;
2189  ctx->next_proto_select_cb_arg = arg;
2190 }
2191 
2193  unsigned protos_len) {
2194  // Note this function's return value is backwards.
2195  auto span = MakeConstSpan(protos, protos_len);
2196  if (!span.empty() && !ssl_is_valid_alpn_list(span)) {
2198  return 1;
2199  }
2200  return ctx->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
2201 }
2202 
2203 int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, unsigned protos_len) {
2204  // Note this function's return value is backwards.
2205  if (!ssl->config) {
2206  return 1;
2207  }
2208  auto span = MakeConstSpan(protos, protos_len);
2209  if (!span.empty() && !ssl_is_valid_alpn_list(span)) {
2211  return 1;
2212  }
2213  return ssl->config->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
2214 }
2215 
2217  int (*cb)(SSL *ssl, const uint8_t **out,
2218  uint8_t *out_len, const uint8_t *in,
2219  unsigned in_len, void *arg),
2220  void *arg) {
2221  ctx->alpn_select_cb = cb;
2222  ctx->alpn_select_cb_arg = arg;
2223 }
2224 
2225 void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data,
2226  unsigned *out_len) {
2227  if (SSL_in_early_data(ssl) && !ssl->server) {
2228  *out_data = ssl->s3->hs->early_session->early_alpn.data();
2229  *out_len = ssl->s3->hs->early_session->early_alpn.size();
2230  } else {
2231  *out_data = ssl->s3->alpn_selected.data();
2232  *out_len = ssl->s3->alpn_selected.size();
2233  }
2234 }
2235 
2237  ctx->allow_unknown_alpn_protos = !!enabled;
2238 }
2239 
2241  size_t proto_len, const uint8_t *settings,
2242  size_t settings_len) {
2243  if (!ssl->config) {
2244  return 0;
2245  }
2247  if (!config.protocol.CopyFrom(MakeConstSpan(proto, proto_len)) ||
2248  !config.settings.CopyFrom(MakeConstSpan(settings, settings_len)) ||
2249  !ssl->config->alps_configs.Push(std::move(config))) {
2250  return 0;
2251  }
2252  return 1;
2253 }
2254 
2256  const uint8_t **out_data,
2257  size_t *out_len) {
2258  const SSL_SESSION *session = SSL_get_session(ssl);
2260  session ? session->peer_application_settings : Span<const uint8_t>();
2261  *out_data = settings.data();
2262  *out_len = settings.size();
2263 }
2264 
2266  const SSL_SESSION *session = SSL_get_session(ssl);
2267  return session && session->has_application_settings;
2268 }
2269 
2272  ssl_cert_decompression_func_t decompress) {
2273  assert(compress != nullptr || decompress != nullptr);
2274 
2275  for (const auto &alg : ctx->cert_compression_algs) {
2276  if (alg.alg_id == alg_id) {
2277  return 0;
2278  }
2279  }
2280 
2281  CertCompressionAlg alg;
2282  alg.alg_id = alg_id;
2283  alg.compress = compress;
2284  alg.decompress = decompress;
2285  return ctx->cert_compression_algs.Push(alg);
2286 }
2287 
2289  ctx->channel_id_enabled = !!enabled;
2290 }
2291 
2294  return 1;
2295 }
2296 
2297 void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled) {
2298  if (!ssl->config) {
2299  return;
2300  }
2301  ssl->config->channel_id_enabled = !!enabled;
2302 }
2303 
2306  return 1;
2307 }
2308 
2310  const EC_KEY *ec_key = EVP_PKEY_get0_EC_KEY(private_key);
2311  return ec_key != NULL &&
2314 }
2315 
2317  if (!is_p256_key(private_key)) {
2319  return 0;
2320  }
2321 
2322  ctx->channel_id_private = UpRef(private_key);
2323  return 1;
2324 }
2325 
2327  if (!ssl->config) {
2328  return 0;
2329  }
2330  if (!is_p256_key(private_key)) {
2332  return 0;
2333  }
2334 
2335  ssl->config->channel_id_private = UpRef(private_key);
2336  return 1;
2337 }
2338 
2339 size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out, size_t max_out) {
2340  if (!ssl->s3->channel_id_valid) {
2341  return 0;
2342  }
2343  OPENSSL_memcpy(out, ssl->s3->channel_id, (max_out < 64) ? max_out : 64);
2344  return 64;
2345 }
2346 
2347 size_t SSL_get0_certificate_types(const SSL *ssl, const uint8_t **out_types) {
2349  if (!ssl->server && ssl->s3->hs != nullptr) {
2350  types = ssl->s3->hs->certificate_types;
2351  }
2352  *out_types = types.data();
2353  return types.size();
2354 }
2355 
2357  const uint16_t **out_sigalgs) {
2358  Span<const uint16_t> sigalgs;
2359  if (ssl->s3->hs != nullptr) {
2360  sigalgs = ssl->s3->hs->peer_sigalgs;
2361  }
2362  *out_sigalgs = sigalgs.data();
2363  return sigalgs.size();
2364 }
2365 
2367  const uint16_t **out_sigalgs){
2368  Span<const uint16_t> sigalgs;
2369  if (ssl->s3->hs != nullptr) {
2370  sigalgs = ssl->s3->hs->peer_delegated_credential_sigalgs;
2371  }
2372  *out_sigalgs = sigalgs.data();
2373  return sigalgs.size();
2374 }
2375 
2377  if (!ssl->config) {
2378  assert(ssl->config);
2379  return NULL;
2380  }
2381  if (ssl->config->cert != NULL) {
2382  return ssl->config->cert->privatekey.get();
2383  }
2384 
2385  return NULL;
2386 }
2387 
2389  if (ctx->cert != NULL) {
2390  return ctx->cert->privatekey.get();
2391  }
2392 
2393  return NULL;
2394 }
2395 
2397  const SSL_SESSION *session = SSL_get_session(ssl);
2398  return session == nullptr ? nullptr : session->cipher;
2399 }
2400 
2401 int SSL_session_reused(const SSL *ssl) {
2402  return ssl->s3->session_reused || SSL_in_early_data(ssl);
2403 }
2404 
2405 const COMP_METHOD *SSL_get_current_compression(SSL *ssl) { return NULL; }
2406 
2407 const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return NULL; }
2408 
2409 int SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
2410 
2412  ctx->quiet_shutdown = (mode != 0);
2413 }
2414 
2416  return ctx->quiet_shutdown;
2417 }
2418 
2420  ssl->quiet_shutdown = (mode != 0);
2421 }
2422 
2423 int SSL_get_quiet_shutdown(const SSL *ssl) { return ssl->quiet_shutdown; }
2424 
2425 void SSL_set_shutdown(SSL *ssl, int mode) {
2426  // It is an error to clear any bits that have already been set. (We can't try
2427  // to get a second close_notify or send two.)
2428  assert((SSL_get_shutdown(ssl) & mode) == SSL_get_shutdown(ssl));
2429 
2430  if (mode & SSL_RECEIVED_SHUTDOWN &&
2431  ssl->s3->read_shutdown == ssl_shutdown_none) {
2432  ssl->s3->read_shutdown = ssl_shutdown_close_notify;
2433  }
2434 
2435  if (mode & SSL_SENT_SHUTDOWN &&
2436  ssl->s3->write_shutdown == ssl_shutdown_none) {
2437  ssl->s3->write_shutdown = ssl_shutdown_close_notify;
2438  }
2439 }
2440 
2441 int SSL_get_shutdown(const SSL *ssl) {
2442  int ret = 0;
2443  if (ssl->s3->read_shutdown != ssl_shutdown_none) {
2444  // Historically, OpenSSL set |SSL_RECEIVED_SHUTDOWN| on both close_notify
2445  // and fatal alert.
2447  }
2448  if (ssl->s3->write_shutdown == ssl_shutdown_close_notify) {
2449  // Historically, OpenSSL set |SSL_SENT_SHUTDOWN| on only close_notify.
2451  }
2452  return ret;
2453 }
2454 
2455 SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) { return ssl->ctx.get(); }
2456 
2458  if (!ssl->config) {
2459  return NULL;
2460  }
2461  if (ssl->ctx.get() == ctx) {
2462  return ssl->ctx.get();
2463  }
2464 
2465  // One cannot change the X.509 callbacks during a connection.
2466  if (ssl->ctx->x509_method != ctx->x509_method) {
2467  assert(0);
2468  return NULL;
2469  }
2470 
2471  UniquePtr<CERT> new_cert = ssl_cert_dup(ctx->cert.get());
2472  if (!new_cert) {
2473  return nullptr;
2474  }
2475 
2476  ssl->config->cert = std::move(new_cert);
2477  ssl->ctx = UpRef(ctx);
2478  ssl->enable_early_data = ssl->ctx->enable_early_data;
2479 
2480  return ssl->ctx.get();
2481 }
2482 
2484  void (*cb)(const SSL *ssl, int type, int value)) {
2485  ssl->info_callback = cb;
2486 }
2487 
2488 void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type,
2489  int value) {
2490  return ssl->info_callback;
2491 }
2492 
2493 int SSL_state(const SSL *ssl) {
2494  return SSL_in_init(ssl) ? SSL_ST_INIT : SSL_ST_OK;
2495 }
2496 
2497 void SSL_set_state(SSL *ssl, int state) { }
2498 
2499 char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len) {
2500  if (len <= 0) {
2501  return NULL;
2502  }
2503  buf[0] = '\0';
2504  return buf;
2505 }
2506 
2507 int SSL_get_shared_sigalgs(SSL *ssl, int idx, int *psign, int *phash,
2508  int *psignandhash, uint8_t *rsig, uint8_t *rhash) {
2509  return 0;
2510 }
2511 
2513  if (ctx->method->is_dtls) {
2514  return 0;
2515  }
2516  ctx->quic_method = quic_method;
2517  return 1;
2518 }
2519 
2520 int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method) {
2521  if (ssl->method->is_dtls) {
2522  return 0;
2523  }
2524  ssl->quic_method = quic_method;
2525  return 1;
2526 }
2527 
2528 int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
2529  CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func) {
2530  int index;
2532  free_func)) {
2533  return -1;
2534  }
2535  return index;
2536 }
2537 
2538 int SSL_set_ex_data(SSL *ssl, int idx, void *data) {
2539  return CRYPTO_set_ex_data(&ssl->ex_data, idx, data);
2540 }
2541 
2542 void *SSL_get_ex_data(const SSL *ssl, int idx) {
2543  return CRYPTO_get_ex_data(&ssl->ex_data, idx);
2544 }
2545 
2546 int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
2547  CRYPTO_EX_dup *dup_unused,
2548  CRYPTO_EX_free *free_func) {
2549  int index;
2551  free_func)) {
2552  return -1;
2553  }
2554  return index;
2555 }
2556 
2558  return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
2559 }
2560 
2561 void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
2562  return CRYPTO_get_ex_data(&ctx->ex_data, idx);
2563 }
2564 
2565 int SSL_want(const SSL *ssl) { return ssl->s3->rwstate; }
2566 
2568  RSA *(*cb)(SSL *ssl, int is_export,
2569  int keylength)) {}
2570 
2571 void SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int is_export,
2572  int keylength)) {}
2573 
2575  DH *(*cb)(SSL *ssl, int is_export,
2576  int keylength)) {}
2577 
2578 void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*cb)(SSL *ssl, int is_export,
2579  int keylength)) {}
2580 
2581 static int use_psk_identity_hint(UniquePtr<char> *out,
2582  const char *identity_hint) {
2583  if (identity_hint != NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
2585  return 0;
2586  }
2587 
2588  // Clear currently configured hint, if any.
2589  out->reset();
2590 
2591  // Treat the empty hint as not supplying one. Plain PSK makes it possible to
2592  // send either no hint (omit ServerKeyExchange) or an empty hint, while
2593  // ECDHE_PSK can only spell empty hint. Having different capabilities is odd,
2594  // so we interpret empty and missing as identical.
2595  if (identity_hint != NULL && identity_hint[0] != '\0') {
2596  out->reset(OPENSSL_strdup(identity_hint));
2597  if (*out == nullptr) {
2598  return 0;
2599  }
2600  }
2601 
2602  return 1;
2603 }
2604 
2605 int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) {
2606  return use_psk_identity_hint(&ctx->psk_identity_hint, identity_hint);
2607 }
2608 
2609 int SSL_use_psk_identity_hint(SSL *ssl, const char *identity_hint) {
2610  if (!ssl->config) {
2611  return 0;
2612  }
2613  return use_psk_identity_hint(&ssl->config->psk_identity_hint, identity_hint);
2614 }
2615 
2616 const char *SSL_get_psk_identity_hint(const SSL *ssl) {
2617  if (ssl == NULL) {
2618  return NULL;
2619  }
2620  if (ssl->config == NULL) {
2621  assert(ssl->config);
2622  return NULL;
2623  }
2624  return ssl->config->psk_identity_hint.get();
2625 }
2626 
2627 const char *SSL_get_psk_identity(const SSL *ssl) {
2628  if (ssl == NULL) {
2629  return NULL;
2630  }
2631  SSL_SESSION *session = SSL_get_session(ssl);
2632  if (session == NULL) {
2633  return NULL;
2634  }
2635  return session->psk_identity.get();
2636 }
2637 
2639  SSL *ssl, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
2640  unsigned max_identity_len, uint8_t *psk,
2641  unsigned max_psk_len)) {
2642  if (!ssl->config) {
2643  return;
2644  }
2645  ssl->config->psk_client_callback = cb;
2646 }
2647 
2649  SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
2650  unsigned max_identity_len, uint8_t *psk,
2651  unsigned max_psk_len)) {
2652  ctx->psk_client_callback = cb;
2653 }
2654 
2656  SSL *ssl, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
2657  unsigned max_psk_len)) {
2658  if (!ssl->config) {
2659  return;
2660  }
2661  ssl->config->psk_server_callback = cb;
2662 }
2663 
2665  SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *identity,
2666  uint8_t *psk, unsigned max_psk_len)) {
2667  ctx->psk_server_callback = cb;
2668 }
2669 
2671  void (*cb)(int write_p, int version,
2672  int content_type, const void *buf,
2673  size_t len, SSL *ssl, void *arg)) {
2674  ctx->msg_callback = cb;
2675 }
2676 
2678  ctx->msg_callback_arg = arg;
2679 }
2680 
2682  void (*cb)(int write_p, int version, int content_type,
2683  const void *buf, size_t len, SSL *ssl,
2684  void *arg)) {
2685  ssl->msg_callback = cb;
2686 }
2687 
2688 void SSL_set_msg_callback_arg(SSL *ssl, void *arg) {
2689  ssl->msg_callback_arg = arg;
2690 }
2691 
2693  void (*cb)(const SSL *ssl, const char *line)) {
2694  ctx->keylog_callback = cb;
2695 }
2696 
2697 void (*SSL_CTX_get_keylog_callback(const SSL_CTX *ctx))(const SSL *ssl,
2698  const char *line) {
2699  return ctx->keylog_callback;
2700 }
2701 
2703  void (*cb)(const SSL *ssl,
2704  struct timeval *out_clock)) {
2705  ctx->current_time_cb = cb;
2706 }
2707 
2709  if (ssl_can_renegotiate(ssl)) {
2710  // If the connection can renegotiate (client only), the private key may be
2711  // used in a future handshake.
2712  return 0;
2713  }
2714 
2715  // Otherwise, this is determined by the current handshake.
2716  return !ssl->s3->hs || ssl->s3->hs->can_release_private_key;
2717 }
2718 
2719 int SSL_is_init_finished(const SSL *ssl) {
2720  return !SSL_in_init(ssl);
2721 }
2722 
2723 int SSL_in_init(const SSL *ssl) {
2724  // This returns false once all the handshake state has been finalized, to
2725  // allow callbacks and getters based on SSL_in_init to return the correct
2726  // values.
2727  SSL_HANDSHAKE *hs = ssl->s3->hs.get();
2728  return hs != nullptr && !hs->handshake_finalized;
2729 }
2730 
2731 int SSL_in_false_start(const SSL *ssl) {
2732  if (ssl->s3->hs == NULL) {
2733  return 0;
2734  }
2735  return ssl->s3->hs->in_false_start;
2736 }
2737 
2738 int SSL_cutthrough_complete(const SSL *ssl) {
2739  return SSL_in_false_start(ssl);
2740 }
2741 
2742 int SSL_is_server(const SSL *ssl) { return ssl->server; }
2743 
2744 int SSL_is_dtls(const SSL *ssl) { return ssl->method->is_dtls; }
2745 
2747  SSL_CTX *ctx,
2748  enum ssl_select_cert_result_t (*cb)(const SSL_CLIENT_HELLO *)) {
2749  ctx->select_certificate_cb = cb;
2750 }
2751 
2753  int (*cb)(const SSL_CLIENT_HELLO *)) {
2754  ctx->dos_protection_cb = cb;
2755 }
2756 
2758  ctx->reverify_on_resume = !!enabled;
2759 }
2760 
2761 void SSL_set_enforce_rsa_key_usage(SSL *ssl, int enabled) {
2762  if (!ssl->config) {
2763  return;
2764  }
2765  ssl->config->enforce_rsa_key_usage = !!enabled;
2766 }
2767 
2768 void SSL_set_renegotiate_mode(SSL *ssl, enum ssl_renegotiate_mode_t mode) {
2769  ssl->renegotiate_mode = mode;
2770 
2771  // Check if |ssl_can_renegotiate| has changed and the configuration may now be
2772  // shed. HTTP clients may initially allow renegotiation for HTTP/1.1, and then
2773  // disable after the handshake once the ALPN protocol is known to be HTTP/2.
2775 }
2776 
2777 int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
2778  const uint8_t **out_write_iv, size_t *out_iv_len) {
2779  size_t write_iv_len;
2780  if (!ssl->s3->aead_read_ctx->GetIV(out_read_iv, out_iv_len) ||
2781  !ssl->s3->aead_write_ctx->GetIV(out_write_iv, &write_iv_len) ||
2782  *out_iv_len != write_iv_len) {
2783  return 0;
2784  }
2785 
2786  return 1;
2787 }
2788 
2789 static uint64_t be_to_u64(const uint8_t in[8]) {
2790  return (((uint64_t)in[0]) << 56) | (((uint64_t)in[1]) << 48) |
2791  (((uint64_t)in[2]) << 40) | (((uint64_t)in[3]) << 32) |
2792  (((uint64_t)in[4]) << 24) | (((uint64_t)in[5]) << 16) |
2793  (((uint64_t)in[6]) << 8) | ((uint64_t)in[7]);
2794 }
2795 
2797  // TODO(davidben): Internally represent sequence numbers as uint64_t.
2798  if (SSL_is_dtls(ssl)) {
2799  // max_seq_num already includes the epoch.
2800  assert(ssl->d1->r_epoch == (ssl->d1->bitmap.max_seq_num >> 48));
2801  return ssl->d1->bitmap.max_seq_num;
2802  }
2803  return be_to_u64(ssl->s3->read_sequence);
2804 }
2805 
2807  uint64_t ret = be_to_u64(ssl->s3->write_sequence);
2808  if (SSL_is_dtls(ssl)) {
2809  assert((ret >> 48) == 0);
2810  ret |= ((uint64_t)ssl->d1->w_epoch) << 48;
2811  }
2812  return ret;
2813 }
2814 
2816  // TODO(davidben): This checks the wrong session if there is a renegotiation
2817  // in progress.
2818  SSL_SESSION *session = SSL_get_session(ssl);
2819  if (session == NULL) {
2820  return 0;
2821  }
2822 
2823  return session->peer_signature_algorithm;
2824 }
2825 
2826 size_t SSL_get_client_random(const SSL *ssl, uint8_t *out, size_t max_out) {
2827  if (max_out == 0) {
2828  return sizeof(ssl->s3->client_random);
2829  }
2830  if (max_out > sizeof(ssl->s3->client_random)) {
2831  max_out = sizeof(ssl->s3->client_random);
2832  }
2833  OPENSSL_memcpy(out, ssl->s3->client_random, max_out);
2834  return max_out;
2835 }
2836 
2837 size_t SSL_get_server_random(const SSL *ssl, uint8_t *out, size_t max_out) {
2838  if (max_out == 0) {
2839  return sizeof(ssl->s3->server_random);
2840  }
2841  if (max_out > sizeof(ssl->s3->server_random)) {
2842  max_out = sizeof(ssl->s3->server_random);
2843  }
2844  OPENSSL_memcpy(out, ssl->s3->server_random, max_out);
2845  return max_out;
2846 }
2847 
2849  SSL_HANDSHAKE *hs = ssl->s3->hs.get();
2850  if (hs == NULL) {
2851  return NULL;
2852  }
2853  return hs->new_cipher;
2854 }
2855 
2857  if (!ssl->config) {
2858  return;
2859  }
2860  ssl->config->retain_only_sha256_of_client_certs = !!enabled;
2861 }
2862 
2864  ctx->retain_only_sha256_of_client_certs = !!enabled;
2865 }
2866 
2868  ctx->grease_enabled = !!enabled;
2869 }
2870 
2872  ctx->permute_extensions = !!enabled;
2873 }
2874 
2875 void SSL_set_permute_extensions(SSL *ssl, int enabled) {
2876  if (!ssl->config) {
2877  return;
2878  }
2879  ssl->config->permute_extensions = !!enabled;
2880 }
2881 
2883  return ssl->s3->ticket_age_skew;
2884 }
2885 
2887  ctx->false_start_allowed_without_alpn = !!allowed;
2888 }
2889 
2891  return ssl->s3->used_hello_retry_request;
2892 }
2893 
2894 void SSL_set_shed_handshake_config(SSL *ssl, int enable) {
2895  if (!ssl->config) {
2896  return;
2897  }
2898  ssl->config->shed_handshake_config = !!enable;
2899 }
2900 
2901 void SSL_set_jdk11_workaround(SSL *ssl, int enable) {
2902  if (!ssl->config) {
2903  return;
2904  }
2905  ssl->config->jdk11_workaround = !!enable;
2906 }
2907 
2908 void SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy) {
2909  if (!ssl->config) {
2910  return;
2911  }
2912  ssl->config->quic_use_legacy_codepoint = !!use_legacy;
2913 }
2914 
2915 int SSL_clear(SSL *ssl) {
2916  if (!ssl->config) {
2917  return 0; // SSL_clear may not be used after shedding config.
2918  }
2919 
2920  // In OpenSSL, reusing a client |SSL| with |SSL_clear| causes the previously
2921  // established session to be offered the next time around. wpa_supplicant
2922  // depends on this behavior, so emulate it.
2923  UniquePtr<SSL_SESSION> session;
2924  if (!ssl->server && ssl->s3->established_session != NULL) {
2925  session = UpRef(ssl->s3->established_session);
2926  }
2927 
2928  // The ssl->d1->mtu is simultaneously configuration (preserved across
2929  // clear) and connection-specific state (gets reset).
2930  //
2931  // TODO(davidben): Avoid this.
2932  unsigned mtu = 0;
2933  if (ssl->d1 != NULL) {
2934  mtu = ssl->d1->mtu;
2935  }
2936 
2937  ssl->method->ssl_free(ssl);
2938  if (!ssl->method->ssl_new(ssl)) {
2939  return 0;
2940  }
2941 
2942  if (SSL_is_dtls(ssl) && (SSL_get_options(ssl) & SSL_OP_NO_QUERY_MTU)) {
2943  ssl->d1->mtu = mtu;
2944  }
2945 
2946  if (session != nullptr) {
2947  SSL_set_session(ssl, session.get());
2948  }
2949 
2950  return 1;
2951 }
2952 
2953 int SSL_CTX_sess_connect(const SSL_CTX *ctx) { return 0; }
2954 int SSL_CTX_sess_connect_good(const SSL_CTX *ctx) { return 0; }
2956 int SSL_CTX_sess_accept(const SSL_CTX *ctx) { return 0; }
2958 int SSL_CTX_sess_accept_good(const SSL_CTX *ctx) { return 0; }
2959 int SSL_CTX_sess_hits(const SSL_CTX *ctx) { return 0; }
2960 int SSL_CTX_sess_cb_hits(const SSL_CTX *ctx) { return 0; }
2961 int SSL_CTX_sess_misses(const SSL_CTX *ctx) { return 0; }
2962 int SSL_CTX_sess_timeouts(const SSL_CTX *ctx) { return 0; }
2963 int SSL_CTX_sess_cache_full(const SSL_CTX *ctx) { return 0; }
2964 
2965 int SSL_num_renegotiations(const SSL *ssl) {
2966  return SSL_total_renegotiations(ssl);
2967 }
2968 
2969 int SSL_CTX_need_tmp_RSA(const SSL_CTX *ctx) { return 0; }
2970 int SSL_need_tmp_RSA(const SSL *ssl) { return 0; }
2971 int SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, const RSA *rsa) { return 1; }
2972 int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa) { return 1; }
2975 int SSL_cache_hit(SSL *ssl) { return SSL_session_reused(ssl); }
2976 
2977 int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key) {
2978  if (ec_key == NULL || EC_KEY_get0_group(ec_key) == NULL) {
2980  return 0;
2981  }
2983  return SSL_CTX_set1_curves(ctx, &nid, 1);
2984 }
2985 
2986 int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key) {
2987  if (ec_key == NULL || EC_KEY_get0_group(ec_key) == NULL) {
2989  return 0;
2990  }
2992  return SSL_set1_curves(ssl, &nid, 1);
2993 }
2994 
2996  const SSL_TICKET_AEAD_METHOD *aead_method) {
2997  ctx->ticket_aead_method = aead_method;
2998 }
2999 
3001  size_t buf_len) {
3002  if (SSL_in_init(ssl) ||
3004  ssl->server) {
3005  // Only TLS 1.3 clients are supported.
3007  return nullptr;
3008  }
3009 
3010  CBS cbs, body;
3011  CBS_init(&cbs, buf, buf_len);
3012  uint8_t type;
3013  if (!CBS_get_u8(&cbs, &type) ||
3014  !CBS_get_u24_length_prefixed(&cbs, &body) ||
3015  CBS_len(&cbs) != 0) {
3017  return nullptr;
3018  }
3019 
3020  UniquePtr<SSL_SESSION> session = tls13_create_session_with_ticket(ssl, &body);
3021  if (!session) {
3022  // |tls13_create_session_with_ticket| puts the correct error.
3023  return nullptr;
3024  }
3025  return session.release();
3026 }
3027 
3029  if (!ssl->config) {
3030  return 0;
3031  }
3032  ssl->config->ocsp_stapling_enabled = type == TLSEXT_STATUSTYPE_ocsp;
3033  return 1;
3034 }
3035 
3037  if (ssl->server) {
3038  SSL_HANDSHAKE *hs = ssl->s3->hs.get();
3039  return hs != nullptr && hs->ocsp_stapling_requested
3042  }
3043 
3044  return ssl->config != nullptr && ssl->config->ocsp_stapling_enabled
3047 }
3048 
3049 int SSL_set_tlsext_status_ocsp_resp(SSL *ssl, uint8_t *resp, size_t resp_len) {
3050  if (SSL_set_ocsp_response(ssl, resp, resp_len)) {
3051  OPENSSL_free(resp);
3052  return 1;
3053  }
3054  return 0;
3055 }
3056 
3057 size_t SSL_get_tlsext_status_ocsp_resp(const SSL *ssl, const uint8_t **out) {
3058  size_t ret;
3059  SSL_get0_ocsp_response(ssl, out, &ret);
3060  return ret;
3061 }
3062 
3064  int (*callback)(SSL *ssl, void *arg)) {
3065  ctx->legacy_ocsp_callback = callback;
3066  return 1;
3067 }
3068 
3070  ctx->legacy_ocsp_callback_arg = arg;
3071  return 1;
3072 }
SSL_CTX_set_current_time_cb
void SSL_CTX_set_current_time_cb(SSL_CTX *ctx, void(*cb)(const SSL *ssl, struct timeval *out_clock))
Definition: ssl_lib.cc:2702
ssl_send_alert
void ssl_send_alert(SSL *ssl, int level, int desc)
Definition: s3_pkt.cc:379
SSL_CTX_set_tmp_rsa
int SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, const RSA *rsa)
Definition: ssl_lib.cc:2971
ssl_session_st::peer_signature_algorithm
uint16_t peer_signature_algorithm
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3803
xds_interop_client.str
str
Definition: xds_interop_client.py:487
ssl_st::msg_callback_arg
void * msg_callback_arg
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3737
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
SSL_R_HANDSHAKE_NOT_COMPLETE
#define SSL_R_HANDSHAKE_NOT_COMPLETE
Definition: ssl.h:5551
ssl_st::server
bool server
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3777
ssl_session_st::peer_application_settings
bssl::Array< uint8_t > peer_application_settings
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3905
tls1_set_curves_list
bool tls1_set_curves_list(Array< uint16_t > *out_group_ids, const char *curves)
Definition: extensions.cc:373
SSL_get_early_data_reason
enum ssl_early_data_reason_t SSL_get_early_data_reason(const SSL *ssl)
Definition: ssl_lib.cc:1240
ssl_st::enable_early_data
bool enable_early_data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3784
SSL3_AL_WARNING
#define SSL3_AL_WARNING
Definition: ssl3.h:279
SSL_in_false_start
int SSL_in_false_start(const SSL *ssl)
Definition: ssl_lib.cc:2731
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
ssl_cipher_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:520
SSL_renegotiate
int SSL_renegotiate(SSL *ssl)
Definition: ssl_lib.cc:1721
OPENSSL_NPN_NEGOTIATED
#define OPENSSL_NPN_NEGOTIATED
Definition: ssl.h:3013
CBS_get_u24_length_prefixed
#define CBS_get_u24_length_prefixed
Definition: boringssl_prefix_symbols.h:1077
SSL_load_error_strings
void SSL_load_error_strings(void)
Definition: ssl_lib.cc:2974
ssl_cert_compression_func_t
int(* ssl_cert_compression_func_t)(SSL *ssl, CBB *out, const uint8_t *in, size_t in_len)
Definition: ssl.h:2914
BIO_s_socket
#define BIO_s_socket
Definition: boringssl_prefix_symbols.h:840
SSL_DEFAULT_CIPHER_LIST
#define SSL_DEFAULT_CIPHER_LIST
Definition: ssl.h:1503
SSL_CTX_set_early_data_enabled
void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:1204
SSL_get0_peer_delegation_algorithms
size_t SSL_get0_peer_delegation_algorithms(const SSL *ssl, const uint16_t **out_sigalgs)
Definition: ssl_lib.cc:2366
hextable
static const char hextable[]
Definition: boringssl-with-bazel/src/crypto/bn_extra/convert.c:77
ssl_early_data_ticket_age_skew
ssl_early_data_ticket_age_skew
Definition: ssl.h:3578
ssl_handle_open_record
int ssl_handle_open_record(SSL *ssl, bool *out_retry, ssl_open_record_t ret, size_t consumed, uint8_t alert)
Definition: ssl_buffer.cc:207
SSL_set_msg_callback_arg
void SSL_set_msg_callback_arg(SSL *ssl, void *arg)
Definition: ssl_lib.cc:2688
SSL_get_psk_identity_hint
const char * SSL_get_psk_identity_hint(const SSL *ssl)
Definition: ssl_lib.cc:2616
test_server.argp
argp
Definition: test_server.py:33
CBB_init
#define CBB_init
Definition: boringssl_prefix_symbols.h:1047
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
SSL_CTX_sess_set_cache_size
unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, unsigned long size)
Definition: ssl_lib.cc:1836
SSL_can_release_private_key
int SSL_can_release_private_key(const SSL *ssl)
Definition: ssl_lib.cc:2708
SSL_enable_ocsp_stapling
void SSL_enable_ocsp_stapling(SSL *ssl)
Definition: ssl_lib.cc:2074
SSL_CTX_set_grease_enabled
void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:2867
SSL_get_servername_type
int SSL_get_servername_type(const SSL *ssl)
Definition: ssl_lib.cc:2035
SSL_CTX_sess_get_cache_size
unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1842
Span::size
size_t size() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:133
BIO_RR_ACCEPT
#define BIO_RR_ACCEPT
Definition: bio.h:196
BIO_TYPE_SOCKET
#define BIO_TYPE_SOCKET
Definition: bio.h:778
SSL2_VERSION
#define SSL2_VERSION
Definition: ssl3.h:131
SSL_CTX_sess_accept
int SSL_CTX_sess_accept(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2956
SSL_get_rfd
int SSL_get_rfd(const SSL *ssl)
Definition: ssl_lib.cc:1550
cbs_st
Definition: bytestring.h:39
ERR_save_state
#define ERR_save_state
Definition: boringssl_prefix_symbols.h:1443
OPENSSL_memcmp
static int OPENSSL_memcmp(const void *s1, const void *s2, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:811
SSL_get_server_tmp_key
int SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key)
Definition: ssl_lib.cc:2409
SSL_get_ex_new_index
int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused, CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func)
Definition: ssl_lib.cc:2528
ctx
Definition: benchmark-async.c:30
SSL_set_wfd
int SSL_set_wfd(SSL *ssl, int fd)
Definition: ssl_lib.cc:1579
SSL_CTX_get_ex_data
void * SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx)
Definition: ssl_lib.cc:2561
NID_X9_62_prime256v1
#define NID_X9_62_prime256v1
Definition: nid.h:1914
SSL_R_INVALID_TICKET_KEYS_LENGTH
#define SSL_R_INVALID_TICKET_KEYS_LENGTH
Definition: ssl.h:5429
SSL_AD_REASON_OFFSET
#define SSL_AD_REASON_OFFSET
Definition: ssl.h:3791
SSL_CTX_sess_hits
int SSL_CTX_sess_hits(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2959
SSL_CTX_sess_misses
int SSL_CTX_sess_misses(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2961
SSL_num_renegotiations
int SSL_num_renegotiations(const SSL *ssl)
Definition: ssl_lib.cc:2965
ssl_server_handshake
enum ssl_hs_wait_t ssl_server_handshake(SSL_HANDSHAKE *hs)
Definition: handshake_server.cc:1816
CRYPTO_EX_dup
int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, void **from_d, int index, long argl, void *argp)
Definition: ex_data.h:184
ssl_st::~ssl_st
~ssl_st()
Definition: ssl_lib.cc:602
ssl_cert_clear_certs
void ssl_cert_clear_certs(CERT *cert)
Definition: ssl_cert.cc:196
SSL_quic_write_level
enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl)
Definition: ssl_lib.cc:799
bio_st
Definition: bio.h:822
CRYPTO_library_init
#define CRYPTO_library_init
Definition: boringssl_prefix_symbols.h:1175
SSL_set0_wbio
void SSL_set0_wbio(SSL *ssl, BIO *wbio)
Definition: ssl_lib.cc:715
ssl_renegotiate_explicit
ssl_renegotiate_explicit
Definition: ssl.h:4094
SSL_key_update
int SSL_key_update(SSL *ssl, int request_type)
Definition: ssl_lib.cc:1076
SSL_used_hello_retry_request
int SSL_used_hello_retry_request(const SSL *ssl)
Definition: ssl_lib.cc:2890
SSL_CTX_add_cert_compression_alg
int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id, ssl_cert_compression_func_t compress, ssl_cert_decompression_func_t decompress)
Definition: ssl_lib.cc:2270
SSL_get_shared_ciphers
char * SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len)
Definition: ssl_lib.cc:2499
SSL_set_tmp_dh_callback
void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*cb)(SSL *ssl, int is_export, int keylength))
Definition: ssl_lib.cc:2578
CertCompressionAlg::alg_id
uint16_t alg_id
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2592
ssl_session_hash
static uint32_t ssl_session_hash(const SSL_SESSION *sess)
Definition: ssl_lib.cc:494
false
#define false
Definition: setup_once.h:323
uint16_t
unsigned short uint16_t
Definition: stdint-msvc2008.h:79
SSL_CTX_set_msg_callback_arg
void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg)
Definition: ssl_lib.cc:2677
SSL_get_SSL_CTX
SSL_CTX * SSL_get_SSL_CTX(const SSL *ssl)
Definition: ssl_lib.cc:2455
BIO_should_write
#define BIO_should_write
Definition: boringssl_prefix_symbols.h:862
CertCompressionAlg
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2587
SSL_R_TLSV1_ALERT_NO_RENEGOTIATION
#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION
Definition: ssl.h:5613
SSL_HANDSHAKE::new_cipher
const SSL_CIPHER * new_cipher
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1933
compress
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: bloaty/third_party/zlib/compress.c:68
BIO_method_type
#define BIO_method_type
Definition: boringssl_prefix_symbols.h:813
SSL_CTX_set_ticket_aead_method
void SSL_CTX_set_ticket_aead_method(SSL_CTX *ctx, const SSL_TICKET_AEAD_METHOD *aead_method)
Definition: ssl_lib.cc:2995
CRYPTO_EX_DATA_CLASS
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:679
SSL_CONFIG::SSL_CONFIG
SSL_CONFIG(SSL *ssl_arg)
Definition: ssl_lib.cc:675
ssl_early_data_no_session_offered
ssl_early_data_no_session_offered
Definition: ssl.h:3565
SSL_CTX_set1_curves
int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves, size_t curves_len)
Definition: ssl_lib.cc:1912
SSL_ERROR_WANT_READ
#define SSL_ERROR_WANT_READ
Definition: ssl.h:494
ssl_method
static const BIO_METHOD ssl_method
Definition: bio_ssl.cc:183
SSL_get_current_cipher
const SSL_CIPHER * SSL_get_current_cipher(const SSL *ssl)
Definition: ssl_lib.cc:2396
SSL_R_SSL3_EXT_INVALID_SERVERNAME
#define SSL_R_SSL3_EXT_INVALID_SERVERNAME
Definition: ssl.h:5480
SSL_set_session
#define SSL_set_session
Definition: boringssl_prefix_symbols.h:491
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
internal.h
ssl_is_valid_alpn_list
bool ssl_is_valid_alpn_list(Span< const uint8_t > in)
Definition: extensions.cc:1494
SSL_ERROR_SSL
#define SSL_ERROR_SSL
Definition: ssl.h:485
string.h
options
double_dict options[]
Definition: capstone_test.c:55
SSL_get_wfd
int SSL_get_wfd(const SSL *ssl)
Definition: ssl_lib.cc:1559
SSL3_MT_HELLO_REQUEST
#define SSL3_MT_HELLO_REQUEST
Definition: ssl3.h:298
SSL_get_write_sequence
uint64_t SSL_get_write_sequence(const SSL *ssl)
Definition: ssl_lib.cc:2806
CBB_add_u8
#define CBB_add_u8
Definition: boringssl_prefix_symbols.h:1036
SSL_get_servername
const char * SSL_get_servername(const SSL *ssl, const int type)
Definition: ssl_lib.cc:2021
ssl_st::config
bssl::UniquePtr< bssl::SSL_CONFIG > config
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3712
SSL_use_psk_identity_hint
int SSL_use_psk_identity_hint(SSL *ssl, const char *identity_hint)
Definition: ssl_lib.cc:2609
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
SSL_CB_ACCEPT_EXIT
#define SSL_CB_ACCEPT_EXIT
Definition: ssl.h:4288
be_to_u64
static uint64_t be_to_u64(const uint8_t in[8])
Definition: ssl_lib.cc:2789
SSL_get_psk_identity
const char * SSL_get_psk_identity(const SSL *ssl)
Definition: ssl_lib.cc:2627
CRYPTO_BUFFER_len
#define CRYPTO_BUFFER_len
Definition: boringssl_prefix_symbols.h:1118
SSL_CTX_flush_sessions
#define SSL_CTX_flush_sessions
Definition: boringssl_prefix_symbols.h:83
ssl_early_data_alps_mismatch
ssl_early_data_alps_mismatch
Definition: ssl.h:3582
SSL_CTX_set_psk_server_callback
void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned(*cb)(SSL *ssl, const char *identity, uint8_t *psk, unsigned max_psk_len))
Definition: ssl_lib.cc:2664
ssl_st::do_handshake
bssl::ssl_hs_wait_t(* do_handshake)(bssl::SSL_HANDSHAKE *hs)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3728
ssl_hs_ok
@ ssl_hs_ok
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1611
ssl_can_write
bool ssl_can_write(const SSL *ssl)
Definition: ssl_lib.cc:222
error_ref_leak.err
err
Definition: error_ref_leak.py:35
SSL_ERROR_NONE
#define SSL_ERROR_NONE
Definition: ssl.h:481
SSL_set_ocsp_response
#define SSL_set_ocsp_response
Definition: boringssl_prefix_symbols.h:475
SSL_version
#define SSL_version
Definition: boringssl_prefix_symbols.h:531
SSL_get_default_timeout
long SSL_get_default_timeout(const SSL *ssl)
Definition: ssl_lib.cc:1717
SSL_get_verify_mode
int SSL_get_verify_mode(const SSL *ssl)
Definition: ssl_lib.cc:1657
SSL_set_mode
uint32_t SSL_set_mode(SSL *ssl, uint32_t mode)
Definition: ssl_lib.cc:1455
SSL_set_max_cert_list
void SSL_set_max_cert_list(SSL *ssl, size_t max_cert_list)
Definition: ssl_lib.cc:1784
SSL_set_cipher_list
int SSL_set_cipher_list(SSL *ssl, const char *str)
Definition: ssl_lib.cc:2005
SSL_set_accept_state
void SSL_set_accept_state(SSL *ssl)
Definition: ssl_lib.cc:706
CBS_len
#define CBS_len
Definition: boringssl_prefix_symbols.h:1089
cstest_report.opts
opts
Definition: cstest_report.py:81
SSL_get0_ocsp_response
void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out, size_t *out_len)
Definition: ssl_lib.cc:2094
u
OPENSSL_EXPORT pem_password_cb void * u
Definition: pem.h:351
CERT::sid_ctx
uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2410
SSL_send_fatal_alert
int SSL_send_fatal_alert(SSL *ssl, uint8_t alert)
Definition: ssl_lib.cc:1171
SSL_HANDSHAKE::early_session
UniquePtr< SSL_SESSION > early_session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1920
is_p256_key
static int is_p256_key(EVP_PKEY *private_key)
Definition: ssl_lib.cc:2309
ssl_st::info_callback
void(* info_callback)(const SSL *ssl, int type, int value)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3752
tls13_add_key_update
bool tls13_add_key_update(SSL *ssl, int update_requested)
Definition: tls13_both.cc:664
ssl_early_data_alpn_mismatch
ssl_early_data_alpn_mismatch
Definition: ssl.h:3573
status
absl::Status status
Definition: rls.cc:251
ssl_early_data_disabled
ssl_early_data_disabled
Definition: ssl.h:3557
SSL_get0_alpn_selected
void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data, unsigned *out_len)
Definition: ssl_lib.cc:2225
bssl
Definition: hpke_test.cc:37
SSL_set_strict_cipher_list
int SSL_set_strict_cipher_list(SSL *ssl, const char *str)
Definition: ssl_lib.cc:2013
mode
const char int mode
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
SSL_get0_peer_application_settings
void SSL_get0_peer_application_settings(const SSL *ssl, const uint8_t **out_data, size_t *out_len)
Definition: ssl_lib.cc:2255
setup.name
name
Definition: setup.py:542
SSL_HANDSHAKE::ocsp_stapling_requested
bool ocsp_stapling_requested
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1973
OPENSSL_init_ssl
int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
Definition: ssl_lib.cc:489
CBB_add_space
#define CBB_add_space
Definition: boringssl_prefix_symbols.h:1026
set_session_id_context
static int set_session_id_context(CERT *cert, const uint8_t *sid_ctx, size_t sid_ctx_len)
Definition: ssl_lib.cc:1505
version
Definition: version.py:1
SSL_set_SSL_CTX
SSL_CTX * SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
Definition: ssl_lib.cc:2457
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
SSL_CTX_use_psk_identity_hint
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint)
Definition: ssl_lib.cc:2605
SSL_CTX_set_alpn_protos
int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos, unsigned protos_len)
Definition: ssl_lib.cc:2192
SSL_set_session_id_context
int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx, size_t sid_ctx_len)
Definition: ssl_lib.cc:1523
SSL_set_enforce_rsa_key_usage
void SSL_set_enforce_rsa_key_usage(SSL *ssl, int enabled)
Definition: ssl_lib.cc:2761
SSL_get_ticket_age_skew
int32_t SSL_get_ticket_age_skew(const SSL *ssl)
Definition: ssl_lib.cc:2882
SSL_CTX_set_mode
uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode)
Definition: ssl_lib.cc:1443
cbs
const CBS * cbs
Definition: third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h:107
ssl_cert_check_private_key
bool ssl_cert_check_private_key(const CERT *cert, const EVP_PKEY *privkey)
Definition: ssl_cert.cc:518
TLSEXT_STATUSTYPE_nothing
#define TLSEXT_STATUSTYPE_nothing
Definition: tls1.h:264
sk_SSL_CIPHER_value
#define sk_SSL_CIPHER_value
Definition: boringssl_prefix_symbols.h:572
SSL_set_quic_use_legacy_codepoint
void SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy)
Definition: ssl_lib.cc:2908
SSL3_RANDOM_SIZE
#define SSL3_RANDOM_SIZE
Definition: ssl3.h:204
CRYPTO_MUTEX_init
#define CRYPTO_MUTEX_init
Definition: boringssl_prefix_symbols.h:1124
SSL_get_quiet_shutdown
int SSL_get_quiet_shutdown(const SSL *ssl)
Definition: ssl_lib.cc:2423
COMP_METHOD
void COMP_METHOD
Definition: ssl.h:4456
SSL_session_reused
int SSL_session_reused(const SSL *ssl)
Definition: ssl_lib.cc:2401
CBS_init
#define CBS_init
Definition: boringssl_prefix_symbols.h:1085
SSL_renegotiate_pending
int SSL_renegotiate_pending(SSL *ssl)
Definition: ssl_lib.cc:1761
ssl_early_data_protocol_version
ssl_early_data_protocol_version
Definition: ssl.h:3561
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
EC_KEY_get0_group
#define EC_KEY_get0_group
Definition: boringssl_prefix_symbols.h:1344
bio_retry_reason_to_error
static int bio_retry_reason_to_error(int reason)
Definition: ssl_lib.cc:1279
SSL_CTX_get_ex_new_index
int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused, CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func)
Definition: ssl_lib.cc:2546
evp_cipher_ctx_st
Definition: cipher.h:536
ssl_shutdown_none
@ ssl_shutdown_none
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2604
ssl_ctx_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3404
SSL_CTX_set_tlsext_ticket_key_cb
int SSL_CTX_set_tlsext_ticket_key_cb(SSL_CTX *ctx, int(*callback)(SSL *ssl, uint8_t *key_name, uint8_t *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx, int encrypt))
Definition: ssl_lib.cc:1904
SSL_R_NULL_SSL_CTX
#define SSL_R_NULL_SSL_CTX
Definition: ssl.h:5452
OPENSSL_memset
static void * OPENSSL_memset(void *dst, int c, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:835
ssl_st::mode
uint32_t mode
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3764
ssl_st::quic_method
const SSL_QUIC_METHOD * quic_method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3769
BIO_find_type
#define BIO_find_type
Definition: boringssl_prefix_symbols.h:785
SSL_R_CONNECTION_TYPE_NOT_SET
#define SSL_R_CONNECTION_TYPE_NOT_SET
Definition: ssl.h:5402
tls13_post_handshake
bool tls13_post_handshake(SSL *ssl, const SSLMessage &msg)
Definition: tls13_both.cc:709
SSL_ERROR_WANT_RENEGOTIATE
#define SSL_ERROR_WANT_RENEGOTIATE
Definition: ssl.h:587
SSL_CTX_enable_signed_cert_timestamps
void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx)
Definition: ssl_lib.cc:2059
SSL_ERROR_WANT_PRIVATE_KEY_OPERATION
#define SSL_ERROR_WANT_PRIVATE_KEY_OPERATION
Definition: ssl.h:558
CertCompressionAlg::compress
ssl_cert_compression_func_t compress
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2590
SSL_ERROR_WANT_ACCEPT
#define SSL_ERROR_WANT_ACCEPT
Definition: ssl.h:530
SSL_CTX_clear_mode
uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode)
Definition: ssl_lib.cc:1448
ssl_st::session
bssl::UniquePtr< SSL_SESSION > session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3750
SSL_set_alpn_protos
int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, unsigned protos_len)
Definition: ssl_lib.cc:2203
SSL_CTX_clear_options
uint32_t SSL_CTX_clear_options(SSL_CTX *ctx, uint32_t options)
Definition: ssl_lib.cc:1424
SSL_CTX_set_max_proto_version
#define SSL_CTX_set_max_proto_version
Definition: boringssl_prefix_symbols.h:173
SSL_get_tls_unique
int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out)
Definition: ssl_lib.cc:1471
SSL_CTX_set_quic_method
int SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method)
Definition: ssl_lib.cc:2512
SSL_CTX_set_allow_unknown_alpn_protos
void SSL_CTX_set_allow_unknown_alpn_protos(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:2236
SSL_get_client_random
size_t SSL_get_client_random(const SSL *ssl, uint8_t *out, size_t max_out)
Definition: ssl_lib.cc:2826
ssl_can_read
bool ssl_can_read(const SSL *ssl)
Definition: ssl_lib.cc:226
ssl_early_data_peer_declined
ssl_early_data_peer_declined
Definition: ssl.h:3563
CERT
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2345
SSL_set_tlsext_host_name
int SSL_set_tlsext_host_name(SSL *ssl, const char *name)
Definition: ssl_lib.cc:2107
OPENSSL_timeval::tv_sec
uint64_t tv_sec
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2874
ssl_renegotiate_never
ssl_renegotiate_never
Definition: ssl.h:4090
SSL_new
SSL * SSL_new(SSL_CTX *ctx)
Definition: ssl_lib.cc:611
ssl_ctx_get_current_time
void ssl_ctx_get_current_time(const SSL_CTX *ctx, struct OPENSSL_timeval *out_clock)
Definition: ssl_lib.cc:360
retry
void retry(grpc_end2end_test_config config)
Definition: retry.cc:319
SSL_CTX_set_session_id_context
int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const uint8_t *sid_ctx, size_t sid_ctx_len)
Definition: ssl_lib.cc:1518
CRYPTO_free_ex_data
#define CRYPTO_free_ex_data
Definition: boringssl_prefix_symbols.h:1151
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
SSL_get_traffic_secrets
bool SSL_get_traffic_secrets(const SSL *ssl, Span< const uint8_t > *out_read_traffic_secret, Span< const uint8_t > *out_write_traffic_secret)
Definition: ssl_lib.cc:459
CERT::sid_ctx_length
uint8_t sid_ctx_length
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2409
SSL_CTX_set0_buffer_pool
void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool)
Definition: ssl_lib.cc:1467
SSL_CONFIG::ssl
SSL *const ssl
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2967
ssl_session_st::group_id
uint16_t group_id
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3799
bytestring.h
ssl_open_app_data
ssl_open_record_t ssl_open_app_data(SSL *ssl, Span< uint8_t > *out, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
Definition: ssl_lib.cc:260
ssl_do_post_handshake
static int ssl_do_post_handshake(SSL *ssl, const SSLMessage &msg)
Definition: ssl_lib.cc:875
ssl_handshake_new
UniquePtr< SSL_HANDSHAKE > ssl_handshake_new(SSL *ssl)
Definition: handshake.cc:196
ssl_shutdown_error
@ ssl_shutdown_error
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2606
SSL_early_data_accepted
int SSL_early_data_accepted(const SSL *ssl)
Definition: ssl_lib.cc:1219
SSL_CTX_check_private_key
int SSL_CTX_check_private_key(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1704
SSL_connect
int SSL_connect(SSL *ssl)
Definition: ssl_lib.cc:857
SSL_CTX_set_read_ahead
int SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes)
Definition: ssl_lib.cc:1692
in
const char * in
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:391
SSL_set_early_data_enabled
void SSL_set_early_data_enabled(SSL *ssl, int enabled)
Definition: ssl_lib.cc:1208
SSL_set_ex_data
int SSL_set_ex_data(SSL *ssl, int idx, void *data)
Definition: ssl_lib.cc:2538
CertCompressionAlg::decompress
ssl_cert_decompression_func_t decompress
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2591
SSL_CTX_set1_curves_list
int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves)
Definition: ssl_lib.cc:1925
SSL_enable_tls_channel_id
int SSL_enable_tls_channel_id(SSL *ssl)
Definition: ssl_lib.cc:2304
SSL_R_UNINITIALIZED
#define SSL_R_UNINITIALIZED
Definition: ssl.h:5493
SSL_set_tmp_dh
int SSL_set_tmp_dh(SSL *ssl, const DH *dh)
Definition: ssl_lib.cc:1951
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
SSL_set_msg_callback
void SSL_set_msg_callback(SSL *ssl, void(*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg))
Definition: ssl_lib.cc:2681
SSL_get_info_callback
void(*)(const SSL *ssl, int type, int value) SSL_get_info_callback(const SSL *ssl)
Definition: ssl_lib.cc:2488
SSL3_RT_MAX_PLAIN_LENGTH
#define SSL3_RT_MAX_PLAIN_LENGTH
Definition: ssl3.h:235
SSL_set_quic_transport_params
int SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params, size_t params_len)
Definition: ssl_lib.cc:1185
sk_CRYPTO_BUFFER_new_null
#define sk_CRYPTO_BUFFER_new_null
Definition: boringssl_prefix_symbols.h:557
ssl_cert_dup
UniquePtr< CERT > ssl_cert_dup(CERT *cert)
Definition: ssl_cert.cc:150
ssl_session_st::session_id_length
unsigned session_id_length
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3813
ssl_session_st::psk_identity
bssl::UniquePtr< char > psk_identity
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3821
evp_pkey_st
Definition: evp.h:1046
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_CTX_set_session_cache_mode
int SSL_CTX_set_session_cache_mode(SSL_CTX *ctx, int mode)
Definition: ssl_lib.cc:1846
g_ex_data_class_ssl_ctx
static CRYPTO_EX_DATA_CLASS g_ex_data_class_ssl_ctx
Definition: ssl_lib.cc:187
gen_stats_data.found
bool found
Definition: gen_stats_data.py:61
gen_synthetic_protos.label
label
Definition: gen_synthetic_protos.py:102
ERR_R_PASSED_NULL_PARAMETER
#define ERR_R_PASSED_NULL_PARAMETER
Definition: err.h:373
ssl_quic_method_st
Definition: ssl.h:3289
ssl_set_read_error
void ssl_set_read_error(SSL *ssl)
Definition: ssl_lib.cc:209
ssl_early_data_channel_id
ssl_early_data_channel_id
Definition: ssl.h:3575
use_psk_identity_hint
static int use_psk_identity_hint(UniquePtr< char > *out, const char *identity_hint)
Definition: ssl_lib.cc:2581
config
struct config_s config
SSL_get0_next_proto_negotiated
void SSL_get0_next_proto_negotiated(const SSL *ssl, const uint8_t **out_data, unsigned *out_len)
Definition: ssl_lib.cc:2170
SSL_set1_curves
int SSL_set1_curves(SSL *ssl, const int *curves, size_t curves_len)
Definition: ssl_lib.cc:1917
ssl_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3698
ssl_create_cipher_list
bool ssl_create_cipher_list(UniquePtr< SSLCipherPreferenceList > *out_cipher_list, const char *rule_str, bool strict)
Definition: ssl_cipher.cc:1152
tls1_set_curves
bool tls1_set_curves(Array< uint16_t > *out_group_ids, Span< const int > curves)
Definition: extensions.cc:357
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
Definition: err.h:372
ssl_early_callback_ctx
Definition: ssl.h:4186
SSL_CTX_sess_accept_good
int SSL_CTX_sess_accept_good(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2958
SSL_CTX_sess_connect
int SSL_CTX_sess_connect(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2953
SSL_want
int SSL_want(const SSL *ssl)
Definition: ssl_lib.cc:2565
SSL_get_current_expansion
const COMP_METHOD * SSL_get_current_expansion(SSL *ssl)
Definition: ssl_lib.cc:2407
SSL_CTX_set_quiet_shutdown
void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode)
Definition: ssl_lib.cc:2411
EC_GROUP_get_curve_name
#define EC_GROUP_get_curve_name
Definition: boringssl_prefix_symbols.h:1327
CBB_finish
#define CBB_finish
Definition: boringssl_prefix_symbols.h:1043
ssl_early_data_unsupported_for_session
ssl_early_data_unsupported_for_session
Definition: ssl.h:3569
http2_server_health_check.resp
resp
Definition: http2_server_health_check.py:31
SSL_R_CHANNEL_ID_NOT_P256
#define SSL_R_CHANNEL_ID_NOT_P256
Definition: ssl.h:5396
ssl_encryption_initial
ssl_encryption_initial
Definition: ssl.h:3282
SSL_get_ivs
int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv, const uint8_t **out_write_iv, size_t *out_iv_len)
Definition: ssl_lib.cc:2777
BIO_get_retry_reason
#define BIO_get_retry_reason
Definition: boringssl_prefix_symbols.h:797
OPENSSL_timeval
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2873
ssl_reset_error_state
void ssl_reset_error_state(SSL *ssl)
Definition: ssl_lib.cc:201
SSL_CTX_new
SSL_CTX * SSL_CTX_new(const SSL_METHOD *method)
Definition: ssl_lib.cc:538
ssl_get_current_time
void ssl_get_current_time(const SSL *ssl, struct OPENSSL_timeval *out_clock)
Definition: ssl_lib.cc:354
conf.version
string version
Definition: doc/python/sphinx/conf.py:36
ERR_peek_error
#define ERR_peek_error
Definition: boringssl_prefix_symbols.h:1428
SSL_CTX_set_select_certificate_cb
void SSL_CTX_set_select_certificate_cb(SSL_CTX *ctx, enum ssl_select_cert_result_t(*cb)(const SSL_CLIENT_HELLO *))
Definition: ssl_lib.cc:2746
SSL_set_rfd
int SSL_set_rfd(SSL *ssl, int fd)
Definition: ssl_lib.cc:1599
SSL_in_early_data
int SSL_in_early_data(const SSL *ssl)
Definition: ssl_lib.cc:1212
SSL_accept
int SSL_accept(SSL *ssl)
Definition: ssl_lib.cc:866
SSL_set_quic_early_data_context
int SSL_set_quic_early_data_context(SSL *ssl, const uint8_t *context, size_t context_len)
Definition: ssl_lib.cc:1198
SSL_get_secure_renegotiation_support
int SSL_get_secure_renegotiation_support(const SSL *ssl)
Definition: ssl_lib.cc:1823
ssl_send_alert_impl
int ssl_send_alert_impl(SSL *ssl, int level, int desc)
Definition: s3_pkt.cc:396
SSL_get_shared_sigalgs
int SSL_get_shared_sigalgs(SSL *ssl, int idx, int *psign, int *phash, int *psignandhash, uint8_t *rsig, uint8_t *rhash)
Definition: ssl_lib.cc:2507
ssl_st::wbio
bssl::UniquePtr< BIO > wbio
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3723
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
SSL_get0_peer_verify_algorithms
size_t SSL_get0_peer_verify_algorithms(const SSL *ssl, const uint16_t **out_sigalgs)
Definition: ssl_lib.cc:2356
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
SSL_pending
int SSL_pending(const SSL *ssl)
Definition: ssl_lib.cc:1696
ERR_GET_LIB
#define ERR_GET_LIB(packed_error)
Definition: err.h:166
SSL_CTX_enable_tls_channel_id
int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx)
Definition: ssl_lib.cc:2292
BSSL_NAMESPACE_END
#define BSSL_NAMESPACE_END
Definition: base.h:480
SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
Definition: ssl.h:5483
CBS_get_u8
#define CBS_get_u8
Definition: boringssl_prefix_symbols.h:1082
SSL_CTX_set_custom_verify
void SSL_CTX_set_custom_verify(SSL_CTX *ctx, int mode, enum ssl_verify_result_t(*callback)(SSL *ssl, uint8_t *out_alert))
Definition: ssl_lib.cc:2042
SSL_error_description
const char * SSL_error_description(int err)
Definition: ssl_lib.cc:1374
ssl_do_msg_callback
void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type, Span< const uint8_t > in)
Definition: ssl_lib.cc:329
SSL_SENT_SHUTDOWN
#define SSL_SENT_SHUTDOWN
Definition: ssl.h:4348
err.h
BIO_up_ref
#define BIO_up_ref
Definition: boringssl_prefix_symbols.h:866
SSL_reset_early_data_reject
void SSL_reset_early_data_reject(SSL *ssl)
Definition: ssl_lib.cc:1223
SSL_CTX_set_cipher_list
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str)
Definition: ssl_lib.cc:1997
crypto.h
ssl_client_handshake
enum ssl_hs_wait_t ssl_client_handshake(SSL_HANDSHAKE *hs)
Definition: handshake_client.cc:1841
ERR_R_INTERNAL_ERROR
#define ERR_R_INTERNAL_ERROR
Definition: err.h:374
ssl_protocol_version
uint16_t ssl_protocol_version(const SSL *ssl)
Definition: ssl_versions.cc:251
ssl_hs_early_data_rejected
@ ssl_hs_early_data_rejected
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1623
SSL_CTX_up_ref
int SSL_CTX_up_ref(SSL_CTX *ctx)
Definition: ssl_lib.cc:571
arg
Definition: cmdline.cc:40
SSL_CTX_set_reverify_on_resume
void SSL_CTX_set_reverify_on_resume(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:2757
SSL_set_psk_client_callback
void SSL_set_psk_client_callback(SSL *ssl, unsigned(*cb)(SSL *ssl, const char *hint, char *identity, unsigned max_identity_len, uint8_t *psk, unsigned max_psk_len))
Definition: ssl_lib.cc:2638
SSL_ERROR_HANDBACK
#define SSL_ERROR_HANDBACK
Definition: ssl.h:580
CRYPTO_EX_unused
int CRYPTO_EX_unused
Definition: ex_data.h:192
CRYPTO_new_ex_data
#define CRYPTO_new_ex_data
Definition: boringssl_prefix_symbols.h:1179
lhash.h
SSL_CTX_set_tmp_dh_callback
void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*cb)(SSL *ssl, int is_export, int keylength))
Definition: ssl_lib.cc:2574
ssl_renegotiate_once
ssl_renegotiate_once
Definition: ssl.h:4091
SSL_AD_NO_RENEGOTIATION
#define SSL_AD_NO_RENEGOTIATION
Definition: ssl.h:3818
SSL_CTX_free
void SSL_CTX_free(SSL_CTX *ctx)
Definition: ssl_lib.cc:576
SSL_CTX_set_msg_callback
void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void(*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg))
Definition: ssl_lib.cc:2670
SSL_CTX_get_quiet_shutdown
int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2415
SSL_set_tls_channel_id_enabled
void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled)
Definition: ssl_lib.cc:2297
SSL_get0_session_id_context
const uint8_t * SSL_get0_session_id_context(const SSL *ssl, size_t *out_len)
Definition: ssl_lib.cc:1531
CBBFinishArray
bool CBBFinishArray(CBB *cbb, Array< uint8_t > *out)
Definition: ssl_lib.cc:190
SSL_get_ex_data
void * SSL_get_ex_data(const SSL *ssl, int idx)
Definition: ssl_lib.cc:2542
SSL_get_error
int SSL_get_error(const SSL *ssl, int ret_code)
Definition: ssl_lib.cc:1290
SSL_library_init
int SSL_library_init(void)
Definition: ssl_lib.cc:484
SSL_VERIFY_PEER
#define SSL_VERIFY_PEER
Definition: ssl.h:2379
cbb_add_hex
static bool cbb_add_hex(CBB *cbb, Span< const uint8_t > in)
Definition: ssl_lib.cc:275
SSL_quic_read_level
enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl)
Definition: ssl_lib.cc:795
SSL_CTX_set_ex_data
int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *data)
Definition: ssl_lib.cc:2557
SSL_in_init
int SSL_in_init(const SSL *ssl)
Definition: ssl_lib.cc:2723
SSL_CTX_set_psk_client_callback
void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned(*cb)(SSL *ssl, const char *hint, char *identity, unsigned max_identity_len, uint8_t *psk, unsigned max_psk_len))
Definition: ssl_lib.cc:2648
ssl_renegotiate_ignore
ssl_renegotiate_ignore
Definition: ssl.h:4093
ssl_session_st::cipher
const SSL_CIPHER * cipher
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3860
SSL_get_server_random
size_t SSL_get_server_random(const SSL *ssl, uint8_t *out, size_t max_out)
Definition: ssl_lib.cc:2837
SSL_CTX_cipher_in_group
int SSL_CTX_cipher_in_group(const SSL_CTX *ctx, size_t i)
Definition: ssl_lib.cc:1959
SSL_get_options
uint32_t SSL_get_options(const SSL *ssl)
Definition: ssl_lib.cc:1441
SSL_CTX_set_options
uint32_t SSL_CTX_set_options(SSL_CTX *ctx, uint32_t options)
Definition: ssl_lib.cc:1419
SSL_set_psk_server_callback
void SSL_set_psk_server_callback(SSL *ssl, unsigned(*cb)(SSL *ssl, const char *identity, uint8_t *psk, unsigned max_psk_len))
Definition: ssl_lib.cc:2655
SSL_DEFAULT_SESSION_TIMEOUT
#define SSL_DEFAULT_SESSION_TIMEOUT
Definition: ssl.h:1984
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
g_ex_data_class_ssl
static CRYPTO_EX_DATA_CLASS g_ex_data_class_ssl
Definition: ssl_lib.cc:185
callback
static void callback(void *arg, int status, int timeouts, struct hostent *host)
Definition: acountry.c:224
OPENSSL_DECLARE_ERROR_REASON
#define OPENSSL_DECLARE_ERROR_REASON(lib, reason)
Definition: err.h:459
SSL_read
int SSL_read(SSL *ssl, void *buf, int num)
Definition: ssl_lib.cc:1008
SSL_CTX_sess_connect_renegotiate
int SSL_CTX_sess_connect_renegotiate(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2955
BIO_new
#define BIO_new
Definition: boringssl_prefix_symbols.h:814
BIO_RR_CONNECT
#define BIO_RR_CONNECT
Definition: bio.h:193
ssl_st::quiet_shutdown
bool quiet_shutdown
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3781
SSL_set_read_ahead
int SSL_set_read_ahead(SSL *ssl, int yes)
Definition: ssl_lib.cc:1694
SSL_R_INVALID_ALPN_PROTOCOL_LIST
#define SSL_R_INVALID_ALPN_PROTOCOL_LIST
Definition: ssl.h:5582
SSL_get_tlsext_status_type
int SSL_get_tlsext_status_type(const SSL *ssl)
Definition: ssl_lib.cc:3036
min
#define min(a, b)
Definition: qsort.h:83
SSL_get_peer_signature_algorithm
uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl)
Definition: ssl_lib.cc:2815
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
ERR_R_BUF_LIB
#define ERR_R_BUF_LIB
Definition: err.h:335
Delete
void Delete(T *t)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:208
ALPSConfig
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2949
SSL_is_server
int SSL_is_server(const SSL *ssl)
Definition: ssl_lib.cc:2742
SSL_CTX_set_retain_only_sha256_of_client_certs
void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:2863
SSL_get_extms_support
int SSL_get_extms_support(const SSL *ssl)
Definition: ssl_lib.cc:1665
SSL_has_pending
int SSL_has_pending(const SSL *ssl)
Definition: ssl_lib.cc:1700
SSL_CTX_need_tmp_RSA
int SSL_CTX_need_tmp_RSA(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2969
Span< uint8_t >
SSL_quic_max_handshake_flight_len
size_t SSL_quic_max_handshake_flight_len(const SSL *ssl, enum ssl_encryption_level_t level)
Definition: ssl_lib.cc:757
SSL_set_bio
void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio)
Definition: ssl_lib.cc:719
CRYPTO_EX_free
void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int index, long argl, void *argp)
Definition: ex_data.h:174
SSL_CTX_set_next_protos_advertised_cb
void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx, int(*cb)(SSL *ssl, const uint8_t **out, unsigned *out_len, void *arg), void *arg)
Definition: ssl_lib.cc:2176
ssl_can_renegotiate
static bool ssl_can_renegotiate(const SSL *ssl)
Definition: ssl_lib.cc:410
ssl_early_data_quic_parameter_mismatch
ssl_early_data_quic_parameter_mismatch
Definition: ssl.h:3580
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
SSL_get_ciphers
#define SSL_get_ciphers
Definition: boringssl_prefix_symbols.h:330
ssl_st::rbio
bssl::UniquePtr< BIO > rbio
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3722
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
ssl_early_data_accepted
ssl_early_data_accepted
Definition: ssl.h:3559
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
SSL3_AL_FATAL
#define SSL3_AL_FATAL
Definition: ssl3.h:280
SSL_set_jdk11_workaround
void SSL_set_jdk11_workaround(SSL *ssl, int enable)
Definition: ssl_lib.cc:2901
SSL_set_mtu
int SSL_set_mtu(SSL *ssl, unsigned mtu)
Definition: ssl_lib.cc:1815
SSL_R_APPLICATION_DATA_ON_SHUTDOWN
#define SSL_R_APPLICATION_DATA_ON_SHUTDOWN
Definition: ssl.h:5558
SSL_get_read_ahead
int SSL_get_read_ahead(const SSL *ssl)
Definition: ssl_lib.cc:1690
SSL_ERROR_HANDSHAKE_HINTS_READY
#define SSL_ERROR_HANDSHAKE_HINTS_READY
Definition: ssl.h:592
SSL_ST_INIT
#define SSL_ST_INIT
Definition: ssl.h:4269
ssl_st::hostname
bssl::UniquePtr< char > hostname
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3766
ssl.h
SSL_get_tls_channel_id
size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out, size_t max_out)
Definition: ssl_lib.cc:2339
nid
int nid
Definition: cipher_extra.c:71
SSL_AD_CLOSE_NOTIFY
#define SSL_AD_CLOSE_NOTIFY
Definition: ssl.h:3794
SSL_set_custom_verify
void SSL_set_custom_verify(SSL *ssl, int mode, enum ssl_verify_result_t(*callback)(SSL *ssl, uint8_t *out_alert))
Definition: ssl_lib.cc:2049
SSL_CTX_set_strict_cipher_list
int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx, const char *str)
Definition: ssl_lib.cc:2001
SSL_CTX_get_options
uint32_t SSL_CTX_get_options(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1429
ec_key_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h:723
SSL_cutthrough_complete
int SSL_cutthrough_complete(const SSL *ssl)
Definition: ssl_lib.cc:2738
OPENSSL_timeval::tv_usec
uint32_t tv_usec
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2875
SSL_ERROR_WANT_WRITE
#define SSL_ERROR_WANT_WRITE
Definition: ssl.h:499
SSL_CB_CONNECT_EXIT
#define SSL_CB_CONNECT_EXIT
Definition: ssl.h:4290
CRYPTO_EX_DATA_CLASS_INIT_WITH_APP_DATA
#define CRYPTO_EX_DATA_CLASS_INIT_WITH_APP_DATA
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:688
ssl_open_record_t
ssl_open_record_t
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:933
value
const char * value
Definition: hpack_parser_table.cc:165
SSL_free
void SSL_free(SSL *ssl)
Definition: ssl_lib.cc:697
SSL_clear_options
uint32_t SSL_clear_options(SSL *ssl, uint32_t options)
Definition: ssl_lib.cc:1436
CRYPTO_get_ex_data
#define CRYPTO_get_ex_data
Definition: boringssl_prefix_symbols.h:1164
SSL_CTX_get_max_cert_list
size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1769
ERR_restore_state
#define ERR_restore_state
Definition: boringssl_prefix_symbols.h:1442
ssl_session_st::has_application_settings
bool has_application_settings
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3929
SSLMessage
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1140
ssl_st::ssl_st
ssl_st(SSL_CTX *ctx_arg)
Definition: ssl_lib.cc:586
kMaxHandshakeSize
static const size_t kMaxHandshakeSize
Definition: ssl_lib.cc:183
SSL_CTX_get_mode
uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1453
SSL_process_tls13_new_session_ticket
SSL_SESSION * SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf, size_t buf_len)
Definition: ssl_lib.cc:3000
ssl_ctx_st::x509_method
const bssl::SSL_X509_METHOD * x509_method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3410
greeter_client.protos
protos
Definition: no_codegen/greeter_client.py:33
SSL_get_current_compression
const COMP_METHOD * SSL_get_current_compression(SSL *ssl)
Definition: ssl_lib.cc:2405
SSL_R_WRONG_SSL_VERSION
#define SSL_R_WRONG_SSL_VERSION
Definition: ssl.h:5513
SSL_set_quiet_shutdown
void SSL_set_quiet_shutdown(SSL *ssl, int mode)
Definition: ssl_lib.cc:2419
SSL_get_rbio
BIO * SSL_get_rbio(const SSL *ssl)
Definition: ssl_lib.cc:753
TLS1_3_VERSION
#define TLS1_3_VERSION
Definition: ssl.h:653
tls13_create_session_with_ticket
bssl::UniquePtr< SSL_SESSION > tls13_create_session_with_ticket(SSL *ssl, CBS *body)
Definition: tls13_client.cc:1052
ssl_session_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3787
ssl_early_data_unknown
ssl_early_data_unknown
Definition: ssl.h:3555
SSL_set_renegotiate_mode
void SSL_set_renegotiate_mode(SSL *ssl, enum ssl_renegotiate_mode_t mode)
Definition: ssl_lib.cc:2768
SSL_CTX_set_handoff_mode
void SSL_CTX_set_handoff_mode(SSL_CTX *ctx, bool on)
Definition: ssl_lib.cc:406
SSL_set_fd
int SSL_set_fd(SSL *ssl, int fd)
Definition: ssl_lib.cc:1568
CBB_add_bytes
#define CBB_add_bytes
Definition: boringssl_prefix_symbols.h:1025
SSL_set_info_callback
void SSL_set_info_callback(SSL *ssl, void(*cb)(const SSL *ssl, int type, int value))
Definition: ssl_lib.cc:2483
CRYPTO_MUTEX_cleanup
#define CRYPTO_MUTEX_cleanup
Definition: boringssl_prefix_symbols.h:1123
SSL_HANDSHAKE::handshake_finalized
bool handshake_finalized
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1958
SSL_set1_tls_channel_id
int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key)
Definition: ssl_lib.cc:2326
BSSL_NAMESPACE_BEGIN
Definition: trust_token_test.cc:45
SSL_set_tmp_rsa
int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa)
Definition: ssl_lib.cc:2972
timeval::tv_sec
long tv_sec
Definition: setup_once.h:121
ssl_st::s3
bssl::SSL3_STATE * s3
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3730
rand.h
CRYPTO_get_ex_new_index
#define CRYPTO_get_ex_new_index
Definition: boringssl_prefix_symbols.h:1165
key
const char * key
Definition: hpack_parser_table.cc:164
SSL_ERROR_PENDING_SESSION
#define SSL_ERROR_PENDING_SESSION
Definition: ssl.h:543
SSL_CTX_get0_privatekey
EVP_PKEY * SSL_CTX_get0_privatekey(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2388
timeval::tv_usec
long tv_usec
Definition: setup_once.h:122
SSL_CTX_sess_accept_renegotiate
int SSL_CTX_sess_accept_renegotiate(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2957
SSL_provide_quic_data
int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level, const uint8_t *data, size_t len)
Definition: ssl_lib.cc:803
SSL_check_private_key
int SSL_check_private_key(const SSL *ssl)
Definition: ssl_lib.cc:1709
ssl_st::max_cert_list
uint32_t max_cert_list
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3765
OPENSSL_strdup
#define OPENSSL_strdup
Definition: boringssl_prefix_symbols.h:1891
ssl_ctx_st::ssl_ctx_st
ssl_ctx_st(const SSL_METHOD *ssl_method)
Definition: ssl_lib.cc:507
copy_finished
static size_t copy_finished(void *out, size_t out_len, const uint8_t *in, size_t in_len)
Definition: ssl_lib.cc:1618
OPENSSL_INIT_SETTINGS
struct ossl_init_settings_st OPENSSL_INIT_SETTINGS
Definition: base.h:420
SSL_get_mode
uint32_t SSL_get_mode(const SSL *ssl)
Definition: ssl_lib.cc:1465
check_version.settings
settings
Definition: check_version.py:61
ssl_encryption_application
ssl_encryption_application
Definition: ssl.h:3285
BIO_get_fd
#define BIO_get_fd
Definition: boringssl_prefix_symbols.h:790
server
Definition: examples/python/async_streaming/server.py:1
SSL_set_retain_only_sha256_of_client_certs
void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl, int enabled)
Definition: ssl_lib.cc:2856
SSL_get_read_sequence
uint64_t SSL_get_read_sequence(const SSL *ssl)
Definition: ssl_lib.cc:2796
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
SSL_get_max_cert_list
size_t SSL_get_max_cert_list(const SSL *ssl)
Definition: ssl_lib.cc:1780
SSL_OP_NO_QUERY_MTU
#define SSL_OP_NO_QUERY_MTU
Definition: ssl.h:706
EVP_PKEY_get0_EC_KEY
#define EVP_PKEY_get0_EC_KEY
Definition: boringssl_prefix_symbols.h:1629
BIO_should_io_special
#define BIO_should_io_special
Definition: boringssl_prefix_symbols.h:859
SSL_CTX_get_session_cache_mode
int SSL_CTX_get_session_cache_mode(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1852
SSL_set_shutdown
void SSL_set_shutdown(SSL *ssl, int mode)
Definition: ssl_lib.cc:2425
SSL_CTX_set_keylog_callback
void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, void(*cb)(const SSL *ssl, const char *line))
Definition: ssl_lib.cc:2692
SSL_shutdown
int SSL_shutdown(SSL *ssl)
Definition: ssl_lib.cc:1107
SSL_ERROR_ZERO_RETURN
#define SSL_ERROR_ZERO_RETURN
Definition: ssl.h:518
SSL_is_dtls
int SSL_is_dtls(const SSL *ssl)
Definition: ssl_lib.cc:2744
timeval
Definition: setup_once.h:113
ssl_read_impl
static int ssl_read_impl(SSL *ssl)
Definition: ssl_lib.cc:938
SSL_get_wbio
BIO * SSL_get_wbio(const SSL *ssl)
Definition: ssl_lib.cc:755
SSL_AD_DECODE_ERROR
#define SSL_AD_DECODE_ERROR
Definition: ssl.h:3810
check_read_error
static bool check_read_error(const SSL *ssl)
Definition: ssl_lib.cc:214
SSL_CONFIG::~SSL_CONFIG
~SSL_CONFIG()
Definition: ssl_lib.cc:691
SSL_CTX_set_tmp_rsa_callback
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int is_export, int keylength))
Definition: ssl_lib.cc:2567
SSL_CTX_set_permute_extensions
void SSL_CTX_set_permute_extensions(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:2871
ssl_open_handshake
ssl_open_record_t ssl_open_handshake(SSL *ssl, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
Definition: ssl_lib.cc:230
ERR_load_SSL_strings
void ERR_load_SSL_strings(void)
Definition: ssl_lib.cc:2973
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
ssl_st::d1
bssl::DTLS1_STATE * d1
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3731
ssl_st::ex_data
CRYPTO_EX_DATA ex_data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3761
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
SSL_CTX_sess_number
size_t SSL_CTX_sess_number(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1831
SSL_RECEIVED_SHUTDOWN
#define SSL_RECEIVED_SHUTDOWN
Definition: ssl.h:4349
hmac_ctx_st
Definition: hmac.h:158
private_key
Definition: hrss.c:1885
ssl_session_cmp
static int ssl_session_cmp(const SSL_SESSION *a, const SSL_SESSION *b)
Definition: ssl_lib.cc:499
SSL_CTX_get_read_ahead
int SSL_CTX_get_read_ahead(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1688
ssl_st::max_send_fragment
uint16_t max_send_fragment
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3717
ssl_early_data_hello_retry_request
ssl_early_data_hello_retry_request
Definition: ssl.h:3571
SSL_CTX_sess_connect_good
int SSL_CTX_sess_connect_good(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2954
SSL_set_tlsext_status_ocsp_resp
int SSL_set_tlsext_status_ocsp_resp(SSL *ssl, uint8_t *resp, size_t resp_len)
Definition: ssl_lib.cc:3049
ssl_session_st::signed_cert_timestamp_list
bssl::UniquePtr< CRYPTO_BUFFER > signed_cert_timestamp_list
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3870
SSL_set_shed_handshake_config
void SSL_set_shed_handshake_config(SSL *ssl, int enable)
Definition: ssl_lib.cc:2894
ssl_maybe_shed_handshake_config
static void ssl_maybe_shed_handshake_config(SSL *ssl)
Definition: ssl_lib.cc:441
SSL_set_tlsext_status_type
int SSL_set_tlsext_status_type(SSL *ssl, int type)
Definition: ssl_lib.cc:3028
ssl_open_change_cipher_spec
ssl_open_record_t ssl_open_change_cipher_spec(SSL *ssl, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
Definition: ssl_lib.cc:244
SSL_get_shutdown
int SSL_get_shutdown(const SSL *ssl)
Definition: ssl_lib.cc:2441
SSL_R_BAD_HELLO_REQUEST
#define SSL_R_BAD_HELLO_REQUEST
Definition: ssl.h:5378
SSL_ERROR_WANT_CONNECT
#define SSL_ERROR_WANT_CONNECT
Definition: ssl.h:523
SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED
#define SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED
Definition: ssl.h:5566
ssl_open_record_error
@ ssl_open_record_error
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:938
ssl_ctx_st::ex_data
CRYPTO_EX_DATA ex_data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3488
SSL_CTX_get_keylog_callback
void(*)(const SSL *ssl, const char *line) SSL_CTX_get_keylog_callback(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2697
SSL_set1_curves_list
int SSL_set1_curves_list(SSL *ssl, const char *curves)
Definition: ssl_lib.cc:1929
SSL_get_finished
size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count)
Definition: ssl_lib.cc:1627
SSL_get_tlsext_status_ocsp_resp
size_t SSL_get_tlsext_status_ocsp_resp(const SSL *ssl, const uint8_t **out)
Definition: ssl_lib.cc:3057
SSL_CTX_set_next_proto_select_cb
void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx, int(*cb)(SSL *ssl, uint8_t **out, uint8_t *out_len, const uint8_t *in, unsigned in_len, void *arg), void *arg)
Definition: ssl_lib.cc:2184
ssl_method_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3392
ssl_st::msg_callback
void(* msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3734
SSL_cache_hit
int SSL_cache_hit(SSL *ssl)
Definition: ssl_lib.cc:2975
STACK_OF
STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx)
Definition: ssl_lib.cc:1955
xds_manager.num
num
Definition: xds_manager.py:56
SSL_CTX_set_alpn_select_cb
void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, int(*cb)(SSL *ssl, const uint8_t **out, uint8_t *out_len, const uint8_t *in, unsigned in_len, void *arg), void *arg)
Definition: ssl_lib.cc:2216
SSL_set_state
void SSL_set_state(SSL *ssl, int state)
Definition: ssl_lib.cc:2497
regen-readme.line
line
Definition: regen-readme.py:30
SSL_set_max_send_fragment
int SSL_set_max_send_fragment(SSL *ssl, size_t max_send_fragment)
Definition: ssl_lib.cc:1803
SSL_total_renegotiations
int SSL_total_renegotiations(const SSL *ssl)
Definition: ssl_lib.cc:1765
SSL_R_NULL_SSL_METHOD_PASSED
#define SSL_R_NULL_SSL_METHOD_PASSED
Definition: ssl.h:5453
arg
struct arg arg
SSL_get_cipher_list
const char * SSL_get_cipher_list(const SSL *ssl, int n)
Definition: ssl_lib.cc:1979
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
ERR_clear_error
#define ERR_clear_error
Definition: boringssl_prefix_symbols.h:1413
SSL_get0_certificate_types
size_t SSL_get0_certificate_types(const SSL *ssl, const uint8_t **out_types)
Definition: ssl_lib.cc:2347
SSL_set_connect_state
void SSL_set_connect_state(SSL *ssl)
Definition: ssl_lib.cc:701
BIO_set_fd
#define BIO_set_fd
Definition: boringssl_prefix_symbols.h:846
TLSEXT_STATUSTYPE_ocsp
#define TLSEXT_STATUSTYPE_ocsp
Definition: tls1.h:265
SSL_CTX_set_tlsext_ticket_keys
int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len)
Definition: ssl_lib.cc:1880
types
static const struct nv types[]
Definition: adig.c:83
SSL_need_tmp_RSA
int SSL_need_tmp_RSA(const SSL *ssl)
Definition: ssl_lib.cc:2970
ssl_st::method
const bssl::SSL_PROTOCOL_METHOD * method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3706
TLSEXT_MAXLEN_host_name
#define TLSEXT_MAXLEN_host_name
Definition: tls1.h:290
SSL_CTX_set_false_start_allowed_without_alpn
void SSL_CTX_set_false_start_allowed_without_alpn(SSL_CTX *ctx, int allowed)
Definition: ssl_lib.cc:2886
OPENSSL_NPN_NO_OVERLAP
#define OPENSSL_NPN_NO_OVERLAP
Definition: ssl.h:3014
crypto_buffer_pool_st
Definition: third_party/boringssl-with-bazel/src/crypto/pool/internal.h:39
ssl_shutdown_close_notify
@ ssl_shutdown_close_notify
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2605
SSL_CTX_enable_ocsp_stapling
void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx)
Definition: ssl_lib.cc:2070
SSL_is_init_finished
int SSL_is_init_finished(const SSL *ssl)
Definition: ssl_lib.cc:2719
SSL_CTX_set_tlsext_status_cb
int SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx, int(*callback)(SSL *ssl, void *arg))
Definition: ssl_lib.cc:3063
SSL_CTX_sess_cb_hits
int SSL_CTX_sess_cb_hits(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2960
ssl_ctx_rotate_ticket_encryption_key
int ssl_ctx_rotate_ticket_encryption_key(SSL_CTX *ctx)
Definition: ssl_session.cc:403
SSL_has_application_settings
int SSL_has_application_settings(const SSL *ssl)
Definition: ssl_lib.cc:2265
SSL_state
int SSL_state(const SSL *ssl)
Definition: ssl_lib.cc:2493
pool
InternalDescriptorPool * pool
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:807
ssl_st::options
uint32_t options
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3763
ssl_session_st::ocsp_response
bssl::UniquePtr< CRYPTO_BUFFER > ocsp_response
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3873
SSL_get_peer_quic_transport_params
void SSL_get_peer_quic_transport_params(const SSL *ssl, const uint8_t **out_params, size_t *out_params_len)
Definition: ssl_lib.cc:1191
SSL_peek
int SSL_peek(SSL *ssl, void *buf, int num)
Definition: ssl_lib.cc:1023
BIO_NOCLOSE
#define BIO_NOCLOSE
Definition: bio.h:373
SSL_ERROR_EARLY_DATA_REJECTED
#define SSL_ERROR_EARLY_DATA_REJECTED
Definition: ssl.h:570
SSL_select_next_proto
int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer, unsigned peer_len, const uint8_t *supported, unsigned supported_len)
Definition: ssl_lib.cc:2137
SSL_certs_clear
void SSL_certs_clear(SSL *ssl)
Definition: ssl_lib.cc:1541
SSL_add_application_settings
int SSL_add_application_settings(SSL *ssl, const uint8_t *proto, size_t proto_len, const uint8_t *settings, size_t settings_len)
Definition: ssl_lib.cc:2240
SSL_CTX_set_tmp_ecdh
int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key)
Definition: ssl_lib.cc:2977
SSL_CTX_sess_cache_full
int SSL_CTX_sess_cache_full(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2963
CRYPTO_refcount_inc
#define CRYPTO_refcount_inc
Definition: boringssl_prefix_symbols.h:1191
ssl_encryption_early_data
ssl_encryption_early_data
Definition: ssl.h:3283
SSL_CTX_set_max_cert_list
void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, size_t max_cert_list)
Definition: ssl_lib.cc:1773
ssl_hash_session_id
uint32_t ssl_hash_session_id(Span< const uint8_t > session_id)
Definition: ssl_session.cc:171
SSL_set_tmp_ecdh
int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key)
Definition: ssl_lib.cc:2986
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
ssl_do_info_callback
void ssl_do_info_callback(const SSL *ssl, int type, int value)
Definition: ssl_lib.cc:316
SSL_do_handshake
int SSL_do_handshake(SSL *ssl)
Definition: ssl_lib.cc:825
Span::data
T * data() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:132
SSL_set_quic_method
int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method)
Definition: ssl_lib.cc:2520
SSL_ERROR_WANT_X509_LOOKUP
#define SSL_ERROR_WANT_X509_LOOKUP
Definition: ssl.h:507
SSL_early_data_reason_string
const char * SSL_early_data_reason_string(enum ssl_early_data_reason_t reason)
Definition: ssl_lib.cc:1244
SSL_R_DECODE_ERROR
#define SSL_R_DECODE_ERROR
Definition: ssl.h:5405
SSL_CTX_set_dos_protection_cb
void SSL_CTX_set_dos_protection_cb(SSL_CTX *ctx, int(*cb)(const SSL_CLIENT_HELLO *))
Definition: ssl_lib.cc:2752
dh_st
Definition: dh.h:305
mem.h
ssl_ctx_st::lock
CRYPTO_MUTEX lock
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3413
client.level
level
Definition: examples/python/async_streaming/client.py:118
SSL_get_pending_cipher
const SSL_CIPHER * SSL_get_pending_cipher(const SSL *ssl)
Definition: ssl_lib.cc:2848
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
rsa_st
Definition: rsa.h:732
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
SSL_get_privatekey
EVP_PKEY * SSL_get_privatekey(const SSL *ssl)
Definition: ssl_lib.cc:2376
SSL_R_DATA_LENGTH_TOO_LONG
#define SSL_R_DATA_LENGTH_TOO_LONG
Definition: ssl.h:5404
SSL_enable_signed_cert_timestamps
void SSL_enable_signed_cert_timestamps(SSL *ssl)
Definition: ssl_lib.cc:2063
SSL_CTX_set_min_proto_version
#define SSL_CTX_set_min_proto_version
Definition: boringssl_prefix_symbols.h:175
SSL_CTX_get_tlsext_ticket_keys
int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out, size_t len)
Definition: ssl_lib.cc:1857
SSL_CTX_set_tlsext_servername_arg
int SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg)
Definition: ssl_lib.cc:2132
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
sk_SSL_CIPHER_num
#define sk_SSL_CIPHER_num
Definition: boringssl_prefix_symbols.h:570
CRYPTO_set_ex_data
#define CRYPTO_set_ex_data
Definition: boringssl_prefix_symbols.h:1196
SSL_get_session
#define SSL_get_session
Definition: boringssl_prefix_symbols.h:376
SSL3_RT_HEADER
#define SSL3_RT_HEADER
Definition: ssl3.h:277
ssl_ctx_st::~ssl_ctx_st
~ssl_ctx_st()
Definition: ssl_lib.cc:525
method
NSString * method
Definition: ProtoMethod.h:28
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
SSL_get0_signed_cert_timestamp_list
void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out, size_t *out_len)
Definition: ssl_lib.cc:2081
SSL_set_tmp_rsa_callback
void SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int is_export, int keylength))
Definition: ssl_lib.cc:2571
SSL_CTX_set_tlsext_status_arg
int SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg)
Definition: ssl_lib.cc:3069
ssl_ticket_aead_method_st
Definition: ssl.h:2241
SSL_CTX_set_max_send_fragment
int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment)
Definition: ssl_lib.cc:1791
SSL_CTX_set_tls_channel_id_enabled
void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx, int enabled)
Definition: ssl_lib.cc:2288
SSL_process_quic_post_handshake
int SSL_process_quic_post_handshake(SSL *ssl)
Definition: ssl_lib.cc:911
ssl_run_handshake
int ssl_run_handshake(SSL_HANDSHAKE *hs, bool *out_early_return)
Definition: handshake.cc:588
ssl_encryption_handshake
ssl_encryption_handshake
Definition: ssl.h:3284
dtls1_min_mtu
unsigned int dtls1_min_mtu(void)
Definition: d1_both.cc:831
SSL_ERROR_PENDING_CERTIFICATE
#define SSL_ERROR_PENDING_CERTIFICATE
Definition: ssl.h:550
OPENSSL_free
#define OPENSSL_free
Definition: boringssl_prefix_symbols.h:1869
mkowners.todo
todo
Definition: mkowners.py:209
ssl_st::renegotiate_mode
ssl_renegotiate_mode_t renegotiate_mode
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3772
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
SSL_get_curve_id
uint16_t SSL_get_curve_id(const SSL *ssl)
Definition: ssl_lib.cc:1936
PSK_MAX_IDENTITY_LEN
#define PSK_MAX_IDENTITY_LEN
Definition: ssl.h:3108
crypto_mutex_st
Definition: thread.h:70
ssl_log_secret
bool ssl_log_secret(const SSL *ssl, const char *label, Span< const uint8_t > secret)
Definition: ssl_lib.cc:291
ERR_clear_system_error
#define ERR_clear_system_error
Definition: boringssl_prefix_symbols.h:1414
TLSEXT_NAMETYPE_host_name
#define TLSEXT_NAMETYPE_host_name
Definition: ssl.h:2721
ssl_early_data_session_not_resumed
ssl_early_data_session_not_resumed
Definition: ssl.h:3567
SSL_set_handoff_mode
void SSL_set_handoff_mode(SSL *ssl, bool on)
Definition: ssl_lib.cc:452
SSL_get_peer_finished
size_t SSL_get_peer_finished(const SSL *ssl, void *buf, size_t count)
Definition: ssl_lib.cc:1642
tls_append_handshake_data
bool tls_append_handshake_data(SSL *ssl, Span< const uint8_t > data)
Definition: s3_both.cc:552
SSL_R_SSL_HANDSHAKE_FAILURE
#define SSL_R_SSL_HANDSHAKE_FAILURE
Definition: ssl.h:5482
SSL_ERROR_WANT_CERTIFICATE_VERIFY
#define SSL_ERROR_WANT_CERTIFICATE_VERIFY
Definition: ssl.h:577
SSL_set_permute_extensions
void SSL_set_permute_extensions(SSL *ssl, int enabled)
Definition: ssl_lib.cc:2875
SSL_ST_OK
#define SSL_ST_OK
Definition: ssl.h:4270
ssl_cert_decompression_func_t
int(* ssl_cert_decompression_func_t)(SSL *ssl, CRYPTO_BUFFER **out, size_t uncompressed_len, const uint8_t *in, size_t in_len)
Definition: ssl.h:2926
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
SSL_clear
int SSL_clear(SSL *ssl)
Definition: ssl_lib.cc:2915
ERR_LIB_SYS
@ ERR_LIB_SYS
Definition: err.h:293
SSL_CTX_set_tmp_dh
int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh)
Definition: ssl_lib.cc:1947
SSL_R_NO_RENEGOTIATION
#define SSL_R_NO_RENEGOTIATION
Definition: ssl.h:5449
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
SSL_CTX_set_tlsext_servername_callback
int SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx, int(*callback)(SSL *ssl, int *out_alert, void *arg))
Definition: ssl_lib.cc:2126
SSL_CTX_get_ciphers
#define SSL_CTX_get_ciphers
Definition: boringssl_prefix_symbols.h:91
CRYPTO_BUFFER_data
#define CRYPTO_BUFFER_data
Definition: boringssl_prefix_symbols.h:1115
ERR_R_MALLOC_FAILURE
#define ERR_R_MALLOC_FAILURE
Definition: err.h:371
BIO_TYPE_DESCRIPTOR
#define BIO_TYPE_DESCRIPTOR
Definition: bio.h:800
SSL_R_EXCESSIVE_MESSAGE_SIZE
#define SSL_R_EXCESSIVE_MESSAGE_SIZE
Definition: ssl.h:5418
SSL_get_fd
int SSL_get_fd(const SSL *ssl)
Definition: ssl_lib.cc:1548
SSL_write
int SSL_write(SSL *ssl, const void *buf, int num)
Definition: ssl_lib.cc:1042
ssl_session_st::session_id
uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3814
SSL_R_PROTOCOL_IS_SHUTDOWN
#define SSL_R_PROTOCOL_IS_SHUTDOWN
Definition: ssl.h:5461
SSL_HANDSHAKE::wait
enum ssl_hs_wait_t wait
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1733
CRYPTO_refcount_dec_and_test_zero
#define CRYPTO_refcount_dec_and_test_zero
Definition: boringssl_prefix_symbols.h:1190
SSL_clear_mode
uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode)
Definition: ssl_lib.cc:1460
BIO_should_read
#define BIO_should_read
Definition: boringssl_prefix_symbols.h:860
SSL_set0_rbio
void SSL_set0_rbio(SSL *ssl, BIO *rbio)
Definition: ssl_lib.cc:711
SSL_CTX_sess_timeouts
int SSL_CTX_sess_timeouts(const SSL_CTX *ctx)
Definition: ssl_lib.cc:2962
SSL_CTX_set1_tls_channel_id
int SSL_CTX_set1_tls_channel_id(SSL_CTX *ctx, EVP_PKEY *private_key)
Definition: ssl_lib.cc:2316
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
SSL_ERROR_PENDING_TICKET
#define SSL_ERROR_PENDING_TICKET
Definition: ssl.h:564
ssl_renegotiate_freely
ssl_renegotiate_freely
Definition: ssl.h:4092
SSL_ERROR_HANDOFF
#define SSL_ERROR_HANDOFF
Definition: ssl.h:579
SSL_set_options
uint32_t SSL_set_options(SSL *ssl, uint32_t options)
Definition: ssl_lib.cc:1431
SSL_ERROR_SYSCALL
#define SSL_ERROR_SYSCALL
Definition: ssl.h:514


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