ssl_x509.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 
145 #include <openssl/asn1.h>
146 #include <openssl/bytestring.h>
147 #include <openssl/err.h>
148 #include <openssl/pem.h>
149 #include <openssl/stack.h>
150 #include <openssl/x509.h>
151 #include <openssl/x509v3.h>
152 
153 #include "internal.h"
154 #include "../crypto/internal.h"
155 
156 
158 
159 // check_ssl_x509_method asserts that |ssl| has the X509-based method
160 // installed. Calling an X509-based method on an |ssl| with a different method
161 // will likely misbehave and possibly crash or leak memory.
162 static void check_ssl_x509_method(const SSL *ssl) {
163  assert(ssl == NULL || ssl->ctx->x509_method == &ssl_crypto_x509_method);
164 }
165 
166 // check_ssl_ctx_x509_method acts like |check_ssl_x509_method|, but for an
167 // |SSL_CTX|.
168 static void check_ssl_ctx_x509_method(const SSL_CTX *ctx) {
169  assert(ctx == NULL || ctx->x509_method == &ssl_crypto_x509_method);
170 }
171 
172 // x509_to_buffer returns a |CRYPTO_BUFFER| that contains the serialised
173 // contents of |x509|.
174 static UniquePtr<CRYPTO_BUFFER> x509_to_buffer(X509 *x509) {
175  uint8_t *buf = NULL;
176  int cert_len = i2d_X509(x509, &buf);
177  if (cert_len <= 0) {
178  return 0;
179  }
180 
181  UniquePtr<CRYPTO_BUFFER> buffer(CRYPTO_BUFFER_new(buf, cert_len, NULL));
182  OPENSSL_free(buf);
183 
184  return buffer;
185 }
186 
187 // new_leafless_chain returns a fresh stack of buffers set to {NULL}.
190  if (!chain ||
191  !sk_CRYPTO_BUFFER_push(chain.get(), nullptr)) {
192  return nullptr;
193  }
194 
195  return chain;
196 }
197 
198 // ssl_cert_set_chain sets elements 1.. of |cert->chain| to the serialised
199 // forms of elements of |chain|. It returns one on success or zero on error, in
200 // which case no change to |cert->chain| is made. It preverses the existing
201 // leaf from |cert->chain|, if any.
202 static bool ssl_cert_set_chain(CERT *cert, STACK_OF(X509) *chain) {
203  UniquePtr<STACK_OF(CRYPTO_BUFFER)> new_chain;
204 
205  if (cert->chain != nullptr) {
206  new_chain.reset(sk_CRYPTO_BUFFER_new_null());
207  if (!new_chain) {
208  return false;
209  }
210 
211  // |leaf| might be NULL if it's a “leafless” chain.
212  CRYPTO_BUFFER *leaf = sk_CRYPTO_BUFFER_value(cert->chain.get(), 0);
213  if (!PushToStack(new_chain.get(), UpRef(leaf))) {
214  return false;
215  }
216  }
217 
218  for (X509 *x509 : chain) {
219  if (!new_chain) {
220  new_chain = new_leafless_chain();
221  if (!new_chain) {
222  return false;
223  }
224  }
225 
226  UniquePtr<CRYPTO_BUFFER> buffer = x509_to_buffer(x509);
227  if (!buffer ||
228  !PushToStack(new_chain.get(), std::move(buffer))) {
229  return false;
230  }
231  }
232 
233  cert->chain = std::move(new_chain);
234  return true;
235 }
236 
238  X509_free(cert->x509_leaf);
239  cert->x509_leaf = nullptr;
240 }
241 
243  sk_X509_pop_free(cert->x509_chain, X509_free);
244  cert->x509_chain = nullptr;
245 }
246 
249  for (const CRYPTO_BUFFER *buffer : names) {
251  UniquePtr<X509_NAME> name(
253  if (name == nullptr ||
255  return false;
256  }
257  }
258 
259  return true;
260 }
261 
262 static void ssl_crypto_x509_cert_clear(CERT *cert) {
265 
266  X509_free(cert->x509_stash);
267  cert->x509_stash = nullptr;
268 }
269 
270 static void ssl_crypto_x509_cert_free(CERT *cert) {
273 }
274 
275 static void ssl_crypto_x509_cert_dup(CERT *new_cert, const CERT *cert) {
276  if (cert->verify_store != nullptr) {
278  new_cert->verify_store = cert->verify_store;
279  }
280 }
281 
283  bssl::UniquePtr<STACK_OF(X509)> chain, chain_without_leaf;
284  if (sk_CRYPTO_BUFFER_num(sess->certs.get()) > 0) {
285  chain.reset(sk_X509_new_null());
286  if (!chain) {
288  return false;
289  }
290  if (sess->is_server) {
291  // chain_without_leaf is only needed for server sessions. See
292  // |SSL_get_peer_cert_chain|.
293  chain_without_leaf.reset(sk_X509_new_null());
294  if (!chain_without_leaf) {
296  return false;
297  }
298  }
299  }
300 
301  bssl::UniquePtr<X509> leaf;
302  for (CRYPTO_BUFFER *cert : sess->certs.get()) {
303  UniquePtr<X509> x509(X509_parse_from_buffer(cert));
304  if (!x509) {
306  return false;
307  }
308  if (leaf == nullptr) {
309  leaf = UpRef(x509);
310  } else if (chain_without_leaf &&
311  !PushToStack(chain_without_leaf.get(), UpRef(x509))) {
313  return false;
314  }
315  if (!PushToStack(chain.get(), std::move(x509))) {
317  return false;
318  }
319  }
320 
321  sk_X509_pop_free(sess->x509_chain, X509_free);
322  sess->x509_chain = chain.release();
323 
324  sk_X509_pop_free(sess->x509_chain_without_leaf, X509_free);
325  sess->x509_chain_without_leaf = chain_without_leaf.release();
326 
327  X509_free(sess->x509_peer);
328  sess->x509_peer = leaf.release();
329  return true;
330 }
331 
332 static bool ssl_crypto_x509_session_dup(SSL_SESSION *new_session,
333  const SSL_SESSION *session) {
334  new_session->x509_peer = UpRef(session->x509_peer).release();
335  if (session->x509_chain != nullptr) {
336  new_session->x509_chain = X509_chain_up_ref(session->x509_chain);
337  if (new_session->x509_chain == nullptr) {
338  return false;
339  }
340  }
341  if (session->x509_chain_without_leaf != nullptr) {
342  new_session->x509_chain_without_leaf =
343  X509_chain_up_ref(session->x509_chain_without_leaf);
344  if (new_session->x509_chain_without_leaf == nullptr) {
345  return false;
346  }
347  }
348 
349  return true;
350 }
351 
353  X509_free(session->x509_peer);
354  session->x509_peer = nullptr;
355  sk_X509_pop_free(session->x509_chain, X509_free);
356  session->x509_chain = nullptr;
357  sk_X509_pop_free(session->x509_chain_without_leaf, X509_free);
358  session->x509_chain_without_leaf = nullptr;
359 }
360 
362  SSL_HANDSHAKE *hs,
363  uint8_t *out_alert) {
364  *out_alert = SSL_AD_INTERNAL_ERROR;
365  STACK_OF(X509) *const cert_chain = session->x509_chain;
366  if (cert_chain == nullptr || sk_X509_num(cert_chain) == 0) {
367  return false;
368  }
369 
370  SSL *const ssl = hs->ssl;
371  SSL_CTX *ssl_ctx = ssl->ctx.get();
372  X509_STORE *verify_store = ssl_ctx->cert_store;
373  if (hs->config->cert->verify_store != nullptr) {
374  verify_store = hs->config->cert->verify_store;
375  }
376 
377  X509 *leaf = sk_X509_value(cert_chain, 0);
378  const char *name;
379  size_t name_len;
380  SSL_get0_ech_name_override(ssl, &name, &name_len);
381  UniquePtr<X509_STORE_CTX> ctx(X509_STORE_CTX_new());
382  if (!ctx ||
383  !X509_STORE_CTX_init(ctx.get(), verify_store, leaf, cert_chain) ||
386  // We need to inherit the verify parameters. These can be determined by
387  // the context: if its a server it will verify SSL client certificates or
388  // vice versa.
390  ssl->server ? "ssl_client" : "ssl_server") ||
391  // Anything non-default in "param" should overwrite anything in the ctx.
393  hs->config->param) ||
394  // ClientHelloOuter connections use a different name.
395  (name_len != 0 &&
397  name_len))) {
399  return false;
400  }
401 
402  if (hs->config->verify_callback) {
404  }
405 
406  int verify_ret;
407  if (ssl_ctx->app_verify_callback != nullptr) {
408  verify_ret =
409  ssl_ctx->app_verify_callback(ctx.get(), ssl_ctx->app_verify_arg);
410  } else {
411  verify_ret = X509_verify_cert(ctx.get());
412  }
413 
414  session->verify_result = X509_STORE_CTX_get_error(ctx.get());
415 
416  // If |SSL_VERIFY_NONE|, the error is non-fatal, but we keep the result.
417  if (verify_ret <= 0 && hs->config->verify_mode != SSL_VERIFY_NONE) {
418  *out_alert = SSL_alert_from_verify_result(session->verify_result);
419  return false;
420  }
421 
422  ERR_clear_error();
423  return true;
424 }
425 
427  sk_X509_NAME_pop_free(hs->cached_x509_ca_names, X509_NAME_free);
428  hs->cached_x509_ca_names = nullptr;
429 }
430 
433  if (hs->config->param == nullptr) {
434  return false;
435  }
436  X509_VERIFY_PARAM_inherit(hs->config->param, hs->ssl->ctx->param);
437  return true;
438 }
439 
441  sk_X509_NAME_pop_free(cfg->cached_x509_client_CA, X509_NAME_free);
442  cfg->cached_x509_client_CA = nullptr;
443 }
444 
446  sk_X509_NAME_pop_free(cfg->cached_x509_client_CA, X509_NAME_free);
447  cfg->cached_x509_client_CA = nullptr;
449 }
450 
452  // Only build a chain if there are no intermediates configured and the feature
453  // isn't disabled.
454  if ((hs->ssl->mode & SSL_MODE_NO_AUTO_CHAIN) ||
455  !ssl_has_certificate(hs) || hs->config->cert->chain == NULL ||
456  sk_CRYPTO_BUFFER_num(hs->config->cert->chain.get()) > 1) {
457  return true;
458  }
459 
460  UniquePtr<X509> leaf(X509_parse_from_buffer(
461  sk_CRYPTO_BUFFER_value(hs->config->cert->chain.get(), 0)));
462  if (!leaf) {
464  return false;
465  }
466 
467  UniquePtr<X509_STORE_CTX> ctx(X509_STORE_CTX_new());
468  if (!ctx || !X509_STORE_CTX_init(ctx.get(), hs->ssl->ctx->cert_store,
469  leaf.get(), nullptr)) {
471  return false;
472  }
473 
474  // Attempt to build a chain, ignoring the result.
475  X509_verify_cert(ctx.get());
476  ERR_clear_error();
477 
478  // Remove the leaf from the generated chain.
480  if (!chain) {
481  return false;
482  }
483  X509_free(sk_X509_shift(chain.get()));
484 
485  if (!ssl_cert_set_chain(hs->config->cert.get(), chain.get())) {
486  return false;
487  }
488 
490 
491  return true;
492 }
493 
495  sk_X509_NAME_pop_free(ctx->cached_x509_client_CA, X509_NAME_free);
496  ctx->cached_x509_client_CA = nullptr;
497 }
498 
500  ctx->cert_store = X509_STORE_new();
501  ctx->param = X509_VERIFY_PARAM_new();
502  return (ctx->cert_store != nullptr && ctx->param != nullptr);
503 }
504 
507  X509_VERIFY_PARAM_free(ctx->param);
508  X509_STORE_free(ctx->cert_store);
509 }
510 
530 };
531 
533 
534 using namespace bssl;
535 
538  if (ssl == NULL) {
539  return NULL;
540  }
541  SSL_SESSION *session = SSL_get_session(ssl);
542  if (session == NULL || session->x509_peer == NULL) {
543  return NULL;
544  }
545  X509_up_ref(session->x509_peer);
546  return session->x509_peer;
547 }
548 
551  if (ssl == nullptr) {
552  return nullptr;
553  }
554  SSL_SESSION *session = SSL_get_session(ssl);
555  if (session == nullptr) {
556  return nullptr;
557  }
558 
559  // OpenSSL historically didn't include the leaf certificate in the returned
560  // certificate chain, but only for servers.
561  return ssl->server ? session->x509_chain_without_leaf : session->x509_chain;
562 }
563 
566  SSL_SESSION *session = SSL_get_session(ssl);
567  if (session == NULL) {
568  return NULL;
569  }
570 
571  return session->x509_chain;
572 }
573 
574 int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose) {
576  return X509_VERIFY_PARAM_set_purpose(ctx->param, purpose);
577 }
578 
579 int SSL_set_purpose(SSL *ssl, int purpose) {
581  if (!ssl->config) {
582  return 0;
583  }
584  return X509_VERIFY_PARAM_set_purpose(ssl->config->param, purpose);
585 }
586 
587 int SSL_CTX_set_trust(SSL_CTX *ctx, int trust) {
589  return X509_VERIFY_PARAM_set_trust(ctx->param, trust);
590 }
591 
592 int SSL_set_trust(SSL *ssl, int trust) {
594  if (!ssl->config) {
595  return 0;
596  }
597  return X509_VERIFY_PARAM_set_trust(ssl->config->param, trust);
598 }
599 
602  return X509_VERIFY_PARAM_set1(ctx->param, param);
603 }
604 
605 int SSL_set1_param(SSL *ssl, const X509_VERIFY_PARAM *param) {
607  if (!ssl->config) {
608  return 0;
609  }
610  return X509_VERIFY_PARAM_set1(ssl->config->param, param);
611 }
612 
615  return ctx->param;
616 }
617 
620  if (!ssl->config) {
621  assert(ssl->config);
622  return 0;
623  }
624  return ssl->config->param;
625 }
626 
627 int SSL_get_verify_depth(const SSL *ssl) {
629  if (!ssl->config) {
630  assert(ssl->config);
631  return 0;
632  }
633  return X509_VERIFY_PARAM_get_depth(ssl->config->param);
634 }
635 
638  if (!ssl->config) {
639  assert(ssl->config);
640  return 0;
641  }
642  return ssl->config->verify_callback;
643 }
644 
647  return ctx->verify_mode;
648 }
649 
652  return X509_VERIFY_PARAM_get_depth(ctx->param);
653 }
654 
656  int ok, X509_STORE_CTX *store_ctx) {
658  return ctx->default_verify_callback;
659 }
660 
661 void SSL_set_verify(SSL *ssl, int mode,
662  int (*callback)(int ok, X509_STORE_CTX *store_ctx)) {
664  if (!ssl->config) {
665  return;
666  }
667  ssl->config->verify_mode = mode;
668  if (callback != NULL) {
669  ssl->config->verify_callback = callback;
670  }
671 }
672 
673 void SSL_set_verify_depth(SSL *ssl, int depth) {
675  if (!ssl->config) {
676  return;
677  }
679 }
680 
682  int (*cb)(X509_STORE_CTX *store_ctx,
683  void *arg),
684  void *arg) {
686  ctx->app_verify_callback = cb;
687  ctx->app_verify_arg = arg;
688 }
689 
691  int (*cb)(int, X509_STORE_CTX *)) {
693  ctx->verify_mode = mode;
694  ctx->default_verify_callback = cb;
695 }
696 
700 }
701 
704  return X509_STORE_set_default_paths(ctx->cert_store);
705 }
706 
707 int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *ca_file,
708  const char *ca_dir) {
710  return X509_STORE_load_locations(ctx->cert_store, ca_file, ca_dir);
711 }
712 
713 long SSL_get_verify_result(const SSL *ssl) {
715  SSL_SESSION *session = SSL_get_session(ssl);
716  if (session == NULL) {
718  }
719  return session->verify_result;
720 }
721 
724  return ctx->cert_store;
725 }
726 
729  X509_STORE_free(ctx->cert_store);
730  ctx->cert_store = store;
731 }
732 
733 static int ssl_use_certificate(CERT *cert, X509 *x) {
734  if (x == NULL) {
736  return 0;
737  }
738 
739  UniquePtr<CRYPTO_BUFFER> buffer = x509_to_buffer(x);
740  if (!buffer) {
741  return 0;
742  }
743 
744  return ssl_set_cert(cert, std::move(buffer));
745 }
746 
747 int SSL_use_certificate(SSL *ssl, X509 *x) {
749  if (!ssl->config) {
750  return 0;
751  }
752  return ssl_use_certificate(ssl->config->cert.get(), x);
753 }
754 
757  return ssl_use_certificate(ctx->cert.get(), x);
758 }
759 
760 // ssl_cert_cache_leaf_cert sets |cert->x509_leaf|, if currently NULL, from the
761 // first element of |cert->chain|.
762 static int ssl_cert_cache_leaf_cert(CERT *cert) {
763  assert(cert->x509_method);
764 
765  if (cert->x509_leaf != NULL ||
766  cert->chain == NULL) {
767  return 1;
768  }
769 
770  CRYPTO_BUFFER *leaf = sk_CRYPTO_BUFFER_value(cert->chain.get(), 0);
771  if (!leaf) {
772  return 1;
773  }
774 
775  cert->x509_leaf = X509_parse_from_buffer(leaf);
776  return cert->x509_leaf != NULL;
777 }
778 
779 static X509 *ssl_cert_get0_leaf(CERT *cert) {
780  if (cert->x509_leaf == NULL &&
781  !ssl_cert_cache_leaf_cert(cert)) {
782  return NULL;
783  }
784 
785  return cert->x509_leaf;
786 }
787 
790  if (!ssl->config) {
791  assert(ssl->config);
792  return 0;
793  }
794  return ssl_cert_get0_leaf(ssl->config->cert.get());
795 }
796 
799  MutexWriteLock lock(const_cast<CRYPTO_MUTEX*>(&ctx->lock));
800  return ssl_cert_get0_leaf(ctx->cert.get());
801 }
802 
803 static int ssl_cert_set0_chain(CERT *cert, STACK_OF(X509) *chain) {
804  if (!ssl_cert_set_chain(cert, chain)) {
805  return 0;
806  }
807 
808  sk_X509_pop_free(chain, X509_free);
810  return 1;
811 }
812 
813 static int ssl_cert_set1_chain(CERT *cert, STACK_OF(X509) *chain) {
814  if (!ssl_cert_set_chain(cert, chain)) {
815  return 0;
816  }
817 
819  return 1;
820 }
821 
822 static int ssl_cert_append_cert(CERT *cert, X509 *x509) {
823  assert(cert->x509_method);
824 
825  UniquePtr<CRYPTO_BUFFER> buffer = x509_to_buffer(x509);
826  if (!buffer) {
827  return 0;
828  }
829 
830  if (cert->chain != NULL) {
831  return PushToStack(cert->chain.get(), std::move(buffer));
832  }
833 
834  cert->chain = new_leafless_chain();
835  if (!cert->chain ||
836  !PushToStack(cert->chain.get(), std::move(buffer))) {
837  cert->chain.reset();
838  return 0;
839  }
840 
841  return 1;
842 }
843 
844 static int ssl_cert_add0_chain_cert(CERT *cert, X509 *x509) {
845  if (!ssl_cert_append_cert(cert, x509)) {
846  return 0;
847  }
848 
849  X509_free(cert->x509_stash);
850  cert->x509_stash = x509;
852  return 1;
853 }
854 
855 static int ssl_cert_add1_chain_cert(CERT *cert, X509 *x509) {
856  if (!ssl_cert_append_cert(cert, x509)) {
857  return 0;
858  }
859 
861  return 1;
862 }
863 
866  return ssl_cert_set0_chain(ctx->cert.get(), chain);
867 }
868 
871  return ssl_cert_set1_chain(ctx->cert.get(), chain);
872 }
873 
874 int SSL_set0_chain(SSL *ssl, STACK_OF(X509) *chain) {
876  if (!ssl->config) {
877  return 0;
878  }
879  return ssl_cert_set0_chain(ssl->config->cert.get(), chain);
880 }
881 
882 int SSL_set1_chain(SSL *ssl, STACK_OF(X509) *chain) {
884  if (!ssl->config) {
885  return 0;
886  }
887  return ssl_cert_set1_chain(ssl->config->cert.get(), chain);
888 }
889 
892  return ssl_cert_add0_chain_cert(ctx->cert.get(), x509);
893 }
894 
897  return ssl_cert_add1_chain_cert(ctx->cert.get(), x509);
898 }
899 
902  return SSL_CTX_add0_chain_cert(ctx, x509);
903 }
904 
905 int SSL_add0_chain_cert(SSL *ssl, X509 *x509) {
907  if (!ssl->config) {
908  return 0;
909  }
910  return ssl_cert_add0_chain_cert(ssl->config->cert.get(), x509);
911 }
912 
913 int SSL_add1_chain_cert(SSL *ssl, X509 *x509) {
915  if (!ssl->config) {
916  return 0;
917  }
918  return ssl_cert_add1_chain_cert(ssl->config->cert.get(), x509);
919 }
920 
923  return SSL_CTX_set0_chain(ctx, NULL);
924 }
925 
929 }
930 
933  return SSL_set0_chain(ssl, NULL);
934 }
935 
936 // ssl_cert_cache_chain_certs fills in |cert->x509_chain| from elements 1.. of
937 // |cert->chain|.
938 static int ssl_cert_cache_chain_certs(CERT *cert) {
939  assert(cert->x509_method);
940 
941  if (cert->x509_chain != nullptr ||
942  cert->chain == nullptr ||
943  sk_CRYPTO_BUFFER_num(cert->chain.get()) < 2) {
944  return 1;
945  }
946 
948  if (!chain) {
949  return 0;
950  }
951 
952  for (size_t i = 1; i < sk_CRYPTO_BUFFER_num(cert->chain.get()); i++) {
954  UniquePtr<X509> x509(X509_parse_from_buffer(buffer));
955  if (!x509 ||
956  !PushToStack(chain.get(), std::move(x509))) {
957  return 0;
958  }
959  }
960 
961  cert->x509_chain = chain.release();
962  return 1;
963 }
964 
965 int SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain) {
967  MutexWriteLock lock(const_cast<CRYPTO_MUTEX*>(&ctx->lock));
968  if (!ssl_cert_cache_chain_certs(ctx->cert.get())) {
969  *out_chain = NULL;
970  return 0;
971  }
972 
973  *out_chain = ctx->cert->x509_chain;
974  return 1;
975 }
976 
978  STACK_OF(X509) **out_chain) {
979  return SSL_CTX_get0_chain_certs(ctx, out_chain);
980 }
981 
982 int SSL_get0_chain_certs(const SSL *ssl, STACK_OF(X509) **out_chain) {
984  if (!ssl->config) {
985  assert(ssl->config);
986  return 0;
987  }
988  if (!ssl_cert_cache_chain_certs(ssl->config->cert.get())) {
989  *out_chain = NULL;
990  return 0;
991  }
992 
993  *out_chain = ssl->config->cert->x509_chain;
994  return 1;
995 }
996 
998  uint8_t *data;
999  size_t len;
1000  if (!BIO_read_asn1(bio, &data, &len, 1024 * 1024)) {
1001  return 0;
1002  }
1003  bssl::UniquePtr<uint8_t> free_data(data);
1004  const uint8_t *ptr = data;
1005  return d2i_SSL_SESSION(out, &ptr, static_cast<long>(len));
1006 }
1007 
1008 int i2d_SSL_SESSION_bio(BIO *bio, const SSL_SESSION *session) {
1009  uint8_t *data;
1010  size_t len;
1011  if (!SSL_SESSION_to_bytes(session, &data, &len)) {
1012  return 0;
1013  }
1014  bssl::UniquePtr<uint8_t> free_data(data);
1015  return BIO_write_all(bio, data, len);
1016 }
1017 
1019 
1021  if (length < 0) {
1023  return NULL;
1024  }
1025 
1026  CBS cbs;
1028 
1029  UniquePtr<SSL_SESSION> ret = SSL_SESSION_parse(&cbs, &ssl_crypto_x509_method,
1030  NULL /* no buffer pool */);
1031  if (!ret) {
1032  return NULL;
1033  }
1034 
1035  if (a) {
1036  SSL_SESSION_free(*a);
1037  *a = ret.get();
1038  }
1039  *pp = CBS_data(&cbs);
1040  return ret.release();
1041 }
1042 
1045 }
1046 
1048  const STACK_OF(X509_NAME) *name_list,
1051  if (!buffers) {
1052  return;
1053  }
1054 
1055  for (X509_NAME *name : name_list) {
1056  uint8_t *outp = NULL;
1057  int len = i2d_X509_NAME(name, &outp);
1058  if (len < 0) {
1059  return;
1060  }
1061 
1062  UniquePtr<CRYPTO_BUFFER> buffer(CRYPTO_BUFFER_new(outp, len, pool));
1063  OPENSSL_free(outp);
1064  if (!buffer ||
1065  !PushToStack(buffers.get(), std::move(buffer))) {
1066  return;
1067  }
1068  }
1069 
1070  *ca_list = std::move(buffers);
1071 }
1072 
1074  check_ssl_x509_method(ssl);
1075  if (!ssl->config) {
1076  return;
1077  }
1078  ssl->ctx->x509_method->ssl_flush_cached_client_CA(ssl->config.get());
1079  set_client_CA_list(&ssl->config->client_CA, name_list, ssl->ctx->pool);
1081 }
1082 
1085  ctx->x509_method->ssl_ctx_flush_cached_client_CA(ctx);
1086  set_client_CA_list(&ctx->client_CA, name_list, ctx->pool);
1088 }
1089 
1090 static STACK_OF(X509_NAME) *
1091  buffer_names_to_x509(const STACK_OF(CRYPTO_BUFFER) *names,
1092  STACK_OF(X509_NAME) **cached) {
1093  if (names == NULL) {
1094  return NULL;
1095  }
1096 
1097  if (*cached != NULL) {
1098  return *cached;
1099  }
1100 
1102  if (!new_cache) {
1104  return NULL;
1105  }
1106 
1107  for (const CRYPTO_BUFFER *buffer : names) {
1109  UniquePtr<X509_NAME> name(
1110  d2i_X509_NAME(nullptr, &inp, CRYPTO_BUFFER_len(buffer)));
1111  if (!name ||
1113  !PushToStack(new_cache.get(), std::move(name))) {
1114  return NULL;
1115  }
1116  }
1117 
1118  *cached = new_cache.release();
1119  return *cached;
1120 }
1121 
1123  check_ssl_x509_method(ssl);
1124  if (!ssl->config) {
1125  assert(ssl->config);
1126  return NULL;
1127  }
1128  // For historical reasons, this function is used both to query configuration
1129  // state on a server as well as handshake state on a client. However, whether
1130  // |ssl| is a client or server is not known until explicitly configured with
1131  // |SSL_set_connect_state|. If |do_handshake| is NULL, |ssl| is in an
1132  // indeterminate mode and |ssl->server| is unset.
1133  if (ssl->do_handshake != NULL && !ssl->server) {
1134  if (ssl->s3->hs != NULL) {
1135  return buffer_names_to_x509(ssl->s3->hs->ca_names.get(),
1136  &ssl->s3->hs->cached_x509_ca_names);
1137  }
1138 
1139  return NULL;
1140  }
1141 
1142  if (ssl->config->client_CA != NULL) {
1143  return buffer_names_to_x509(
1144  ssl->config->client_CA.get(),
1145  (STACK_OF(X509_NAME) **)&ssl->config->cached_x509_client_CA);
1146  }
1147  return SSL_CTX_get_client_CA_list(ssl->ctx.get());
1148 }
1149 
1152  // This is a logically const operation that may be called on multiple threads,
1153  // so it needs to lock around updating |cached_x509_client_CA|.
1154  MutexWriteLock lock(const_cast<CRYPTO_MUTEX *>(&ctx->lock));
1155  return buffer_names_to_x509(
1156  ctx->client_CA.get(),
1157  const_cast<STACK_OF(X509_NAME) **>(&ctx->cached_x509_client_CA));
1158 }
1159 
1162  if (x509 == NULL) {
1163  return 0;
1164  }
1165 
1166  uint8_t *outp = NULL;
1167  int len = i2d_X509_NAME(X509_get_subject_name(x509), &outp);
1168  if (len < 0) {
1169  return 0;
1170  }
1171 
1172  UniquePtr<CRYPTO_BUFFER> buffer(CRYPTO_BUFFER_new(outp, len, pool));
1173  OPENSSL_free(outp);
1174  if (!buffer) {
1175  return 0;
1176  }
1177 
1178  int alloced = 0;
1179  if (*names == nullptr) {
1180  names->reset(sk_CRYPTO_BUFFER_new_null());
1181  alloced = 1;
1182 
1183  if (*names == NULL) {
1184  return 0;
1185  }
1186  }
1187 
1188  if (!PushToStack(names->get(), std::move(buffer))) {
1189  if (alloced) {
1190  names->reset();
1191  }
1192  return 0;
1193  }
1194 
1195  return 1;
1196 }
1197 
1198 int SSL_add_client_CA(SSL *ssl, X509 *x509) {
1199  check_ssl_x509_method(ssl);
1200  if (!ssl->config) {
1201  return 0;
1202  }
1203  if (!add_client_CA(&ssl->config->client_CA, x509, ssl->ctx->pool)) {
1204  return 0;
1205  }
1206 
1208  return 1;
1209 }
1210 
1213  if (!add_client_CA(&ctx->client_CA, x509, ctx->pool)) {
1214  return 0;
1215  }
1216 
1218  return 1;
1219 }
1220 
1221 static int do_client_cert_cb(SSL *ssl, void *arg) {
1222  // Should only be called during handshake, but check to be sure.
1223  if (!ssl->config) {
1224  assert(ssl->config);
1225  return -1;
1226  }
1227 
1228  if (ssl_has_certificate(ssl->s3->hs.get()) ||
1229  ssl->ctx->client_cert_cb == NULL) {
1230  return 1;
1231  }
1232 
1233  X509 *x509 = NULL;
1234  EVP_PKEY *pkey = NULL;
1235  int ret = ssl->ctx->client_cert_cb(ssl, &x509, &pkey);
1236  if (ret < 0) {
1237  return -1;
1238  }
1239  UniquePtr<X509> free_x509(x509);
1240  UniquePtr<EVP_PKEY> free_pkey(pkey);
1241 
1242  if (ret != 0) {
1243  if (!SSL_use_certificate(ssl, x509) ||
1244  !SSL_use_PrivateKey(ssl, pkey)) {
1245  return 0;
1246  }
1247  }
1248 
1249  return 1;
1250 }
1251 
1253  X509 **out_x509,
1254  EVP_PKEY **out_pkey)) {
1256  // Emulate the old client certificate callback with the new one.
1258  ctx->client_cert_cb = cb;
1259 }
1260 
1261 static int set_cert_store(X509_STORE **store_ptr, X509_STORE *new_store,
1262  int take_ref) {
1263  X509_STORE_free(*store_ptr);
1264  *store_ptr = new_store;
1265 
1266  if (new_store != NULL && take_ref) {
1267  X509_STORE_up_ref(new_store);
1268  }
1269 
1270  return 1;
1271 }
1272 
1274  // The ex_data index to go from |X509_STORE_CTX| to |SSL| always uses the
1275  // reserved app_data slot. Before ex_data was introduced, app_data was used.
1276  // Avoid breaking any software which assumes |X509_STORE_CTX_get_app_data|
1277  // works.
1278  return 0;
1279 }
1280 
1283  return set_cert_store(&ctx->cert->verify_store, store, 0);
1284 }
1285 
1288  return set_cert_store(&ctx->cert->verify_store, store, 1);
1289 }
1290 
1292  check_ssl_x509_method(ssl);
1293  if (!ssl->config) {
1294  return 0;
1295  }
1296  return set_cert_store(&ssl->config->cert->verify_store, store, 0);
1297 }
1298 
1300  check_ssl_x509_method(ssl);
1301  if (!ssl->config) {
1302  return 0;
1303  }
1304  return set_cert_store(&ssl->config->cert->verify_store, store, 1);
1305 }
1306 
1308  switch (result) {
1311  case X509_V_ERR_INVALID_CA:
1319  return SSL_AD_UNKNOWN_CA;
1320 
1333  return SSL_AD_BAD_CERTIFICATE;
1334 
1337  return SSL_AD_DECRYPT_ERROR;
1338 
1344 
1347 
1349  case X509_V_ERR_OUT_OF_MEM:
1352  return SSL_AD_INTERNAL_ERROR;
1353 
1355  return SSL_AD_HANDSHAKE_FAILURE;
1356 
1359 
1360  default:
1362  }
1363 }
ssl_cert_cache_chain_certs
static int ssl_cert_cache_chain_certs(CERT *cert)
Definition: ssl_x509.cc:938
SSL_MODE_NO_AUTO_CHAIN
#define SSL_MODE_NO_AUTO_CHAIN
Definition: ssl.h:775
SSL_CTX_set_verify_depth
void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth)
Definition: ssl_x509.cc:697
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
ssl_crypto_x509_ssl_ctx_new
static bool ssl_crypto_x509_ssl_ctx_new(SSL_CTX *ctx)
Definition: ssl_x509.cc:499
ssl_st::server
bool server
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3777
X509_verify_cert
#define X509_verify_cert
Definition: boringssl_prefix_symbols.h:2733
SSL_set_client_CA_list
void SSL_set_client_CA_list(SSL *ssl, STACK_OF(X509_NAME) *name_list)
Definition: ssl_x509.cc:1073
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
BIO_read_asn1
#define BIO_read_asn1
Definition: boringssl_prefix_symbols.h:832
X509_STORE_new
#define X509_STORE_new
Definition: boringssl_prefix_symbols.h:2545
ssl_has_certificate
bool ssl_has_certificate(const SSL_HANDSHAKE *hs)
Definition: ssl_cert.cc:340
length
const uint8_t long length
Definition: ssl_x509.cc:1020
ssl_crypto_x509_cert_dup
static void ssl_crypto_x509_cert_dup(CERT *new_cert, const CERT *cert)
Definition: ssl_x509.cc:275
X509_VERIFY_PARAM_set_purpose
#define X509_VERIFY_PARAM_set_purpose
Definition: boringssl_prefix_symbols.h:2601
X509_get_subject_name
#define X509_get_subject_name
Definition: boringssl_prefix_symbols.h:2672
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
SSL_SESSION_parse
OPENSSL_EXPORT UniquePtr< SSL_SESSION > SSL_SESSION_parse(CBS *cbs, const SSL_X509_METHOD *x509_method, CRYPTO_BUFFER_POOL *pool)
Definition: ssl_asn1.cc:555
ssl_crypto_x509_cert_free
static void ssl_crypto_x509_cert_free(CERT *cert)
Definition: ssl_x509.cc:270
SSL_CTX_set_client_cert_cb
void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int(*cb)(SSL *ssl, X509 **out_x509, EVP_PKEY **out_pkey))
Definition: ssl_x509.cc:1252
SSL_get_verify_callback
int(*)(int, X509_STORE_CTX *) SSL_get_verify_callback(const SSL *ssl)
Definition: ssl_x509.cc:636
SSL_CTX_get_verify_mode
int SSL_CTX_get_verify_mode(const SSL_CTX *ctx)
Definition: ssl_x509.cc:645
cbs_st
Definition: bytestring.h:39
X509_VERIFY_PARAM_set_trust
#define X509_VERIFY_PARAM_set_trust
Definition: boringssl_prefix_symbols.h:2603
X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
Definition: x509.h:1924
ctx
Definition: benchmark-async.c:30
const
#define const
Definition: bloaty/third_party/zlib/zconf.h:230
X509_VERIFY_PARAM_set1_host
#define X509_VERIFY_PARAM_set1_host
Definition: boringssl_prefix_symbols.h:2593
X509_STORE_up_ref
#define X509_STORE_up_ref
Definition: boringssl_prefix_symbols.h:2563
X509_V_ERR_INVALID_CA
#define X509_V_ERR_INVALID_CA
Definition: x509.h:1943
bio_st
Definition: bio.h:822
SSL_get0_param
X509_VERIFY_PARAM * SSL_get0_param(SSL *ssl)
Definition: ssl_x509.cc:618
SSL_use_certificate
int SSL_use_certificate(SSL *ssl, X509 *x)
Definition: ssl_x509.cc:747
SSL_add0_chain_cert
int SSL_add0_chain_cert(SSL *ssl, X509 *x509)
Definition: ssl_x509.cc:905
CBS_data
#define CBS_data
Definition: boringssl_prefix_symbols.h:1057
ssl_crypto_x509_session_cache_objects
static bool ssl_crypto_x509_session_cache_objects(SSL_SESSION *sess)
Definition: ssl_x509.cc:282
do_client_cert_cb
static int do_client_cert_cb(SSL *ssl, void *arg)
Definition: ssl_x509.cc:1221
SSL_CTX_set_client_CA_list
void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list)
Definition: ssl_x509.cc:1083
SSL_set_trust
int SSL_set_trust(SSL *ssl, int trust)
Definition: ssl_x509.cc:592
SSL_set1_param
int SSL_set1_param(SSL *ssl, const X509_VERIFY_PARAM *param)
Definition: ssl_x509.cc:605
d2i_X509_NAME
#define d2i_X509_NAME
Definition: boringssl_prefix_symbols.h:3044
regen-readme.inp
inp
Definition: regen-readme.py:11
X509_STORE_CTX_set_ex_data
#define X509_STORE_CTX_set_ex_data
Definition: boringssl_prefix_symbols.h:2516
SSL_CTX_set_trust
int SSL_CTX_set_trust(SSL_CTX *ctx, int trust)
Definition: ssl_x509.cc:587
SSL_get_verify_depth
int SSL_get_verify_depth(const SSL *ssl)
Definition: ssl_x509.cc:627
X509_V_ERR_CRL_HAS_EXPIRED
#define X509_V_ERR_CRL_HAS_EXPIRED
Definition: x509.h:1931
SSL_set0_chain
int SSL_set0_chain(SSL *ssl, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:874
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
internal.h
SSL_VERIFY_NONE
#define SSL_VERIFY_NONE
Definition: ssl.h:2373
cbs
CBS_init & cbs
Definition: ssl_x509.cc:1027
ssl_cert_set_chain
static bool ssl_cert_set_chain(CERT *cert, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:202
SSL_AD_CERTIFICATE_UNKNOWN
#define SSL_AD_CERTIFICATE_UNKNOWN
Definition: ssl.h:3806
sk_X509_num
#define sk_X509_num
Definition: boringssl_prefix_symbols.h:587
X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
Definition: x509.h:1935
ssl_st::config
bssl::UniquePtr< bssl::SSL_CONFIG > config
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3712
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_CTX_set_cert_verify_callback
void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int(*cb)(X509_STORE_CTX *store_ctx, void *arg), void *arg)
Definition: ssl_x509.cc:681
SSL_X509_METHOD
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2510
names
sub_type names
Definition: cxa_demangle.cpp:4905
X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
Definition: x509.h:1940
SSL_AD_INTERNAL_ERROR
#define SSL_AD_INTERNAL_ERROR
Definition: ssl.h:3815
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
Definition: x509.h:1937
X509_V_ERR_CRL_SIGNATURE_FAILURE
#define X509_V_ERR_CRL_SIGNATURE_FAILURE
Definition: x509.h:1927
CRYPTO_BUFFER_len
#define CRYPTO_BUFFER_len
Definition: boringssl_prefix_symbols.h:1118
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_clear_chain_certs
int SSL_clear_chain_certs(SSL *ssl)
Definition: ssl_x509.cc:931
SSL_get_certificate
X509 * SSL_get_certificate(const SSL *ssl)
Definition: ssl_x509.cc:788
sk_CRYPTO_BUFFER_push
#define sk_CRYPTO_BUFFER_push
Definition: boringssl_prefix_symbols.h:559
x509v3.h
X509_parse_from_buffer
OPENSSL_EXPORT X509 * X509_parse_from_buffer(CRYPTO_BUFFER *buf)
SSL_AD_UNKNOWN_CA
#define SSL_AD_UNKNOWN_CA
Definition: ssl.h:3808
SSL_CONFIG::cert
UniquePtr< CERT > cert
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2986
SSL_CTX_get0_certificate
X509 * SSL_CTX_get0_certificate(const SSL_CTX *ctx)
Definition: ssl_x509.cc:797
ssl_use_certificate
static int ssl_use_certificate(CERT *cert, X509 *x)
Definition: ssl_x509.cc:733
X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
Definition: x509.h:1933
X509_V_ERR_PATH_LENGTH_EXCEEDED
#define X509_V_ERR_PATH_LENGTH_EXCEEDED
Definition: x509.h:1944
bssl
Definition: hpke_test.cc:37
set_client_CA_list
static void set_client_CA_list(UniquePtr< STACK_OF(CRYPTO_BUFFER)> *ca_list, const STACK_OF(X509_NAME) *name_list, CRYPTO_BUFFER_POOL *pool)
Definition: ssl_x509.cc:1047
X509_STORE_CTX_set_verify_cb
#define X509_STORE_CTX_set_verify_cb
Definition: boringssl_prefix_symbols.h:2521
mode
const char int mode
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
pem.h
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
setup.name
name
Definition: setup.py:542
i2d_X509
#define i2d_X509
Definition: boringssl_prefix_symbols.h:3274
SSL_set_verify
void SSL_set_verify(SSL *ssl, int mode, int(*callback)(int ok, X509_STORE_CTX *store_ctx))
Definition: ssl_x509.cc:661
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
SSL_dup_CA_list
#define SSL_dup_CA_list
Definition: boringssl_prefix_symbols.h:298
ssl_crypto_x509_ssl_ctx_flush_cached_client_CA
static void ssl_crypto_x509_ssl_ctx_flush_cached_client_CA(SSL_CTX *ctx)
Definition: ssl_x509.cc:494
SSL_set1_verify_cert_store
int SSL_set1_verify_cert_store(SSL *ssl, X509_STORE *store)
Definition: ssl_x509.cc:1299
CBS_init
#define CBS_init
Definition: boringssl_prefix_symbols.h:1085
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
X509_chain_up_ref
#define X509_chain_up_ref
Definition: boringssl_prefix_symbols.h:2612
X509_V_ERR_CERT_REVOKED
#define X509_V_ERR_CERT_REVOKED
Definition: x509.h:1942
sk_X509_NAME_deep_copy
#define sk_X509_NAME_deep_copy
Definition: boringssl_prefix_symbols.h:576
SSL_AD_CERTIFICATE_REVOKED
#define SSL_AD_CERTIFICATE_REVOKED
Definition: ssl.h:3804
X509_VERIFY_PARAM_inherit
#define X509_VERIFY_PARAM_inherit
Definition: boringssl_prefix_symbols.h:2588
SSL_CTX_set1_chain
int SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:869
ssl_ctx_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3404
ssl_ctx_st::cert_store
X509_STORE * cert_store
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3430
ssl_st::mode
uint32_t mode
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3764
X509_NAME_free
#define X509_NAME_free
Definition: boringssl_prefix_symbols.h:2381
SSL_CTX_set1_param
int SSL_CTX_set1_param(SSL_CTX *ctx, const X509_VERIFY_PARAM *param)
Definition: ssl_x509.cc:600
ssl_crypto_x509_cert_flush_cached_chain
static void ssl_crypto_x509_cert_flush_cached_chain(CERT *cert)
Definition: ssl_x509.cc:242
X509_V_ERR_CERT_HAS_EXPIRED
#define X509_V_ERR_CERT_HAS_EXPIRED
Definition: x509.h:1929
i2d_SSL_SESSION_bio
int i2d_SSL_SESSION_bio(BIO *bio, const SSL_SESSION *session)
Definition: ssl_x509.cc:1008
SSL_get_client_CA_list
#define SSL_get_client_CA_list
Definition: boringssl_prefix_symbols.h:331
SSL_AD_CERTIFICATE_EXPIRED
#define SSL_AD_CERTIFICATE_EXPIRED
Definition: ssl.h:3805
ssl_session_st::verify_result
long verify_result
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3846
ssl_cert_get0_leaf
static X509 * ssl_cert_get0_leaf(CERT *cert)
Definition: ssl_x509.cc:779
X509_VERIFY_PARAM_new
#define X509_VERIFY_PARAM_new
Definition: boringssl_prefix_symbols.h:2590
CERT
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2345
ssl_crypto_x509_cert_flush_cached_leaf
static void ssl_crypto_x509_cert_flush_cached_leaf(CERT *cert)
Definition: ssl_x509.cc:237
X509_free
#define X509_free
Definition: boringssl_prefix_symbols.h:2632
ssl_set_cert
bool ssl_set_cert(CERT *cert, UniquePtr< CRYPTO_BUFFER > buffer)
Definition: ssl_cert.cc:305
SSL_CTX_get_verify_callback
int(*)(int ok, X509_STORE_CTX *store_ctx) SSL_CTX_get_verify_callback(const SSL_CTX *ctx)
Definition: ssl_x509.cc:655
bytestring.h
SSL_CTX_set0_chain
int SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:864
SSL_CTX_add1_chain_cert
int SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509)
Definition: ssl_x509.cc:895
SSL_CTX_set_cert_cb
#define SSL_CTX_set_cert_cb
Definition: boringssl_prefix_symbols.h:153
X509_V_ERR_UNSPECIFIED
#define X509_V_ERR_UNSPECIFIED
Definition: x509.h:1919
SSL_CTX_set0_verify_cert_store
int SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx, X509_STORE *store)
Definition: ssl_x509.cc:1281
CERT::x509_stash
X509 * x509_stash
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2374
SSL_CTX_add_client_CA
int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x509)
Definition: ssl_x509.cc:1211
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
Definition: x509.h:1939
ssl_crypto_x509_ssl_flush_cached_client_CA
static void ssl_crypto_x509_ssl_flush_cached_client_CA(SSL_CONFIG *cfg)
Definition: ssl_x509.cc:440
sk_X509_NAME_pop_free
#define sk_X509_NAME_pop_free
Definition: boringssl_prefix_symbols.h:581
X509_VERIFY_PARAM_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:217
X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER
#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER
Definition: x509.h:1954
CERT::chain
UniquePtr< STACK_OF(CRYPTO_BUFFER)> chain
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2359
sk_CRYPTO_BUFFER_new_null
#define sk_CRYPTO_BUFFER_new_null
Definition: boringssl_prefix_symbols.h:557
X509_STORE_load_locations
#define X509_STORE_load_locations
Definition: boringssl_prefix_symbols.h:2544
SSL_set_purpose
int SSL_set_purpose(SSL *ssl, int purpose)
Definition: ssl_x509.cc:579
SSL_CONFIG::param
X509_VERIFY_PARAM * param
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2979
SSL_CONFIG::verify_callback
int(* verify_callback)(int ok, X509_STORE_CTX *ctx)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2988
evp_pkey_st
Definition: evp.h:1046
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
X509_V_ERR_INVALID_PURPOSE
#define X509_V_ERR_INVALID_PURPOSE
Definition: x509.h:1945
X509_V_ERR_CRL_NOT_YET_VALID
#define X509_V_ERR_CRL_NOT_YET_VALID
Definition: x509.h:1930
ssl_crypto_x509_hs_flush_cached_ca_names
static void ssl_crypto_x509_hs_flush_cached_ca_names(SSL_HANDSHAKE *hs)
Definition: ssl_x509.cc:426
ssl_cert_add1_chain_cert
static int ssl_cert_add1_chain_cert(CERT *cert, X509 *x509)
Definition: ssl_x509.cc:855
ERR_R_PASSED_NULL_PARAMETER
#define ERR_R_PASSED_NULL_PARAMETER
Definition: err.h:373
X509_STORE_CTX_set_default
#define X509_STORE_CTX_set_default
Definition: boringssl_prefix_symbols.h:2513
ssl_crypto_x509_check_client_CA_list
static bool ssl_crypto_x509_check_client_CA_list(STACK_OF(CRYPTO_BUFFER) *names)
Definition: ssl_x509.cc:247
config
struct config_s config
SSL_get_peer_cert_chain
#define SSL_get_peer_cert_chain
Definition: boringssl_prefix_symbols.h:355
X509_V_ERR_APPLICATION_VERIFICATION
#define X509_V_ERR_APPLICATION_VERIFICATION
Definition: x509.h:1974
ssl_crypto_x509_ssl_config_free
static void ssl_crypto_x509_ssl_config_free(SSL_CONFIG *cfg)
Definition: ssl_x509.cc:445
ssl_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3698
X509_V_ERR_CERT_SIGNATURE_FAILURE
#define X509_V_ERR_CERT_SIGNATURE_FAILURE
Definition: x509.h:1926
SSL_CTX_get_verify_depth
int SSL_CTX_get_verify_depth(const SSL_CTX *ctx)
Definition: ssl_x509.cc:650
ssl_crypto_x509_session_clear
static void ssl_crypto_x509_session_clear(SSL_SESSION *session)
Definition: ssl_x509.cc:352
ssl_crypto_x509_session_verify_cert_chain
static bool ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session, SSL_HANDSHAKE *hs, uint8_t *out_alert)
Definition: ssl_x509.cc:361
SSL_alert_from_verify_result
int SSL_alert_from_verify_result(long result)
Definition: ssl_x509.cc:1307
BSSL_NAMESPACE_END
#define BSSL_NAMESPACE_END
Definition: base.h:480
SSL_CTX_get_cert_store
X509_STORE * SSL_CTX_get_cert_store(const SSL_CTX *ctx)
Definition: ssl_x509.cc:722
X509_V_ERR_OUT_OF_MEM
#define X509_V_ERR_OUT_OF_MEM
Definition: x509.h:1936
err.h
X509_up_ref
OPENSSL_EXPORT int X509_up_ref(X509 *x509)
ERR_R_INTERNAL_ERROR
#define ERR_R_INTERNAL_ERROR
Definition: err.h:374
arg
Definition: cmdline.cc:40
x509_store_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:270
name_list
Definition: transport_security_test.cc:199
X509_V_ERR_IP_ADDRESS_MISMATCH
#define X509_V_ERR_IP_ADDRESS_MISMATCH
Definition: x509.h:1991
SSL_SESSION_to_bytes
#define SSL_SESSION_to_bytes
Definition: boringssl_prefix_symbols.h:272
ssl_cert_add0_chain_cert
static int ssl_cert_add0_chain_cert(CERT *cert, X509 *x509)
Definition: ssl_x509.cc:844
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
CRYPTO_BUFFER_new
#define CRYPTO_BUFFER_new
Definition: boringssl_prefix_symbols.h:1119
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
callback
static void callback(void *arg, int status, int timeouts, struct hostent *host)
Definition: acountry.c:224
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
SSL_set0_verify_cert_store
int SSL_set0_verify_cert_store(SSL *ssl, X509_STORE *store)
Definition: ssl_x509.cc:1291
X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
Definition: x509.h:1934
SSL_CTX_set1_verify_cert_store
int SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx, X509_STORE *store)
Definition: ssl_x509.cc:1286
SSL_CTX_set_cert_store
void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store)
Definition: ssl_x509.cc:727
grpc_core::UniquePtr
std::unique_ptr< T, DefaultDeleteChar > UniquePtr
Definition: src/core/lib/gprpp/memory.h:43
X509_V_ERR_INVALID_CALL
#define X509_V_ERR_INVALID_CALL
Definition: x509.h:1994
new_leafless_chain
static UniquePtr< STACK_OF(CRYPTO_BUFFER)> new_leafless_chain(void)
Definition: ssl_x509.cc:188
SSL_AD_UNSUPPORTED_CERTIFICATE
#define SSL_AD_UNSUPPORTED_CERTIFICATE
Definition: ssl.h:3803
SSL_CTX_get0_chain_certs
int SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain)
Definition: ssl_x509.cc:965
i2d_X509_NAME
#define i2d_X509_NAME
Definition: boringssl_prefix_symbols.h:3288
X509_VERIFY_PARAM_get_depth
#define X509_VERIFY_PARAM_get_depth
Definition: boringssl_prefix_symbols.h:2586
ssl.h
ssl_cert_append_cert
static int ssl_cert_append_cert(CERT *cert, X509 *x509)
Definition: ssl_x509.cc:822
ssl_session_st::is_server
bool is_server
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3922
SSL_CTX_use_certificate
int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
Definition: ssl_x509.cc:755
ssl_session_st::x509_peer
X509 * x509_peer
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3830
X509_STORE_CTX_new
#define X509_STORE_CTX_new
Definition: boringssl_prefix_symbols.h:2507
X509_STORE_CTX_get1_chain
#define X509_STORE_CTX_get1_chain
Definition: boringssl_prefix_symbols.h:2497
set_cert_store
static int set_cert_store(X509_STORE **store_ptr, X509_STORE *new_store, int take_ref)
Definition: ssl_x509.cc:1261
ssl_crypto_x509_cert_clear
static void ssl_crypto_x509_cert_clear(CERT *cert)
Definition: ssl_x509.cc:262
SSL_CTX_set_verify
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int(*cb)(int, X509_STORE_CTX *))
Definition: ssl_x509.cc:690
pp
const uint8_t ** pp
Definition: ssl_x509.cc:1020
ssl_session_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3787
sk_CRYPTO_BUFFER_value
#define sk_CRYPTO_BUFFER_value
Definition: boringssl_prefix_symbols.h:561
SSL_CTX_set_default_verify_paths
int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx)
Definition: ssl_x509.cc:702
X509_STORE_CTX_init
#define X509_STORE_CTX_init
Definition: boringssl_prefix_symbols.h:2506
SSL_CTX_get_client_CA_list
#define SSL_CTX_get_client_CA_list
Definition: boringssl_prefix_symbols.h:92
CERT::x509_leaf
X509 * x509_leaf
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2369
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
ssl_crypto_x509_ssl_ctx_free
static void ssl_crypto_x509_ssl_ctx_free(SSL_CTX *ctx)
Definition: ssl_x509.cc:505
X509_V_ERR_CERT_CHAIN_TOO_LONG
#define X509_V_ERR_CERT_CHAIN_TOO_LONG
Definition: x509.h:1941
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
IMPLEMENT_PEM_rw
IMPLEMENT_PEM_rw(SSL_SESSION, SSL_SESSION, PEM_STRING_SSL_SESSION, SSL_SESSION) SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a
X509_V_ERR_HOSTNAME_MISMATCH
#define X509_V_ERR_HOSTNAME_MISMATCH
Definition: x509.h:1989
SSL_get_ex_data_X509_STORE_CTX_idx
int SSL_get_ex_data_X509_STORE_CTX_idx(void)
Definition: ssl_x509.cc:1273
SSL_use_PrivateKey
#define SSL_use_PrivateKey
Definition: boringssl_prefix_symbols.h:520
SSL_CTX_load_verify_locations
int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *ca_file, const char *ca_dir)
Definition: ssl_x509.cc:707
ssl_cert_set0_chain
static int ssl_cert_set0_chain(CERT *cert, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:803
ssl_crypto_x509_method
const SSL_X509_METHOD ssl_crypto_x509_method
Definition: ssl_x509.cc:511
X509_VERIFY_PARAM_set1
#define X509_VERIFY_PARAM_set1
Definition: boringssl_prefix_symbols.h:2591
X509_VERIFY_PARAM_set_depth
#define X509_VERIFY_PARAM_set_depth
Definition: boringssl_prefix_symbols.h:2598
X509_V_ERR_STORE_LOOKUP
#define X509_V_ERR_STORE_LOOKUP
Definition: x509.h:1996
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
sk_X509_value
#define sk_X509_value
Definition: boringssl_prefix_symbols.h:590
sk_X509_new_null
#define sk_X509_new_null
Definition: boringssl_prefix_symbols.h:586
X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
Definition: x509.h:1932
CERT::verify_store
X509_STORE * verify_store
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2399
X509_V_ERR_CERT_UNTRUSTED
#define X509_V_ERR_CERT_UNTRUSTED
Definition: x509.h:1946
PushToStack
std::enable_if<!internal::StackTraits< Stack >::kIsConst, bool >::type PushToStack(Stack *sk, UniquePtr< typename internal::StackTraits< Stack >::Type > elem)
Definition: stack.h:515
ssl_cert_set1_chain
static int ssl_cert_set1_chain(CERT *cert, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:813
SSL_AD_HANDSHAKE_FAILURE
#define SSL_AD_HANDSHAKE_FAILURE
Definition: ssl.h:3800
ok
bool ok
Definition: async_end2end_test.cc:197
arg
struct arg arg
ERR_clear_error
#define ERR_clear_error
Definition: boringssl_prefix_symbols.h:1413
SSL_get0_ech_name_override
#define SSL_get0_ech_name_override
Definition: boringssl_prefix_symbols.h:313
SSL_get0_chain_certs
int SSL_get0_chain_certs(const SSL *ssl, STACK_OF(X509) **out_chain)
Definition: ssl_x509.cc:982
SSL_CTX_clear_chain_certs
int SSL_CTX_clear_chain_certs(SSL_CTX *ctx)
Definition: ssl_x509.cc:921
X509_V_ERR_CERT_REJECTED
#define X509_V_ERR_CERT_REJECTED
Definition: x509.h:1947
SSL_CTX_add_extra_chain_cert
int SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *x509)
Definition: ssl_x509.cc:900
sk_X509_NAME_new_null
#define sk_X509_NAME_new_null
Definition: boringssl_prefix_symbols.h:580
X509_V_ERR_CERT_NOT_YET_VALID
#define X509_V_ERR_CERT_NOT_YET_VALID
Definition: x509.h:1928
ssl_ctx_st::app_verify_arg
void * app_verify_arg
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3473
CERT::x509_method
const SSL_X509_METHOD * x509_method
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2382
crypto_buffer_pool_st
Definition: third_party/boringssl-with-bazel/src/crypto/pool/internal.h:39
X509_NAME_dup
OPENSSL_EXPORT X509_NAME * X509_NAME_dup(X509_NAME *xn)
pool
InternalDescriptorPool * pool
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:807
SSL_add_client_CA
int SSL_add_client_CA(SSL *ssl, X509 *x509)
Definition: ssl_x509.cc:1198
SSL_CTX_set_purpose
int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose)
Definition: ssl_x509.cc:574
SSL_CONFIG
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2960
STACK_OF
STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl)
Definition: ssl_x509.cc:549
check_ssl_x509_method
static BSSL_NAMESPACE_BEGIN void check_ssl_x509_method(const SSL *ssl)
Definition: ssl_x509.cc:162
free_data
static void free_data(void *data, size_t len)
Definition: c_slice_buffer_test.cc:64
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
Definition: x509.h:1921
X509_STORE_CTX_get_error
#define X509_STORE_CTX_get_error
Definition: boringssl_prefix_symbols.h:2501
SSL_get_peer_certificate
X509 * SSL_get_peer_certificate(const SSL *ssl)
Definition: ssl_x509.cc:536
SSL_CTX_get_extra_chain_certs
int SSL_CTX_get_extra_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain)
Definition: ssl_x509.cc:977
X509_STORE_set_default_paths
#define X509_STORE_set_default_paths
Definition: boringssl_prefix_symbols.h:2552
X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
Definition: x509.h:1923
ssl_crypto_x509_session_dup
static bool ssl_crypto_x509_session_dup(SSL_SESSION *new_session, const SSL_SESSION *session)
Definition: ssl_x509.cc:332
SSL_R_DECODE_ERROR
#define SSL_R_DECODE_ERROR
Definition: ssl.h:5405
ssl_crypto_x509_ssl_new
static bool ssl_crypto_x509_ssl_new(SSL_HANDSHAKE *hs)
Definition: ssl_x509.cc:431
BIO_write_all
#define BIO_write_all
Definition: boringssl_prefix_symbols.h:871
X509_STORE_CTX_get0_param
#define X509_STORE_CTX_get0_param
Definition: boringssl_prefix_symbols.h:2492
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
sk_X509_pop_free
#define sk_X509_pop_free
Definition: boringssl_prefix_symbols.h:588
SSL_get_peer_full_cert_chain
#define SSL_get_peer_full_cert_chain
Definition: boringssl_prefix_symbols.h:358
add_client_CA
static int add_client_CA(UniquePtr< STACK_OF(CRYPTO_BUFFER)> *names, X509 *x509, CRYPTO_BUFFER_POOL *pool)
Definition: ssl_x509.cc:1160
SSL_SESSION_free
#define SSL_SESSION_free
Definition: boringssl_prefix_symbols.h:241
SSL_get_session
#define SSL_get_session
Definition: boringssl_prefix_symbols.h:376
check_ssl_ctx_x509_method
static void check_ssl_ctx_x509_method(const SSL_CTX *ctx)
Definition: ssl_x509.cc:168
mkowners.depth
depth
Definition: mkowners.py:114
X509_VERIFY_PARAM_free
#define X509_VERIFY_PARAM_free
Definition: boringssl_prefix_symbols.h:2581
X509_V_ERR_EMAIL_MISMATCH
#define X509_V_ERR_EMAIL_MISMATCH
Definition: x509.h:1990
SSL_set1_chain
int SSL_set1_chain(SSL *ssl, STACK_OF(X509) *chain)
Definition: ssl_x509.cc:882
X509_STORE_free
#define X509_STORE_free
Definition: boringssl_prefix_symbols.h:2527
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_st::ctx
bssl::UniquePtr< SSL_CTX > ctx
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3754
SSL_AD_DECRYPT_ERROR
#define SSL_AD_DECRYPT_ERROR
Definition: ssl.h:3811
PEM_STRING_SSL_SESSION
#define PEM_STRING_SSL_SESSION
Definition: pem.h:99
crypto_mutex_st
Definition: thread.h:70
sk_X509_shift
#define sk_X509_shift
Definition: boringssl_prefix_symbols.h:589
ssl_cert_cache_leaf_cert
static int ssl_cert_cache_leaf_cert(CERT *cert)
Definition: ssl_x509.cc:762
sk_CRYPTO_BUFFER_num
#define sk_CRYPTO_BUFFER_num
Definition: boringssl_prefix_symbols.h:558
ERR_R_X509_LIB
#define ERR_R_X509_LIB
Definition: err.h:339
X509_name_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:95
SSL_add1_chain_cert
int SSL_add1_chain_cert(SSL *ssl, X509 *x509)
Definition: ssl_x509.cc:913
SSL_get_verify_result
long SSL_get_verify_result(const SSL *ssl)
Definition: ssl_x509.cc:713
x509_store_ctx_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:312
X509_V_ERR_UNABLE_TO_GET_CRL
#define X509_V_ERR_UNABLE_TO_GET_CRL
Definition: x509.h:1922
X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
Definition: x509.h:1925
ssl_ctx_st::app_verify_callback
int(* app_verify_callback)(X509_STORE_CTX *store_ctx, void *arg)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3472
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
ssl_crypto_x509_ssl_auto_chain_if_needed
static bool ssl_crypto_x509_ssl_auto_chain_if_needed(SSL_HANDSHAKE *hs)
Definition: ssl_x509.cc:451
SSL_CTX_clear_extra_chain_certs
int SSL_CTX_clear_extra_chain_certs(SSL_CTX *ctx)
Definition: ssl_x509.cc:926
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
asn1.h
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
SSL_AD_BAD_CERTIFICATE
#define SSL_AD_BAD_CERTIFICATE
Definition: ssl.h:3802
x509_to_buffer
static UniquePtr< CRYPTO_BUFFER > x509_to_buffer(X509 *x509)
Definition: ssl_x509.cc:174
stack.h
d2i_SSL_SESSION_bio
SSL_SESSION * d2i_SSL_SESSION_bio(BIO *bio, SSL_SESSION **out)
Definition: ssl_x509.cc:997
d2i_SSL_SESSION
OPENSSL_EXPORT SSL_SESSION * d2i_SSL_SESSION(SSL_SESSION **a, const uint8_t **pp, long length)
SSL_CTX_add0_chain_cert
int SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509)
Definition: ssl_x509.cc:890
SSL_CTX_get0_param
X509_VERIFY_PARAM * SSL_CTX_get0_param(SSL_CTX *ctx)
Definition: ssl_x509.cc:613
SSL_set_verify_depth
void SSL_set_verify_depth(SSL *ssl, int depth)
Definition: ssl_x509.cc:673
x509.h
X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
Definition: x509.h:1938


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