ssl_session.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-2006 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 2005 Nokia. All rights reserved.
112  *
113  * The portions of the attached software ("Contribution") is developed by
114  * Nokia Corporation and is licensed pursuant to the OpenSSL open source
115  * license.
116  *
117  * The Contribution, originally written by Mika Kousa and Pasi Eronen of
118  * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
119  * support (see RFC 4279) to OpenSSL.
120  *
121  * No patent licenses or other rights except those expressly stated in
122  * the OpenSSL open source license shall be deemed granted or received
123  * expressly, by implication, estoppel, or otherwise.
124  *
125  * No assurances are provided by Nokia that the Contribution does not
126  * infringe the patent or other intellectual property rights of any third
127  * party or that the license provides you with all the necessary rights
128  * to make use of the Contribution.
129  *
130  * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
131  * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
132  * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
133  * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
134  * OTHERWISE. */
135 
136 #include <openssl/ssl.h>
137 
138 #include <assert.h>
139 #include <stdlib.h>
140 #include <string.h>
141 
142 #include <utility>
143 
144 #include <openssl/err.h>
145 #include <openssl/hmac.h>
146 #include <openssl/lhash.h>
147 #include <openssl/mem.h>
148 #include <openssl/rand.h>
149 
150 #include "internal.h"
151 #include "../crypto/internal.h"
152 
153 
155 
156 // The address of this is a magic value, a pointer to which is returned by
157 // SSL_magic_pending_session_ptr(). It allows a session callback to indicate
158 // that it needs to asynchronously fetch session information.
159 static const char g_pending_session_magic = 0;
160 
163 
164 static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *session);
165 static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *session);
166 
167 UniquePtr<SSL_SESSION> ssl_session_new(const SSL_X509_METHOD *x509_method) {
168  return MakeUnique<SSL_SESSION>(x509_method);
169 }
170 
172  // Take the first four bytes of |session_id|. Session IDs are generated by the
173  // server randomly, so we can assume even using the first four bytes results
174  // in a good distribution.
175  uint8_t tmp_storage[sizeof(uint32_t)];
176  if (session_id.size() < sizeof(tmp_storage)) {
177  OPENSSL_memset(tmp_storage, 0, sizeof(tmp_storage));
178  OPENSSL_memcpy(tmp_storage, session_id.data(), session_id.size());
179  session_id = tmp_storage;
180  }
181 
182  uint32_t hash =
183  ((uint32_t)session_id[0]) |
184  ((uint32_t)session_id[1] << 8) |
185  ((uint32_t)session_id[2] << 16) |
186  ((uint32_t)session_id[3] << 24);
187 
188  return hash;
189 }
190 
191 UniquePtr<SSL_SESSION> SSL_SESSION_dup(SSL_SESSION *session, int dup_flags) {
192  UniquePtr<SSL_SESSION> new_session = ssl_session_new(session->x509_method);
193  if (!new_session) {
194  return nullptr;
195  }
196 
197  new_session->is_server = session->is_server;
198  new_session->ssl_version = session->ssl_version;
199  new_session->is_quic = session->is_quic;
200  new_session->sid_ctx_length = session->sid_ctx_length;
201  OPENSSL_memcpy(new_session->sid_ctx, session->sid_ctx, session->sid_ctx_length);
202 
203  // Copy the key material.
204  new_session->secret_length = session->secret_length;
205  OPENSSL_memcpy(new_session->secret, session->secret, session->secret_length);
206  new_session->cipher = session->cipher;
207 
208  // Copy authentication state.
209  if (session->psk_identity != nullptr) {
210  new_session->psk_identity.reset(
211  OPENSSL_strdup(session->psk_identity.get()));
212  if (new_session->psk_identity == nullptr) {
213  return nullptr;
214  }
215  }
216  if (session->certs != nullptr) {
217  auto buf_up_ref = [](CRYPTO_BUFFER *buf) {
219  return buf;
220  };
221  new_session->certs.reset(sk_CRYPTO_BUFFER_deep_copy(
222  session->certs.get(), buf_up_ref, CRYPTO_BUFFER_free));
223  if (new_session->certs == nullptr) {
224  return nullptr;
225  }
226  }
227 
228  if (!session->x509_method->session_dup(new_session.get(), session)) {
229  return nullptr;
230  }
231 
232  new_session->verify_result = session->verify_result;
233 
234  new_session->ocsp_response = UpRef(session->ocsp_response);
235  new_session->signed_cert_timestamp_list =
236  UpRef(session->signed_cert_timestamp_list);
237 
238  OPENSSL_memcpy(new_session->peer_sha256, session->peer_sha256,
240  new_session->peer_sha256_valid = session->peer_sha256_valid;
241 
242  new_session->peer_signature_algorithm = session->peer_signature_algorithm;
243 
244  new_session->timeout = session->timeout;
245  new_session->auth_timeout = session->auth_timeout;
246  new_session->time = session->time;
247 
248  // Copy non-authentication connection properties.
249  if (dup_flags & SSL_SESSION_INCLUDE_NONAUTH) {
250  new_session->session_id_length = session->session_id_length;
251  OPENSSL_memcpy(new_session->session_id, session->session_id,
252  session->session_id_length);
253 
254  new_session->group_id = session->group_id;
255 
256  OPENSSL_memcpy(new_session->original_handshake_hash,
257  session->original_handshake_hash,
258  session->original_handshake_hash_len);
259  new_session->original_handshake_hash_len =
261  new_session->ticket_lifetime_hint = session->ticket_lifetime_hint;
262  new_session->ticket_age_add = session->ticket_age_add;
263  new_session->ticket_max_early_data = session->ticket_max_early_data;
264  new_session->extended_master_secret = session->extended_master_secret;
265  new_session->has_application_settings = session->has_application_settings;
266 
267  if (!new_session->early_alpn.CopyFrom(session->early_alpn) ||
268  !new_session->quic_early_data_context.CopyFrom(
269  session->quic_early_data_context) ||
270  !new_session->local_application_settings.CopyFrom(
271  session->local_application_settings) ||
272  !new_session->peer_application_settings.CopyFrom(
273  session->peer_application_settings)) {
274  return nullptr;
275  }
276  }
277 
278  // Copy the ticket.
279  if (dup_flags & SSL_SESSION_INCLUDE_TICKET &&
280  !new_session->ticket.CopyFrom(session->ticket)) {
281  return nullptr;
282  }
283 
284  // The new_session does not get a copy of the ex_data.
285 
286  new_session->not_resumable = true;
287  return new_session;
288 }
289 
291  struct OPENSSL_timeval now;
292  ssl_get_current_time(ssl, &now);
293 
294  // To avoid overflows and underflows, if we've gone back in time, update the
295  // time, but mark the session expired.
296  if (session->time > now.tv_sec) {
297  session->time = now.tv_sec;
298  session->timeout = 0;
299  session->auth_timeout = 0;
300  return;
301  }
302 
303  // Adjust the session time and timeouts. If the session has already expired,
304  // clamp the timeouts at zero.
305  uint64_t delta = now.tv_sec - session->time;
306  session->time = now.tv_sec;
307  if (session->timeout < delta) {
308  session->timeout = 0;
309  } else {
310  session->timeout -= delta;
311  }
312  if (session->auth_timeout < delta) {
313  session->auth_timeout = 0;
314  } else {
315  session->auth_timeout -= delta;
316  }
317 }
318 
320  uint32_t timeout) {
321  // Rebase the timestamp relative to the current time so |timeout| is measured
322  // correctly.
323  ssl_session_rebase_time(ssl, session);
324 
325  if (session->timeout > timeout) {
326  return;
327  }
328 
329  session->timeout = timeout;
330  if (session->timeout > session->auth_timeout) {
331  session->timeout = session->auth_timeout;
332  }
333 }
334 
336  uint16_t ret;
338  // An |SSL_SESSION| will never have an invalid version. This is enforced by
339  // the parser.
340  assert(0);
341  return 0;
342  }
343 
344  return ret;
345 }
346 
347 const EVP_MD *ssl_session_get_digest(const SSL_SESSION *session) {
349  session->cipher);
350 }
351 
353  SSL *const ssl = hs->ssl;
354  if (ssl->mode & SSL_MODE_NO_SESSION_CREATION) {
356  return false;
357  }
358 
359  UniquePtr<SSL_SESSION> session = ssl_session_new(ssl->ctx->x509_method);
360  if (session == NULL) {
361  return false;
362  }
363 
364  session->is_server = ssl->server;
365  session->ssl_version = ssl->version;
366  session->is_quic = ssl->quic_method != nullptr;
367 
368  // Fill in the time from the |SSL_CTX|'s clock.
369  struct OPENSSL_timeval now;
370  ssl_get_current_time(ssl, &now);
371  session->time = now.tv_sec;
372 
374  if (version >= TLS1_3_VERSION) {
375  // TLS 1.3 uses tickets as authenticators, so we are willing to use them for
376  // longer.
377  session->timeout = ssl->session_ctx->session_psk_dhe_timeout;
378  session->auth_timeout = SSL_DEFAULT_SESSION_AUTH_TIMEOUT;
379  } else {
380  // TLS 1.2 resumption does not incorporate new key material, so we use a
381  // much shorter timeout.
382  session->timeout = ssl->session_ctx->session_timeout;
383  session->auth_timeout = ssl->session_ctx->session_timeout;
384  }
385 
386  if (hs->config->cert->sid_ctx_length > sizeof(session->sid_ctx)) {
388  return false;
389  }
390  OPENSSL_memcpy(session->sid_ctx, hs->config->cert->sid_ctx,
391  hs->config->cert->sid_ctx_length);
392  session->sid_ctx_length = hs->config->cert->sid_ctx_length;
393 
394  // The session is marked not resumable until it is completely filled in.
395  session->not_resumable = true;
396  session->verify_result = X509_V_ERR_INVALID_CALL;
397 
398  hs->new_session = std::move(session);
399  ssl_set_session(ssl, NULL);
400  return true;
401 }
402 
406  {
407  // Avoid acquiring a write lock in the common case (i.e. a non-default key
408  // is used or the default keys have not expired yet).
409  MutexReadLock lock(&ctx->lock);
410  if (ctx->ticket_key_current &&
411  (ctx->ticket_key_current->next_rotation_tv_sec == 0 ||
412  ctx->ticket_key_current->next_rotation_tv_sec > now.tv_sec) &&
413  (!ctx->ticket_key_prev ||
414  ctx->ticket_key_prev->next_rotation_tv_sec > now.tv_sec)) {
415  return 1;
416  }
417  }
418 
419  MutexWriteLock lock(&ctx->lock);
420  if (!ctx->ticket_key_current ||
421  (ctx->ticket_key_current->next_rotation_tv_sec != 0 &&
422  ctx->ticket_key_current->next_rotation_tv_sec <= now.tv_sec)) {
423  // The current key has not been initialized or it is expired.
424  auto new_key = bssl::MakeUnique<TicketKey>();
425  if (!new_key) {
426  return 0;
427  }
428  RAND_bytes(new_key->name, 16);
429  RAND_bytes(new_key->hmac_key, 16);
430  RAND_bytes(new_key->aes_key, 16);
431  new_key->next_rotation_tv_sec =
433  if (ctx->ticket_key_current) {
434  // The current key expired. Rotate it to prev and bump up its rotation
435  // timestamp. Note that even with the new rotation time it may still be
436  // expired and get dropped below.
437  ctx->ticket_key_current->next_rotation_tv_sec +=
439  ctx->ticket_key_prev = std::move(ctx->ticket_key_current);
440  }
441  ctx->ticket_key_current = std::move(new_key);
442  }
443 
444  // Drop an expired prev key.
445  if (ctx->ticket_key_prev &&
446  ctx->ticket_key_prev->next_rotation_tv_sec <= now.tv_sec) {
447  ctx->ticket_key_prev.reset();
448  }
449 
450  return 1;
451 }
452 
454  const uint8_t *session_buf,
455  size_t session_len) {
456  ScopedEVP_CIPHER_CTX ctx;
457  ScopedHMAC_CTX hctx;
458 
459  // If the session is too long, emit a dummy value rather than abort the
460  // connection.
461  static const size_t kMaxTicketOverhead =
463  if (session_len > 0xffff - kMaxTicketOverhead) {
464  static const char kTicketPlaceholder[] = "TICKET TOO LARGE";
465  return CBB_add_bytes(out, (const uint8_t *)kTicketPlaceholder,
466  strlen(kTicketPlaceholder));
467  }
468 
469  // Initialize HMAC and cipher contexts. If callback present it does all the
470  // work otherwise use generated values from parent ctx.
471  SSL_CTX *tctx = hs->ssl->session_ctx.get();
473  uint8_t key_name[16];
474  if (tctx->ticket_key_cb != NULL) {
475  if (tctx->ticket_key_cb(hs->ssl, key_name, iv, ctx.get(), hctx.get(),
476  1 /* encrypt */) < 0) {
477  return 0;
478  }
479  } else {
480  // Rotate ticket key if necessary.
482  return 0;
483  }
484  MutexReadLock lock(&tctx->lock);
485  if (!RAND_bytes(iv, 16) ||
486  !EVP_EncryptInit_ex(ctx.get(), EVP_aes_128_cbc(), NULL,
487  tctx->ticket_key_current->aes_key, iv) ||
488  !HMAC_Init_ex(hctx.get(), tctx->ticket_key_current->hmac_key, 16,
489  tlsext_tick_md(), NULL)) {
490  return 0;
491  }
492  OPENSSL_memcpy(key_name, tctx->ticket_key_current->name, 16);
493  }
494 
495  uint8_t *ptr;
496  if (!CBB_add_bytes(out, key_name, 16) ||
498  !CBB_reserve(out, &ptr, session_len + EVP_MAX_BLOCK_LENGTH)) {
499  return 0;
500  }
501 
502  size_t total = 0;
503 #if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
504  OPENSSL_memcpy(ptr, session_buf, session_len);
505  total = session_len;
506 #else
507  int len;
508  if (!EVP_EncryptUpdate(ctx.get(), ptr + total, &len, session_buf, session_len)) {
509  return 0;
510  }
511  total += len;
512  if (!EVP_EncryptFinal_ex(ctx.get(), ptr + total, &len)) {
513  return 0;
514  }
515  total += len;
516 #endif
517  if (!CBB_did_write(out, total)) {
518  return 0;
519  }
520 
521  unsigned hlen;
522  if (!HMAC_Update(hctx.get(), CBB_data(out), CBB_len(out)) ||
524  !HMAC_Final(hctx.get(), ptr, &hlen) ||
525  !CBB_did_write(out, hlen)) {
526  return 0;
527  }
528 
529  return 1;
530 }
531 
533  const uint8_t *session_buf,
534  size_t session_len) {
535  SSL *const ssl = hs->ssl;
536  const SSL_TICKET_AEAD_METHOD *method = ssl->session_ctx->ticket_aead_method;
537  const size_t max_overhead = method->max_overhead(ssl);
538  const size_t max_out = session_len + max_overhead;
539  if (max_out < max_overhead) {
541  return 0;
542  }
543 
544  uint8_t *ptr;
545  if (!CBB_reserve(out, &ptr, max_out)) {
546  return 0;
547  }
548 
549  size_t out_len;
550  if (!method->seal(ssl, ptr, &out_len, max_out, session_buf,
551  session_len)) {
553  return 0;
554  }
555 
556  if (!CBB_did_write(out, out_len)) {
557  return 0;
558  }
559 
560  return 1;
561 }
562 
564  const SSL_SESSION *session) {
565  // Serialize the SSL_SESSION to be encoded into the ticket.
566  uint8_t *session_buf = NULL;
567  size_t session_len;
568  if (!SSL_SESSION_to_bytes_for_ticket(session, &session_buf, &session_len)) {
569  return -1;
570  }
571 
572  int ret = 0;
573  if (hs->ssl->session_ctx->ticket_aead_method) {
574  ret = ssl_encrypt_ticket_with_method(hs, out, session_buf, session_len);
575  } else {
576  ret = ssl_encrypt_ticket_with_cipher_ctx(hs, out, session_buf, session_len);
577  }
578 
579  OPENSSL_free(session_buf);
580  return ret;
581 }
582 
584  const SSL_SESSION *session) {
585  if (session == NULL) {
586  return 0;
587  }
588 
589  return session->sid_ctx_length == hs->config->cert->sid_ctx_length &&
590  OPENSSL_memcmp(session->sid_ctx, hs->config->cert->sid_ctx,
591  hs->config->cert->sid_ctx_length) == 0;
592 }
593 
594 int ssl_session_is_time_valid(const SSL *ssl, const SSL_SESSION *session) {
595  if (session == NULL) {
596  return 0;
597  }
598 
599  struct OPENSSL_timeval now;
600  ssl_get_current_time(ssl, &now);
601 
602  // Reject tickets from the future to avoid underflow.
603  if (now.tv_sec < session->time) {
604  return 0;
605  }
606 
607  return session->timeout > now.tv_sec - session->time;
608 }
609 
611  const SSL_SESSION *session) {
612  const SSL *const ssl = hs->ssl;
613  return ssl_session_is_context_valid(hs, session) &&
614  // The session must have been created by the same type of end point as
615  // we're now using it with.
616  ssl->server == session->is_server &&
617  // The session must not be expired.
618  ssl_session_is_time_valid(ssl, session) &&
619  // Only resume if the session's version matches the negotiated
620  // version.
621  ssl->version == session->ssl_version &&
622  // Only resume if the session's cipher matches the negotiated one. This
623  // is stricter than necessary for TLS 1.3, which allows cross-cipher
624  // resumption if the PRF hashes match. We require an exact match for
625  // simplicity. If loosening this, the 0-RTT accept logic must be
626  // updated to check the cipher.
627  hs->new_cipher == session->cipher &&
628  // If the session contains a client certificate (either the full
629  // certificate or just the hash) then require that the form of the
630  // certificate matches the current configuration.
631  ((sk_CRYPTO_BUFFER_num(session->certs.get()) == 0 &&
632  !session->peer_sha256_valid) ||
633  session->peer_sha256_valid ==
635  // Only resume if the underlying transport protocol hasn't changed.
636  // This is to prevent cross-protocol resumption between QUIC and TCP.
637  (hs->ssl->quic_method != nullptr) == session->is_quic;
638 }
639 
640 // ssl_lookup_session looks up |session_id| in the session cache and sets
641 // |*out_session| to an |SSL_SESSION| object if found.
643  SSL_HANDSHAKE *hs, UniquePtr<SSL_SESSION> *out_session,
644  Span<const uint8_t> session_id) {
645  SSL *const ssl = hs->ssl;
646  out_session->reset();
647 
648  if (session_id.empty() || session_id.size() > SSL_MAX_SSL_SESSION_ID_LENGTH) {
649  return ssl_hs_ok;
650  }
651 
652  UniquePtr<SSL_SESSION> session;
653  // Try the internal cache, if it exists.
654  if (!(ssl->session_ctx->session_cache_mode &
656  uint32_t hash = ssl_hash_session_id(session_id);
657  auto cmp = [](const void *key, const SSL_SESSION *sess) -> int {
659  *reinterpret_cast<const Span<const uint8_t> *>(key);
660  Span<const uint8_t> sess_id =
661  MakeConstSpan(sess->session_id, sess->session_id_length);
662  return key_id == sess_id ? 0 : 1;
663  };
664  MutexReadLock lock(&ssl->session_ctx->lock);
665  // |lh_SSL_SESSION_retrieve_key| returns a non-owning pointer.
666  session = UpRef(lh_SSL_SESSION_retrieve_key(ssl->session_ctx->sessions,
667  &session_id, hash, cmp));
668  // TODO(davidben): This should probably move it to the front of the list.
669  }
670 
671  // Fall back to the external cache, if it exists.
672  if (!session && ssl->session_ctx->get_session_cb != nullptr) {
673  int copy = 1;
674  session.reset(ssl->session_ctx->get_session_cb(ssl, session_id.data(),
675  session_id.size(), &copy));
676  if (!session) {
677  return ssl_hs_ok;
678  }
679 
680  if (session.get() == SSL_magic_pending_session_ptr()) {
681  session.release(); // This pointer is not actually owned.
682  return ssl_hs_pending_session;
683  }
684 
685  // Increment reference count now if the session callback asks us to do so
686  // (note that if the session structures returned by the callback are shared
687  // between threads, it must handle the reference count itself [i.e. copy ==
688  // 0], or things won't be thread-safe).
689  if (copy) {
690  SSL_SESSION_up_ref(session.get());
691  }
692 
693  // Add the externally cached session to the internal cache if necessary.
694  if (!(ssl->session_ctx->session_cache_mode &
696  SSL_CTX_add_session(ssl->session_ctx.get(), session.get());
697  }
698  }
699 
700  if (session && !ssl_session_is_time_valid(ssl, session.get())) {
701  // The session was from the cache, so remove it.
702  SSL_CTX_remove_session(ssl->session_ctx.get(), session.get());
703  session.reset();
704  }
705 
706  *out_session = std::move(session);
707  return ssl_hs_ok;
708 }
709 
711  UniquePtr<SSL_SESSION> *out_session,
712  bool *out_tickets_supported,
713  bool *out_renew_ticket,
714  const SSL_CLIENT_HELLO *client_hello) {
715  // This is used only by servers.
716  assert(hs->ssl->server);
717  UniquePtr<SSL_SESSION> session;
718  bool renew_ticket = false;
719 
720  // If tickets are disabled, always behave as if no tickets are present.
721  CBS ticket;
722  const bool tickets_supported =
724  ssl_client_hello_get_extension(client_hello, &ticket,
726  if (tickets_supported && CBS_len(&ticket) != 0) {
727  switch (ssl_process_ticket(hs, &session, &renew_ticket, ticket,
728  MakeConstSpan(client_hello->session_id,
729  client_hello->session_id_len))) {
731  break;
733  assert(!session);
734  break;
736  return ssl_hs_error;
738  return ssl_hs_pending_ticket;
739  }
740  } else {
741  // The client didn't send a ticket, so the session ID is a real ID.
742  enum ssl_hs_wait_t lookup_ret = ssl_lookup_session(
743  hs, &session,
744  MakeConstSpan(client_hello->session_id, client_hello->session_id_len));
745  if (lookup_ret != ssl_hs_ok) {
746  return lookup_ret;
747  }
748  }
749 
750  *out_session = std::move(session);
751  *out_tickets_supported = tickets_supported;
752  *out_renew_ticket = renew_ticket;
753  return ssl_hs_ok;
754 }
755 
756 static bool remove_session(SSL_CTX *ctx, SSL_SESSION *session, bool lock) {
757  if (session == nullptr || session->session_id_length == 0) {
758  return false;
759  }
760 
761  if (lock) {
763  }
764 
765  SSL_SESSION *found_session = lh_SSL_SESSION_retrieve(ctx->sessions, session);
766  bool found = found_session == session;
767  if (found) {
768  found_session = lh_SSL_SESSION_delete(ctx->sessions, session);
769  SSL_SESSION_list_remove(ctx, session);
770  }
771 
772  if (lock) {
774  }
775 
776  if (found) {
777  // TODO(https://crbug.com/boringssl/251): Callbacks should not be called
778  // under a lock.
779  if (ctx->remove_session_cb != nullptr) {
780  ctx->remove_session_cb(ctx, found_session);
781  }
782  SSL_SESSION_free(found_session);
783  }
784 
785  return found;
786 }
787 
788 void ssl_set_session(SSL *ssl, SSL_SESSION *session) {
789  if (ssl->session.get() == session) {
790  return;
791  }
792 
793  ssl->session = UpRef(session);
794 }
795 
796 // locked by SSL_CTX in the calling function
798  if (session->next == NULL || session->prev == NULL) {
799  return;
800  }
801 
802  if (session->next == (SSL_SESSION *)&ctx->session_cache_tail) {
803  // last element in list
804  if (session->prev == (SSL_SESSION *)&ctx->session_cache_head) {
805  // only one element in list
806  ctx->session_cache_head = NULL;
807  ctx->session_cache_tail = NULL;
808  } else {
809  ctx->session_cache_tail = session->prev;
810  session->prev->next = (SSL_SESSION *)&(ctx->session_cache_tail);
811  }
812  } else {
813  if (session->prev == (SSL_SESSION *)&ctx->session_cache_head) {
814  // first element in list
815  ctx->session_cache_head = session->next;
816  session->next->prev = (SSL_SESSION *)&(ctx->session_cache_head);
817  } else { // middle of list
818  session->next->prev = session->prev;
819  session->prev->next = session->next;
820  }
821  }
822  session->prev = session->next = NULL;
823 }
824 
825 static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *session) {
826  if (session->next != NULL && session->prev != NULL) {
827  SSL_SESSION_list_remove(ctx, session);
828  }
829 
830  if (ctx->session_cache_head == NULL) {
831  ctx->session_cache_head = session;
832  ctx->session_cache_tail = session;
833  session->prev = (SSL_SESSION *)&(ctx->session_cache_head);
834  session->next = (SSL_SESSION *)&(ctx->session_cache_tail);
835  } else {
836  session->next = ctx->session_cache_head;
837  session->next->prev = session;
838  session->prev = (SSL_SESSION *)&(ctx->session_cache_head);
839  ctx->session_cache_head = session;
840  }
841 }
842 
843 static bool add_session_locked(SSL_CTX *ctx, UniquePtr<SSL_SESSION> session) {
844  SSL_SESSION *new_session = session.get();
845  SSL_SESSION *old_session;
846  if (!lh_SSL_SESSION_insert(ctx->sessions, &old_session, new_session)) {
847  return false;
848  }
849  // |ctx->sessions| took ownership of |new_session| and gave us back a
850  // reference to |old_session|. (|old_session| may be the same as
851  // |new_session|, in which case we traded identical references with
852  // |ctx->sessions|.)
853  session.release();
854  session.reset(old_session);
855 
856  if (old_session != nullptr) {
857  if (old_session == new_session) {
858  // |session| was already in the cache. There are no linked list pointers
859  // to update.
860  return false;
861  }
862 
863  // There was a session ID collision. |old_session| was replaced with
864  // |session| in the hash table, so |old_session| must be removed from the
865  // linked list to match.
866  SSL_SESSION_list_remove(ctx, old_session);
867  }
868 
869  // This does not increment the reference count. Although |session| is inserted
870  // into two structures (a doubly-linked list and the hash table), |ctx| only
871  // takes one reference.
872  SSL_SESSION_list_add(ctx, new_session);
873 
874  // Enforce any cache size limits.
875  if (SSL_CTX_sess_get_cache_size(ctx) > 0) {
876  while (lh_SSL_SESSION_num_items(ctx->sessions) >
878  if (!remove_session(ctx, ctx->session_cache_tail,
879  /*lock=*/false)) {
880  break;
881  }
882  }
883  }
884 
885  return true;
886 }
887 
888 void ssl_update_cache(SSL *ssl) {
889  SSL_CTX *ctx = ssl->session_ctx.get();
890  SSL_SESSION *session = ssl->s3->established_session.get();
892  if (!SSL_SESSION_is_resumable(session) ||
893  (ctx->session_cache_mode & mode) != mode) {
894  return;
895  }
896 
897  // Clients never use the internal session cache.
898  if (ssl->server &&
899  !(ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_STORE)) {
900  UniquePtr<SSL_SESSION> ref = UpRef(session);
901  bool remove_expired_sessions = false;
902  {
903  MutexWriteLock lock(&ctx->lock);
905 
906  if (!(ctx->session_cache_mode & SSL_SESS_CACHE_NO_AUTO_CLEAR)) {
907  // Automatically flush the internal session cache every 255 connections.
908  ctx->handshakes_since_cache_flush++;
909  if (ctx->handshakes_since_cache_flush >= 255) {
910  remove_expired_sessions = true;
911  ctx->handshakes_since_cache_flush = 0;
912  }
913  }
914  }
915 
916  if (remove_expired_sessions) {
917  // |SSL_CTX_flush_sessions| takes the lock we just released. We could
918  // merge the critical sections, but we'd then call user code under a
919  // lock, or compute |now| earlier, even when not flushing.
921  ssl_get_current_time(ssl, &now);
922  SSL_CTX_flush_sessions(ctx, now.tv_sec);
923  }
924  }
925 
926  if (ctx->new_session_cb != nullptr) {
927  UniquePtr<SSL_SESSION> ref = UpRef(session);
928  if (ctx->new_session_cb(ssl, ref.get())) {
929  // |new_session_cb|'s return value signals whether it took ownership.
930  ref.release();
931  }
932  }
933 }
934 
936 
937 using namespace bssl;
938 
940  : x509_method(method),
941  extended_master_secret(false),
942  peer_sha256_valid(false),
943  not_resumable(false),
944  ticket_age_add_valid(false),
945  is_server(false),
946  is_quic(false),
947  has_application_settings(false) {
948  CRYPTO_new_ex_data(&ex_data);
949  time = ::time(nullptr);
950 }
951 
954  x509_method->session_clear(this);
955 }
956 
958  return ssl_session_new(ctx->x509_method).release();
959 }
960 
962  CRYPTO_refcount_inc(&session->references);
963  return 1;
964 }
965 
967  if (session == NULL ||
969  return;
970  }
971 
972  session->~ssl_session_st();
973  OPENSSL_free(session);
974 }
975 
976 const uint8_t *SSL_SESSION_get_id(const SSL_SESSION *session,
977  unsigned *out_len) {
978  if (out_len != NULL) {
979  *out_len = session->session_id_length;
980  }
981  return session->session_id;
982 }
983 
984 int SSL_SESSION_set1_id(SSL_SESSION *session, const uint8_t *sid,
985  size_t sid_len) {
986  if (sid_len > SSL_MAX_SSL_SESSION_ID_LENGTH) {
988  return 0;
989  }
990 
991  // Use memmove in case someone passes in the output of |SSL_SESSION_get_id|.
992  OPENSSL_memmove(session->session_id, sid, sid_len);
993  session->session_id_length = sid_len;
994  return 1;
995 }
996 
998  return session->timeout;
999 }
1000 
1002  if (session == NULL) {
1003  // NULL should crash, but silently accept it here for compatibility.
1004  return 0;
1005  }
1006  return session->time;
1007 }
1008 
1010  return session->x509_peer;
1011 }
1012 
1015  return session->certs.get();
1016 }
1017 
1019  const uint8_t **out,
1020  size_t *out_len) {
1021  if (session->signed_cert_timestamp_list) {
1023  *out_len = CRYPTO_BUFFER_len(session->signed_cert_timestamp_list.get());
1024  } else {
1025  *out = nullptr;
1026  *out_len = 0;
1027  }
1028 }
1029 
1031  const uint8_t **out, size_t *out_len) {
1032  if (session->ocsp_response) {
1033  *out = CRYPTO_BUFFER_data(session->ocsp_response.get());
1034  *out_len = CRYPTO_BUFFER_len(session->ocsp_response.get());
1035  } else {
1036  *out = nullptr;
1037  *out_len = 0;
1038  }
1039 }
1040 
1042  size_t max_out) {
1043  // TODO(davidben): Fix secret_length's type and remove these casts.
1044  if (max_out == 0) {
1045  return (size_t)session->secret_length;
1046  }
1047  if (max_out > (size_t)session->secret_length) {
1048  max_out = (size_t)session->secret_length;
1049  }
1050  OPENSSL_memcpy(out, session->secret, max_out);
1051  return max_out;
1052 }
1053 
1055  if (session == NULL) {
1056  return 0;
1057  }
1058 
1059  session->time = time;
1060  return time;
1061 }
1062 
1064  if (session == NULL) {
1065  return 0;
1066  }
1067 
1068  session->timeout = timeout;
1069  session->auth_timeout = timeout;
1070  return 1;
1071 }
1072 
1074  unsigned *out_len) {
1075  if (out_len != NULL) {
1076  *out_len = session->sid_ctx_length;
1077  }
1078  return session->sid_ctx;
1079 }
1080 
1081 int SSL_SESSION_set1_id_context(SSL_SESSION *session, const uint8_t *sid_ctx,
1082  size_t sid_ctx_len) {
1083  if (sid_ctx_len > sizeof(session->sid_ctx)) {
1085  return 0;
1086  }
1087 
1088  static_assert(sizeof(session->sid_ctx) < 256, "sid_ctx_len does not fit");
1089  session->sid_ctx_length = (uint8_t)sid_ctx_len;
1090  OPENSSL_memcpy(session->sid_ctx, sid_ctx, sid_ctx_len);
1091 
1092  return 1;
1093 }
1094 
1096  return ssl_session_protocol_version(session) >= TLS1_3_VERSION;
1097 }
1098 
1100  return !session->not_resumable &&
1101  (session->session_id_length != 0 || !session->ticket.empty());
1102 }
1103 
1105  return !session->ticket.empty();
1106 }
1107 
1109  const uint8_t **out_ticket, size_t *out_len) {
1110  if (out_ticket != nullptr) {
1111  *out_ticket = session->ticket.data();
1112  }
1113  *out_len = session->ticket.size();
1114 }
1115 
1116 int SSL_SESSION_set_ticket(SSL_SESSION *session, const uint8_t *ticket,
1117  size_t ticket_len) {
1118  return session->ticket.CopyFrom(MakeConstSpan(ticket, ticket_len));
1119 }
1120 
1122  return session->ticket_lifetime_hint;
1123 }
1124 
1126  return session->cipher;
1127 }
1128 
1130  return session->peer_sha256_valid;
1131 }
1132 
1134  const uint8_t **out_ptr, size_t *out_len) {
1135  if (session->peer_sha256_valid) {
1136  *out_ptr = session->peer_sha256;
1137  *out_len = sizeof(session->peer_sha256);
1138  } else {
1139  *out_ptr = nullptr;
1140  *out_len = 0;
1141  }
1142 }
1143 
1145  return ssl_session_protocol_version(session) >= TLS1_3_VERSION &&
1146  session->ticket_max_early_data != 0;
1147 }
1148 
1150  if (!SSL_SESSION_early_data_capable(session)) {
1151  return UpRef(session).release();
1152  }
1153 
1154  bssl::UniquePtr<SSL_SESSION> copy =
1156  if (!copy) {
1157  return nullptr;
1158  }
1159 
1160  copy->ticket_max_early_data = 0;
1161  // Copied sessions are non-resumable until they're completely filled in.
1162  copy->not_resumable = session->not_resumable;
1163  assert(!SSL_SESSION_early_data_capable(copy.get()));
1164  return copy.release();
1165 }
1166 
1169 }
1170 
1172  // Once the handshake completes we return the established session. Otherwise
1173  // we return the intermediate session, either |session| (for resumption) or
1174  // |new_session| if doing a full handshake.
1175  if (!SSL_in_init(ssl)) {
1176  return ssl->s3->established_session.get();
1177  }
1178  SSL_HANDSHAKE *hs = ssl->s3->hs.get();
1179  if (hs->early_session) {
1180  return hs->early_session.get();
1181  }
1182  if (hs->new_session) {
1183  return hs->new_session.get();
1184  }
1185  return ssl->session.get();
1186 }
1187 
1190  if (ret != NULL) {
1192  }
1193  return ret;
1194 }
1195 
1196 int SSL_SESSION_get_ex_new_index(long argl, void *argp,
1197  CRYPTO_EX_unused *unused,
1198  CRYPTO_EX_dup *dup_unused,
1199  CRYPTO_EX_free *free_func) {
1200  int index;
1202  free_func)) {
1203  return -1;
1204  }
1205  return index;
1206 }
1207 
1208 int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx, void *arg) {
1209  return CRYPTO_set_ex_data(&session->ex_data, idx, arg);
1210 }
1211 
1212 void *SSL_SESSION_get_ex_data(const SSL_SESSION *session, int idx) {
1213  return CRYPTO_get_ex_data(&session->ex_data, idx);
1214 }
1215 
1217  UniquePtr<SSL_SESSION> owned_session = UpRef(session);
1218  MutexWriteLock lock(&ctx->lock);
1219  return add_session_locked(ctx, std::move(owned_session));
1220 }
1221 
1223  return remove_session(ctx, session, /*lock=*/true);
1224 }
1225 
1226 int SSL_set_session(SSL *ssl, SSL_SESSION *session) {
1227  // SSL_set_session may only be called before the handshake has started.
1228  if (ssl->s3->initial_handshake_complete ||
1229  ssl->s3->hs == NULL ||
1230  ssl->s3->hs->state != 0) {
1231  abort();
1232  }
1233 
1234  ssl_set_session(ssl, session);
1235  return 1;
1236 }
1237 
1239  if (ctx == NULL) {
1240  return 0;
1241  }
1242 
1243  // Historically, zero was treated as |SSL_DEFAULT_SESSION_TIMEOUT|.
1244  if (timeout == 0) {
1246  }
1247 
1248  uint32_t old_timeout = ctx->session_timeout;
1249  ctx->session_timeout = timeout;
1250  return old_timeout;
1251 }
1252 
1254  if (ctx == NULL) {
1255  return 0;
1256  }
1257 
1258  return ctx->session_timeout;
1259 }
1260 
1262  ctx->session_psk_dhe_timeout = timeout;
1263 }
1264 
1265 typedef struct timeout_param_st {
1268  LHASH_OF(SSL_SESSION) *cache;
1269 } TIMEOUT_PARAM;
1270 
1271 static void timeout_doall_arg(SSL_SESSION *session, void *void_param) {
1272  TIMEOUT_PARAM *param = reinterpret_cast<TIMEOUT_PARAM *>(void_param);
1273 
1274  if (param->time == 0 ||
1275  session->time + session->timeout < session->time ||
1276  param->time > (session->time + session->timeout)) {
1277  // TODO(davidben): This can probably just call |remove_session|.
1278  (void) lh_SSL_SESSION_delete(param->cache, session);
1279  SSL_SESSION_list_remove(param->ctx, session);
1280  // TODO(https://crbug.com/boringssl/251): Callbacks should not be called
1281  // under a lock.
1282  if (param->ctx->remove_session_cb != NULL) {
1283  param->ctx->remove_session_cb(param->ctx, session);
1284  }
1285  SSL_SESSION_free(session);
1286  }
1287 }
1288 
1290  TIMEOUT_PARAM tp;
1291 
1292  tp.ctx = ctx;
1293  tp.cache = ctx->sessions;
1294  if (tp.cache == NULL) {
1295  return;
1296  }
1297  tp.time = time;
1298  MutexWriteLock lock(&ctx->lock);
1299  lh_SSL_SESSION_doall_arg(tp.cache, timeout_doall_arg, &tp);
1300 }
1301 
1303  int (*cb)(SSL *ssl, SSL_SESSION *session)) {
1304  ctx->new_session_cb = cb;
1305 }
1306 
1308  return ctx->new_session_cb;
1309 }
1310 
1312  SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *session)) {
1313  ctx->remove_session_cb = cb;
1314 }
1315 
1317  SSL_SESSION *session) {
1318  return ctx->remove_session_cb;
1319 }
1320 
1322  SSL_SESSION *(*cb)(SSL *ssl, const uint8_t *id,
1323  int id_len, int *out_copy)) {
1324  ctx->get_session_cb = cb;
1325 }
1326 
1328  const uint8_t *id,
1329  int id_len,
1330  int *out_copy) {
1331  return ctx->get_session_cb;
1332 }
1333 
1335  SSL_CTX *ctx, void (*cb)(const SSL *ssl, int type, int value)) {
1336  ctx->info_callback = cb;
1337 }
1338 
1339 void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type,
1340  int value) {
1341  return ctx->info_callback;
1342 }
ssl_session_st::peer_signature_algorithm
uint16_t peer_signature_algorithm
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3803
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
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
CRYPTO_BUFFER_free
#define CRYPTO_BUFFER_free
Definition: boringssl_prefix_symbols.h:1116
ssl_encrypt_ticket
int ssl_encrypt_ticket(SSL_HANDSHAKE *hs, CBB *out, const SSL_SESSION *session)
Definition: ssl_session.cc:563
ssl_cipher_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:520
timeout_param_st
Definition: ssl_session.cc:1265
ssl_session_st::sid_ctx
uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3819
g_pending_session_magic
static const BSSL_NAMESPACE_BEGIN char g_pending_session_magic
Definition: ssl_session.cc:159
ssl_session_st::x509_method
const bssl::SSL_X509_METHOD * x509_method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3827
CBB_data
#define CBB_data
Definition: boringssl_prefix_symbols.h:1040
test_server.argp
argp
Definition: test_server.py:33
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
RAND_bytes
#define RAND_bytes
Definition: boringssl_prefix_symbols.h:2060
ssl_session_st::is_quic
bool is_quic
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3925
now
static double now(void)
Definition: test/core/fling/client.cc:130
SSL_SESSION_copy_without_early_data
SSL_SESSION * SSL_SESSION_copy_without_early_data(SSL_SESSION *session)
Definition: ssl_session.cc:1149
SSL_SESSION_DUP_ALL
#define SSL_SESSION_DUP_ALL
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3173
Span::size
size_t size() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:133
cbs_st
Definition: bytestring.h:39
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_set_session
void ssl_set_session(SSL *ssl, SSL_SESSION *session)
Definition: ssl_session.cc:788
ctx
Definition: benchmark-async.c:30
g_ex_data_class
static CRYPTO_EX_DATA_CLASS g_ex_data_class
Definition: ssl_session.cc:161
SSL_SESSION_INCLUDE_TICKET
#define SSL_SESSION_INCLUDE_TICKET
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3171
ssl_session_st::quic_early_data_context
bssl::Array< uint8_t > quic_early_data_context
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3933
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
env_md_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h:67
SSL_SESSION_get_ex_data
void * SSL_SESSION_get_ex_data(const SSL_SESSION *session, int idx)
Definition: ssl_session.cc:1212
ssl_session_st::next
SSL_SESSION * next
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3866
SSL_SESSION_get_timeout
uint32_t SSL_SESSION_get_timeout(const SSL_SESSION *session)
Definition: ssl_session.cc:997
ssl_ctx_st::ticket_key_current
bssl::UniquePtr< bssl::TicketKey > ticket_key_current
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3553
false
#define false
Definition: setup_once.h:323
uint16_t
unsigned short uint16_t
Definition: stdint-msvc2008.h:79
SSL_SESS_CACHE_NO_INTERNAL_STORE
#define SSL_SESS_CACHE_NO_INTERNAL_STORE
Definition: ssl.h:1955
SSL_HANDSHAKE::new_cipher
const SSL_CIPHER * new_cipher
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1933
SSL_SESSION_is_resumable
int SSL_SESSION_is_resumable(const SSL_SESSION *session)
Definition: ssl_session.cc:1099
CRYPTO_EX_DATA_CLASS
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:679
ssl_session_st::not_resumable
bool not_resumable
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3916
ssl_get_new_session
bool ssl_get_new_session(SSL_HANDSHAKE *hs)
Definition: ssl_session.cc:352
total
size_t total
Definition: cord_analysis.cc:59
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
internal.h
SSL_R_SSL_SESSION_ID_TOO_LONG
#define SSL_R_SSL_SESSION_ID_TOO_LONG
Definition: ssl.h:5557
SSL_SESS_CACHE_SERVER
#define SSL_SESS_CACHE_SERVER
Definition: ssl.h:1940
string.h
copy
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
Definition: message_compress.cc:145
SSL_SESSION_get_master_key
size_t SSL_SESSION_get_master_key(const SSL_SESSION *session, uint8_t *out, size_t max_out)
Definition: ssl_session.cc:1041
SSL_HANDSHAKE::ssl
SSL * ssl
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1726
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
SSL_X509_METHOD
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2510
SSL_CTX_remove_session
int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session)
Definition: ssl_session.cc:1222
ssl_session_get_digest
const EVP_MD * ssl_session_get_digest(const SSL_SESSION *session)
Definition: ssl_session.cc:347
CRYPTO_BUFFER_len
#define CRYPTO_BUFFER_len
Definition: boringssl_prefix_symbols.h:1118
SSL_CTX_set_timeout
uint32_t SSL_CTX_set_timeout(SSL_CTX *ctx, uint32_t timeout)
Definition: ssl_session.cc:1238
ssl_session_protocol_version
uint16_t ssl_session_protocol_version(const SSL_SESSION *session)
Definition: ssl_session.cc:335
SSL_SESS_CACHE_NO_AUTO_CLEAR
#define SSL_SESS_CACHE_NO_AUTO_CLEAR
Definition: ssl.h:1947
ssl_hs_ok
@ ssl_hs_ok
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1611
SSL_CTX_sess_get_new_cb
int(*)(SSL *ssl, SSL_SESSION *session) SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)
Definition: ssl_session.cc:1307
SSL_get1_session
SSL_SESSION * SSL_get1_session(SSL *ssl)
Definition: ssl_session.cc:1188
ssl_session_st::original_handshake_hash_len
uint8_t original_handshake_hash_len
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3883
CBS_len
#define CBS_len
Definition: boringssl_prefix_symbols.h:1089
SSL_CTX_set_session_psk_dhe_timeout
void SSL_CTX_set_session_psk_dhe_timeout(SSL_CTX *ctx, uint32_t timeout)
Definition: ssl_session.cc:1261
ssl_session_st::prev
SSL_SESSION * prev
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3866
SSL_CONFIG::cert
UniquePtr< CERT > cert
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2986
EVP_EncryptUpdate
#define EVP_EncryptUpdate
Definition: boringssl_prefix_symbols.h:1532
SSL_HANDSHAKE::early_session
UniquePtr< SSL_SESSION > early_session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1920
bssl
Definition: hpke_test.cc:37
SSL_SESSION_set1_id
int SSL_SESSION_set1_id(SSL_SESSION *session, const uint8_t *sid, size_t sid_len)
Definition: ssl_session.cc:984
SSL_SESSION_list_add
static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *session)
Definition: ssl_session.cc:825
mode
const char int mode
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
ctx
static struct test_ctx ctx
Definition: test-ipc-send-recv.c:65
crypto_buffer_st
Definition: third_party/boringssl-with-bazel/src/crypto/pool/internal.h:31
version
Definition: version.py:1
ssl_session_st::time
uint64_t time
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3858
timeout_doall_arg
static void timeout_doall_arg(SSL_SESSION *session, void *void_param)
Definition: ssl_session.cc:1271
ssl_ctx_st::ticket_key_cb
int(* ticket_key_cb)(SSL *ssl, uint8_t *name, uint8_t *iv, EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3557
SSL_HANDSHAKE::new_session
UniquePtr< SSL_SESSION > new_session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1916
ssl_get_current_time
void ssl_get_current_time(const SSL *ssl, struct OPENSSL_timeval *out_clock)
Definition: ssl_lib.cc:354
CRYPTO_BUFFER_up_ref
#define CRYPTO_BUFFER_up_ref
Definition: boringssl_prefix_symbols.h:1122
timeout_param_st::ctx
SSL_CTX * ctx
Definition: ssl_session.cc:1266
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
EVP_CIPHER_CTX_iv_length
#define EVP_CIPHER_CTX_iv_length
Definition: boringssl_prefix_symbols.h:1473
ssl_ctx_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3404
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_session_st::secret_length
int secret_length
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3809
ssl_st::mode
uint32_t mode
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3764
ssl_session_st::early_alpn
bssl::Array< uint8_t > early_alpn
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3897
ssl_st::quic_method
const SSL_QUIC_METHOD * quic_method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3769
SSL_SESSION_get0_ticket
void SSL_SESSION_get0_ticket(const SSL_SESSION *session, const uint8_t **out_ticket, size_t *out_len)
Definition: ssl_session.cc:1108
ssl_session_is_time_valid
int ssl_session_is_time_valid(const SSL *ssl, const SSL_SESSION *session)
Definition: ssl_session.cc:594
ssl_st::session
bssl::UniquePtr< SSL_SESSION > session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3750
SSL_CTX_get_info_callback
void(*)(const SSL *ssl, int type, int value) SSL_CTX_get_info_callback(SSL_CTX *ctx)
Definition: ssl_session.cc:1339
ssl_session_st::references
CRYPTO_refcount_t references
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3792
ssl_session_st::verify_result
long verify_result
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3846
tlsext_tick_md
#define tlsext_tick_md
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3329
SSL_CTX_flush_sessions
void SSL_CTX_flush_sessions(SSL_CTX *ctx, uint64_t time)
Definition: ssl_session.cc:1289
SSL_SESSION_new
SSL_SESSION * SSL_SESSION_new(const SSL_CTX *ctx)
Definition: ssl_session.cc:957
ssl_session_is_resumable
int ssl_session_is_resumable(const SSL_HANDSHAKE *hs, const SSL_SESSION *session)
Definition: ssl_session.cc:610
SSL_CTX_sess_set_get_cb
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, const uint8_t *id, int id_len, int *out_copy))
Definition: ssl_session.cc:1321
CBB_reserve
#define CBB_reserve
Definition: boringssl_prefix_symbols.h:1050
hash
uint64_t hash
Definition: ring_hash.cc:284
CRYPTO_free_ex_data
#define CRYPTO_free_ex_data
Definition: boringssl_prefix_symbols.h:1151
SSL_SESSION_free
void SSL_SESSION_free(SSL_SESSION *session)
Definition: ssl_session.cc:966
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
SSL_SESSION_set_timeout
uint32_t SSL_SESSION_set_timeout(SSL_SESSION *session, uint32_t timeout)
Definition: ssl_session.cc:1063
SSL_SESSION_early_data_capable
int SSL_SESSION_early_data_capable(const SSL_SESSION *session)
Definition: ssl_session.cc:1144
ssl_protocol_version_from_wire
bool ssl_protocol_version_from_wire(uint16_t *out, uint16_t version)
Definition: ssl_versions.cc:28
ssl_session_st::group_id
uint16_t group_id
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3799
CBB_did_write
#define CBB_did_write
Definition: boringssl_prefix_symbols.h:1041
SSL_SESSION_get0_peer_certificates
#define SSL_SESSION_get0_peer_certificates
Definition: boringssl_prefix_symbols.h:247
SSL_SESSION_set_ticket
int SSL_SESSION_set_ticket(SSL_SESSION *session, const uint8_t *ticket, size_t ticket_len)
Definition: ssl_session.cc:1116
ssl_session_st::ssl_version
uint16_t ssl_version
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3795
SSL_CTX_sess_get_get_cb
SSL_SESSION *(*)(SSL *ssl, const uint8_t *id, int id_len, int *out_copy) SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)
Definition: ssl_session.cc:1327
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
SSL_get_session
SSL_SESSION * SSL_get_session(const SSL *ssl)
Definition: ssl_session.cc:1171
xds_interop_client.int
int
Definition: xds_interop_client.py:113
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
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
gen_stats_data.found
bool found
Definition: gen_stats_data.py:61
ssl_session_st::peer_sha256_valid
bool peer_sha256_valid
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3913
Span::empty
bool empty() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:134
SSL_SESSION_get0_peer_sha256
void SSL_SESSION_get0_peer_sha256(const SSL_SESSION *session, const uint8_t **out_ptr, size_t *out_len)
Definition: ssl_session.cc:1133
ssl_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3698
ssl_early_callback_ctx
Definition: ssl.h:4186
ssl_session_st::timeout
uint32_t timeout
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3850
ssl_hs_wait_t
ssl_hs_wait_t
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1609
ssl_lookup_session
static enum ssl_hs_wait_t ssl_lookup_session(SSL_HANDSHAKE *hs, UniquePtr< SSL_SESSION > *out_session, Span< const uint8_t > session_id)
Definition: ssl_session.cc:642
key_id
const CBS size_t uint32_t key_id
Definition: third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h:107
OPENSSL_timeval
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2873
ssl_client_hello_get_extension
bool ssl_client_hello_get_extension(const SSL_CLIENT_HELLO *client_hello, CBS *out, uint16_t extension_type)
Definition: extensions.cc:283
ssl_session_renew_timeout
void ssl_session_renew_timeout(SSL *ssl, SSL_SESSION *session, uint32_t timeout)
Definition: ssl_session.cc:319
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
SSL_SESSION_get0_signed_cert_timestamp_list
void SSL_SESSION_get0_signed_cert_timestamp_list(const SSL_SESSION *session, const uint8_t **out, size_t *out_len)
Definition: ssl_session.cc:1018
add_session_locked
static bool add_session_locked(SSL_CTX *ctx, UniquePtr< SSL_SESSION > session)
Definition: ssl_session.cc:843
OPENSSL_memcpy
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:819
BSSL_NAMESPACE_END
#define BSSL_NAMESPACE_END
Definition: base.h:480
SSL_CTX_sess_set_new_cb
void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int(*cb)(SSL *ssl, SSL_SESSION *session))
Definition: ssl_session.cc:1302
SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
Definition: ssl.h:5483
SSL_SESSION_set1_id_context
int SSL_SESSION_set1_id_context(SSL_SESSION *session, const uint8_t *sid_ctx, size_t sid_ctx_len)
Definition: ssl_session.cc:1081
SSL_CTX_sess_get_remove_cb
void(*)(SSL_CTX *ctx, SSL_SESSION *session) SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)
Definition: ssl_session.cc:1316
err.h
SSL_SESSION_get0_cipher
const SSL_CIPHER * SSL_SESSION_get0_cipher(const SSL_SESSION *session)
Definition: ssl_session.cc:1125
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
arg
Definition: cmdline.cc:40
ref
unsigned ref
Definition: cxa_demangle.cpp:4909
CRYPTO_EX_unused
int CRYPTO_EX_unused
Definition: ex_data.h:192
ssl_session_st::peer_sha256
uint8_t peer_sha256[SHA256_DIGEST_LENGTH]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3877
TIMEOUT_PARAM
struct timeout_param_st TIMEOUT_PARAM
CRYPTO_new_ex_data
#define CRYPTO_new_ex_data
Definition: boringssl_prefix_symbols.h:1179
lhash.h
SSL_SESSION_get0_id_context
const uint8_t * SSL_SESSION_get0_id_context(const SSL_SESSION *session, unsigned *out_len)
Definition: ssl_session.cc:1073
HMAC_Init_ex
#define HMAC_Init_ex
Definition: boringssl_prefix_symbols.h:1793
SSL_DEFAULT_TICKET_KEY_ROTATION_INTERVAL
#define SSL_DEFAULT_TICKET_KEY_ROTATION_INTERVAL
Definition: ssl.h:2175
ssl_session_st::cipher
const SSL_CIPHER * cipher
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3860
SSL_is_server
#define SSL_is_server
Definition: boringssl_prefix_symbols.h:404
ssl_session_st::ticket_max_early_data
uint32_t ticket_max_early_data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3891
SSL_SESSION_get_ticket_lifetime_hint
uint32_t SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session)
Definition: ssl_session.cc:1121
SSL_DEFAULT_SESSION_TIMEOUT
#define SSL_DEFAULT_SESSION_TIMEOUT
Definition: ssl.h:1984
ssl_hs_pending_ticket
@ ssl_hs_pending_ticket
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1621
SSL_CTX_get_timeout
uint32_t SSL_CTX_get_timeout(const SSL_CTX *ctx)
Definition: ssl_session.cc:1253
ssl_session_rebase_time
void ssl_session_rebase_time(SSL *ssl, SSL_SESSION *session)
Definition: ssl_session.cc:290
tests.google.protobuf.internal.message_test.cmp
cmp
Definition: bloaty/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py:61
SSL_SESSION_should_be_single_use
int SSL_SESSION_should_be_single_use(const SSL_SESSION *session)
Definition: ssl_session.cc:1095
SSL_SESSION_has_ticket
int SSL_SESSION_has_ticket(const SSL_SESSION *session)
Definition: ssl_session.cc:1104
SSL_SESS_CACHE_CLIENT
#define SSL_SESS_CACHE_CLIENT
Definition: ssl.h:1937
SSL_SESS_CACHE_NO_INTERNAL_LOOKUP
#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP
Definition: ssl.h:1951
Span< const uint8_t >
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_SESSION_set_ex_data
int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx, void *arg)
Definition: ssl_session.cc:1208
X509_V_ERR_INVALID_CALL
#define X509_V_ERR_INVALID_CALL
Definition: x509.h:1994
EVP_EncryptInit_ex
#define EVP_EncryptInit_ex
Definition: boringssl_prefix_symbols.h:1531
SSL_SESSION_to_bytes_for_ticket
#define SSL_SESSION_to_bytes_for_ticket
Definition: boringssl_prefix_symbols.h:273
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
ERR_R_OVERFLOW
#define ERR_R_OVERFLOW
Definition: err.h:375
ssl_session_st::ticket
bssl::Array< uint8_t > ticket
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3868
ssl_ticket_aead_success
ssl_ticket_aead_success
Definition: ssl.h:2226
SSL_SESSION_up_ref
int SSL_SESSION_up_ref(SSL_SESSION *session)
Definition: ssl_session.cc:961
ssl.h
ssl_early_callback_ctx::session_id
const uint8_t * session_id
Definition: ssl.h:4193
SSL_R_SESSION_MAY_NOT_BE_CREATED
#define SSL_R_SESSION_MAY_NOT_BE_CREATED
Definition: ssl.h:5476
ssl_process_ticket
enum ssl_ticket_aead_result_t ssl_process_ticket(SSL_HANDSHAKE *hs, UniquePtr< SSL_SESSION > *out_session, bool *out_renew_ticket, Span< const uint8_t > ticket, Span< const uint8_t > session_id)
Definition: extensions.cc:3952
ssl_session_st::is_server
bool is_server
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3922
ssl_session_st::x509_peer
X509 * x509_peer
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3830
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
value
const char * value
Definition: hpack_parser_table.cc:165
CRYPTO_get_ex_data
#define CRYPTO_get_ex_data
Definition: boringssl_prefix_symbols.h:1164
ssl_session_st::has_application_settings
bool has_application_settings
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3929
SSL_CONFIG::retain_only_sha256_of_client_certs
bool retain_only_sha256_of_client_certs
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3069
TLS1_3_VERSION
#define TLS1_3_VERSION
Definition: ssl.h:653
ssl_session_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3787
SSL_CTX_add_session
int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session)
Definition: ssl_session.cc:1216
ssl_early_callback_ctx::session_id_len
size_t session_id_len
Definition: ssl.h:4194
CBB_add_bytes
#define CBB_add_bytes
Definition: boringssl_prefix_symbols.h:1025
SSL_R_TICKET_ENCRYPTION_FAILED
#define SSL_R_TICKET_ENCRYPTION_FAILED
Definition: ssl.h:5543
sk_CRYPTO_BUFFER_deep_copy
#define sk_CRYPTO_BUFFER_deep_copy
Definition: boringssl_prefix_symbols.h:556
BSSL_NAMESPACE_BEGIN
Definition: trust_token_test.cc:45
ssl_st::s3
bssl::SSL3_STATE * s3
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3730
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_in_init
#define SSL_in_init
Definition: boringssl_prefix_symbols.h:401
ssl_session_st::ticket_lifetime_hint
uint32_t ticket_lifetime_hint
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3885
SSL_HANDSHAKE::config
SSL_CONFIG * config
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1729
x509_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:139
OPENSSL_strdup
#define OPENSSL_strdup
Definition: boringssl_prefix_symbols.h:1891
ssl_session_st::extended_master_secret
bool extended_master_secret
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3910
EVP_EncryptFinal_ex
#define EVP_EncryptFinal_ex
Definition: boringssl_prefix_symbols.h:1529
SSL_magic_pending_session_ptr
SSL_SESSION * SSL_magic_pending_session_ptr(void)
Definition: ssl_session.cc:1167
SSL_SESSION_get_time
uint64_t SSL_SESSION_get_time(const SSL_SESSION *session)
Definition: ssl_session.cc:1001
ssl_get_prev_session
enum ssl_hs_wait_t ssl_get_prev_session(SSL_HANDSHAKE *hs, UniquePtr< SSL_SESSION > *out_session, bool *out_tickets_supported, bool *out_renew_ticket, const SSL_CLIENT_HELLO *client_hello)
Definition: ssl_session.cc:710
HMAC_Final
#define HMAC_Final
Definition: boringssl_prefix_symbols.h:1791
ssl_ctx_rotate_ticket_encryption_key
int ssl_ctx_rotate_ticket_encryption_key(SSL_CTX *ctx)
Definition: ssl_session.cc:403
ssl_session_st::local_application_settings
bssl::Array< uint8_t > local_application_settings
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3901
ssl_session_is_context_valid
int ssl_session_is_context_valid(const SSL_HANDSHAKE *hs, const SSL_SESSION *session)
Definition: ssl_session.cc:583
STACK_OF
const STACK_OF(CRYPTO_BUFFER) *SSL_SESSION_get0_peer_certificates(const SSL_SESSION *session)
Definition: ssl_session.cc:1013
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
ssl_session_st::sid_ctx_length
uint8_t sid_ctx_length
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3818
SHA256_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH
Definition: sha.h:155
SSL_MODE_NO_SESSION_CREATION
#define SSL_MODE_NO_SESSION_CREATION
Definition: ssl.h:798
SSL_SESSION_get_ex_new_index
int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused, CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func)
Definition: ssl_session.cc:1196
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
CRYPTO_MUTEX_lock_write
#define CRYPTO_MUTEX_lock_write
Definition: boringssl_prefix_symbols.h:1126
ssl_session_st::ticket_age_add
uint32_t ticket_age_add
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3887
EVP_MAX_MD_SIZE
#define EVP_MAX_MD_SIZE
Definition: digest.h:156
EVP_MAX_IV_LENGTH
#define EVP_MAX_IV_LENGTH
Definition: cipher.h:533
remove_session
static bool remove_session(SSL_CTX *ctx, SSL_SESSION *session, bool lock)
Definition: ssl_session.cc:756
OPENSSL_memmove
static void * OPENSSL_memmove(void *dst, const void *src, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:827
SSL_set_session
int SSL_set_session(SSL *ssl, SSL_SESSION *session)
Definition: ssl_session.cc:1226
ssl_ticket_aead_ignore_ticket
ssl_ticket_aead_ignore_ticket
Definition: ssl.h:2233
ssl_ticket_aead_retry
ssl_ticket_aead_retry
Definition: ssl.h:2230
ssl_encrypt_ticket_with_method
static int ssl_encrypt_ticket_with_method(SSL_HANDSHAKE *hs, CBB *out, const uint8_t *session_buf, size_t session_len)
Definition: ssl_session.cc:532
TLSEXT_TYPE_session_ticket
#define TLSEXT_TYPE_session_ticket
Definition: tls1.h:226
SSL_get_options
#define SSL_get_options
Definition: boringssl_prefix_symbols.h:354
ssl_encrypt_ticket_with_cipher_ctx
static int ssl_encrypt_ticket_with_cipher_ctx(SSL_HANDSHAKE *hs, CBB *out, const uint8_t *session_buf, size_t session_len)
Definition: ssl_session.cc:453
ssl_hs_pending_session
@ ssl_hs_pending_session
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1620
timeout_param_st::time
uint64_t time
Definition: ssl_session.cc:1267
SSL_MAX_SSL_SESSION_ID_LENGTH
#define SSL_MAX_SSL_SESSION_ID_LENGTH
Definition: ssl.h:1728
ssl_session_st::auth_timeout
uint32_t auth_timeout
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3854
SSL_SESSION_dup
UniquePtr< SSL_SESSION > SSL_SESSION_dup(SSL_SESSION *session, int dup_flags)
Definition: ssl_session.cc:191
ssl_session_st::ocsp_response
bssl::UniquePtr< CRYPTO_BUFFER > ocsp_response
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3873
SSL_SESSION_get0_peer
X509 * SSL_SESSION_get0_peer(const SSL_SESSION *session)
Definition: ssl_session.cc:1009
SSL_SESSION_list_remove
static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *session)
Definition: ssl_session.cc:797
ssl_update_cache
void ssl_update_cache(SSL *ssl)
Definition: ssl_session.cc:888
ssl_hash_session_id
uint32_t ssl_hash_session_id(Span< const uint8_t > session_id)
Definition: ssl_session.cc:171
ssl_session_new
UniquePtr< SSL_SESSION > ssl_session_new(const SSL_X509_METHOD *x509_method)
Definition: ssl_session.cc:167
CRYPTO_refcount_inc
#define CRYPTO_refcount_inc
Definition: boringssl_prefix_symbols.h:1191
SSL_CTX_sess_get_cache_size
#define SSL_CTX_sess_get_cache_size
Definition: boringssl_prefix_symbols.h:125
Span::data
T * data() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:132
CBB_len
#define CBB_len
Definition: boringssl_prefix_symbols.h:1049
mem.h
ssl_session_st::ex_data
CRYPTO_EX_DATA ex_data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3862
ssl_ctx_st::lock
CRYPTO_MUTEX lock
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3413
ssl_st::session_ctx
bssl::UniquePtr< SSL_CTX > session_ctx
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3758
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
EVP_MAX_BLOCK_LENGTH
#define EVP_MAX_BLOCK_LENGTH
Definition: cipher.h:534
SSL_DEFAULT_SESSION_AUTH_TIMEOUT
#define SSL_DEFAULT_SESSION_AUTH_TIMEOUT
Definition: ssl.h:1994
ssl_session_st::ssl_session_st
ssl_session_st(const bssl::SSL_X509_METHOD *method)
CRYPTO_set_ex_data
#define CRYPTO_set_ex_data
Definition: boringssl_prefix_symbols.h:1196
ssl_hs_error
@ ssl_hs_error
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1610
ssl_ctx_st::remove_session_cb
void(* remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *sess)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3465
method
NSString * method
Definition: ProtoMethod.h:28
EVP_aes_128_cbc
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_cbc(void)
ssl_ticket_aead_method_st
Definition: ssl.h:2241
SSL_SESSION_INCLUDE_NONAUTH
#define SSL_SESSION_INCLUDE_NONAUTH
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3172
SSL_SESSION_get_id
const uint8_t * SSL_SESSION_get_id(const SSL_SESSION *session, unsigned *out_len)
Definition: ssl_session.cc:976
SSL_OP_NO_TICKET
#define SSL_OP_NO_TICKET
Definition: ssl.h:709
ssl_session_st::original_handshake_hash
uint8_t original_handshake_hash[EVP_MAX_MD_SIZE]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3882
ssl_st::version
uint16_t version
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3715
ssl_session_st::certs
bssl::UniquePtr< STACK_OF(CRYPTO_BUFFER)> certs
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3825
OPENSSL_free
#define OPENSSL_free
Definition: boringssl_prefix_symbols.h:1869
SSL_SESSION_has_peer_sha256
int SSL_SESSION_has_peer_sha256(const SSL_SESSION *session)
Definition: ssl_session.cc:1129
ssl_st::ctx
bssl::UniquePtr< SSL_CTX > ctx
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3754
HMAC_Update
#define HMAC_Update
Definition: boringssl_prefix_symbols.h:1794
timeout_param_st::LHASH_OF
LHASH_OF(SSL_SESSION) *cache
CRYPTO_MUTEX_unlock_write
#define CRYPTO_MUTEX_unlock_write
Definition: boringssl_prefix_symbols.h:1128
ssl_ticket_aead_error
ssl_ticket_aead_error
Definition: ssl.h:2236
sk_CRYPTO_BUFFER_num
#define sk_CRYPTO_BUFFER_num
Definition: boringssl_prefix_symbols.h:558
ssl_session_st::secret
uint8_t secret[SSL_MAX_MASTER_KEY_LENGTH]
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3810
ssl_session_st::~ssl_session_st
~ssl_session_st()
Definition: ssl_session.cc:952
timeout
uv_timer_t timeout
Definition: libuv/docs/code/uvwget/main.c:9
SSL_SESSION_get0_ocsp_response
void SSL_SESSION_get0_ocsp_response(const SSL_SESSION *session, const uint8_t **out, size_t *out_len)
Definition: ssl_session.cc:1030
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
hmac.h
CRYPTO_BUFFER_data
#define CRYPTO_BUFFER_data
Definition: boringssl_prefix_symbols.h:1115
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_SESSION_set_time
uint64_t SSL_SESSION_set_time(SSL_SESSION *session, uint64_t time)
Definition: ssl_session.cc:1054
SSL_CTX_sess_set_remove_cb
void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void(*cb)(SSL_CTX *ctx, SSL_SESSION *session))
Definition: ssl_session.cc:1311
ssl_get_handshake_digest
const EVP_MD * ssl_get_handshake_digest(uint16_t version, const SSL_CIPHER *cipher)
Definition: ssl_cipher.cc:637
CRYPTO_refcount_dec_and_test_zero
#define CRYPTO_refcount_dec_and_test_zero
Definition: boringssl_prefix_symbols.h:1190
SSL_CTX_set_info_callback
void SSL_CTX_set_info_callback(SSL_CTX *ctx, void(*cb)(const SSL *ssl, int type, int value))
Definition: ssl_session.cc:1334
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


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