v3_purp.c
Go to the documentation of this file.
1 /* v3_purp.c */
2 /*
3  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4  * 2001.
5  */
6 /* ====================================================================
7  * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. All advertising materials mentioning features or use of this
22  * software must display the following acknowledgment:
23  * "This product includes software developed by the OpenSSL Project
24  * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25  *
26  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27  * endorse or promote products derived from this software without
28  * prior written permission. For written permission, please contact
29  * licensing@OpenSSL.org.
30  *
31  * 5. Products derived from this software may not be called "OpenSSL"
32  * nor may "OpenSSL" appear in their names without prior written
33  * permission of the OpenSSL Project.
34  *
35  * 6. Redistributions of any form whatsoever must retain the following
36  * acknowledgment:
37  * "This product includes software developed by the OpenSSL Project
38  * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51  * OF THE POSSIBILITY OF SUCH DAMAGE.
52  * ====================================================================
53  *
54  * This product includes cryptographic software written by Eric Young
55  * (eay@cryptsoft.com). This product includes software written by Tim
56  * Hudson (tjh@cryptsoft.com). */
57 
58 #include <stdio.h>
59 
60 #include <string.h>
61 
62 #include <openssl/err.h>
63 #include <openssl/digest.h>
64 #include <openssl/mem.h>
65 #include <openssl/obj.h>
66 #include <openssl/thread.h>
67 #include <openssl/x509v3.h>
68 
69 #include "../internal.h"
70 #include "../x509/internal.h"
71 #include "internal.h"
72 
73 #define V1_ROOT (EXFLAG_V1|EXFLAG_SS)
74 #define ku_reject(x, usage) \
75  (((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
76 #define xku_reject(x, usage) \
77  (((x)->ex_flags & EXFLAG_XKUSAGE) && !((x)->ex_xkusage & (usage)))
78 #define ns_reject(x, usage) \
79  (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage)))
80 
81 static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x,
82  int ca);
83 static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x,
84  int ca);
85 static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x,
86  int ca);
87 static int purpose_smime(const X509 *x, int ca);
88 static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x,
89  int ca);
90 static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x,
91  int ca);
92 static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x,
93  int ca);
94 static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x,
95  int ca);
96 static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca);
97 static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca);
98 
99 static int xp_cmp(const X509_PURPOSE **a, const X509_PURPOSE **b);
100 static void xptable_free(X509_PURPOSE *p);
101 
104  check_purpose_ssl_client, (char *)"SSL client", (char *)"sslclient",
105  NULL},
107  check_purpose_ssl_server, (char *)"SSL server", (char *)"sslserver",
108  NULL},
110  check_purpose_ns_ssl_server, (char *)"Netscape SSL server",
111  (char *)"nssslserver", NULL},
113  (char *)"S/MIME signing", (char *)"smimesign", NULL},
115  check_purpose_smime_encrypt, (char *)"S/MIME encryption",
116  (char *)"smimeencrypt", NULL},
118  (char *)"CRL signing", (char *)"crlsign", NULL},
119  {X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, (char *)"Any Purpose",
120  (char *)"any", NULL},
122  (char *)"OCSP helper", (char *)"ocsphelper", NULL},
124  check_purpose_timestamp_sign, (char *)"Time Stamp signing",
125  (char *)"timestampsign", NULL},
126 };
127 
128 #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
129 
130 static STACK_OF(X509_PURPOSE) *xptable = NULL;
131 
132 static int xp_cmp(const X509_PURPOSE **a, const X509_PURPOSE **b)
133 {
134  return (*a)->purpose - (*b)->purpose;
135 }
136 
137 /*
138  * As much as I'd like to make X509_check_purpose use a "const" X509* I
139  * really can't because it does recalculate hashes and do other non-const
140  * things.
141  */
142 int X509_check_purpose(X509 *x, int id, int ca)
143 {
144  int idx;
145  const X509_PURPOSE *pt;
146  if (!x509v3_cache_extensions(x)) {
147  return -1;
148  }
149 
150  if (id == -1)
151  return 1;
153  if (idx == -1)
154  return -1;
155  pt = X509_PURPOSE_get0(idx);
156  return pt->check_purpose(pt, x, ca);
157 }
158 
159 int X509_PURPOSE_set(int *p, int purpose)
160 {
161  if (X509_PURPOSE_get_by_id(purpose) == -1) {
163  return 0;
164  }
165  *p = purpose;
166  return 1;
167 }
168 
170 {
171  if (!xptable)
172  return X509_PURPOSE_COUNT;
173  return sk_X509_PURPOSE_num(xptable) + X509_PURPOSE_COUNT;
174 }
175 
177 {
178  if (idx < 0)
179  return NULL;
180  if (idx < (int)X509_PURPOSE_COUNT)
181  return xstandard + idx;
182  return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
183 }
184 
186 {
187  int i;
188  X509_PURPOSE *xptmp;
189  for (i = 0; i < X509_PURPOSE_get_count(); i++) {
190  xptmp = X509_PURPOSE_get0(i);
191  if (!strcmp(xptmp->sname, sname))
192  return i;
193  }
194  return -1;
195 }
196 
197 int X509_PURPOSE_get_by_id(int purpose)
198 {
200  size_t idx;
201 
202  if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
203  return purpose - X509_PURPOSE_MIN;
204  tmp.purpose = purpose;
205  if (!xptable)
206  return -1;
207 
208  sk_X509_PURPOSE_sort(xptable);
209  if (!sk_X509_PURPOSE_find(xptable, &idx, &tmp))
210  return -1;
211  return idx + X509_PURPOSE_COUNT;
212 }
213 
214 int X509_PURPOSE_add(int id, int trust, int flags,
215  int (*ck) (const X509_PURPOSE *, const X509 *, int),
216  char *name, char *sname, void *arg)
217 {
218  int idx;
219  X509_PURPOSE *ptmp;
220  char *name_dup, *sname_dup;
221 
222  /*
223  * This is set according to what we change: application can't set it
224  */
226  /* This will always be set for application modified trust entries */
228  /* Get existing entry if any */
230  /* Need a new entry */
231  if (idx == -1) {
232  if (!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) {
234  return 0;
235  }
236  ptmp->flags = X509_PURPOSE_DYNAMIC;
237  } else
238  ptmp = X509_PURPOSE_get0(idx);
239 
240  /* Duplicate the supplied names. */
241  name_dup = OPENSSL_strdup(name);
242  sname_dup = OPENSSL_strdup(sname);
243  if (name_dup == NULL || sname_dup == NULL) {
245  if (name_dup != NULL)
246  OPENSSL_free(name_dup);
247  if (sname_dup != NULL)
248  OPENSSL_free(sname_dup);
249  if (idx == -1)
250  OPENSSL_free(ptmp);
251  return 0;
252  }
253 
254  /* OPENSSL_free existing name if dynamic */
255  if (ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) {
256  OPENSSL_free(ptmp->name);
257  OPENSSL_free(ptmp->sname);
258  }
259  /* dup supplied name */
260  ptmp->name = name_dup;
261  ptmp->sname = sname_dup;
262  /* Keep the dynamic flag of existing entry */
263  ptmp->flags &= X509_PURPOSE_DYNAMIC;
264  /* Set all other flags */
265  ptmp->flags |= flags;
266 
267  ptmp->purpose = id;
268  ptmp->trust = trust;
269  ptmp->check_purpose = ck;
270  ptmp->usr_data = arg;
271 
272  /* If its a new entry manage the dynamic table */
273  if (idx == -1) {
274  if (!xptable && !(xptable = sk_X509_PURPOSE_new(xp_cmp))) {
276  xptable_free(ptmp);
277  return 0;
278  }
279  if (!sk_X509_PURPOSE_push(xptable, ptmp)) {
281  xptable_free(ptmp);
282  return 0;
283  }
284  }
285  return 1;
286 }
287 
289 {
290  if (!p)
291  return;
292  if (p->flags & X509_PURPOSE_DYNAMIC) {
293  if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
294  OPENSSL_free(p->name);
295  OPENSSL_free(p->sname);
296  }
297  OPENSSL_free(p);
298  }
299 }
300 
302 {
303  unsigned int i;
304  sk_X509_PURPOSE_pop_free(xptable, xptable_free);
305  for (i = 0; i < X509_PURPOSE_COUNT; i++)
307  xptable = NULL;
308 }
309 
311 {
312  return xp->purpose;
313 }
314 
316 {
317  return xp->name;
318 }
319 
321 {
322  return xp->sname;
323 }
324 
326 {
327  return xp->trust;
328 }
329 
330 static int nid_cmp(const void *void_a, const void *void_b)
331 {
332  const int *a = void_a, *b = void_b;
333 
334  return *a - *b;
335 }
336 
338 {
339  /*
340  * This table is a list of the NIDs of supported extensions: that is
341  * those which are used by the verify process. If an extension is
342  * critical and doesn't appear in this list then the verify process will
343  * normally reject the certificate. The list must be kept in numerical
344  * order because it will be searched using bsearch.
345  */
346 
347  static const int supported_nids[] = {
348  NID_netscape_cert_type, /* 71 */
349  NID_key_usage, /* 83 */
350  NID_subject_alt_name, /* 85 */
351  NID_basic_constraints, /* 87 */
352  NID_certificate_policies, /* 89 */
353  NID_ext_key_usage, /* 126 */
354  NID_policy_constraints, /* 401 */
355  NID_proxyCertInfo, /* 663 */
356  NID_name_constraints, /* 666 */
357  NID_policy_mappings, /* 747 */
358  NID_inhibit_any_policy /* 748 */
359  };
360 
362 
363  if (ex_nid == NID_undef)
364  return 0;
365 
366  if (bsearch
367  (&ex_nid, supported_nids, sizeof(supported_nids) / sizeof(int),
368  sizeof(int), nid_cmp) != NULL)
369  return 1;
370  return 0;
371 }
372 
373 static int setup_dp(X509 *x, DIST_POINT *dp)
374 {
375  X509_NAME *iname = NULL;
376  size_t i;
377  if (dp->reasons) {
378  if (dp->reasons->length > 0)
379  dp->dp_reasons = dp->reasons->data[0];
380  if (dp->reasons->length > 1)
381  dp->dp_reasons |= (dp->reasons->data[1] << 8);
383  } else
385  if (!dp->distpoint || (dp->distpoint->type != 1))
386  return 1;
387  for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) {
388  GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i);
389  if (gen->type == GEN_DIRNAME) {
390  iname = gen->d.directoryName;
391  break;
392  }
393  }
394  if (!iname)
395  iname = X509_get_issuer_name(x);
396 
397  return DIST_POINT_set_dpname(dp->distpoint, iname);
398 }
399 
400 static int setup_crldp(X509 *x)
401 {
402  int j;
403  x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, &j, NULL);
404  if (x->crldp == NULL && j != -1) {
405  return 0;
406  }
407  for (size_t i = 0; i < sk_DIST_POINT_num(x->crldp); i++) {
408  if (!setup_dp(x, sk_DIST_POINT_value(x->crldp, i))) {
409  return 0;
410  }
411  }
412  return 1;
413 }
414 
416 {
417  BASIC_CONSTRAINTS *bs;
421  EXTENDED_KEY_USAGE *extusage;
423  size_t i;
424  int j;
425 
426  CRYPTO_MUTEX_lock_read(&x->lock);
427  const int is_set = x->ex_flags & EXFLAG_SET;
428  CRYPTO_MUTEX_unlock_read(&x->lock);
429 
430  if (is_set) {
431  return (x->ex_flags & EXFLAG_INVALID) == 0;
432  }
433 
434  CRYPTO_MUTEX_lock_write(&x->lock);
435  if (x->ex_flags & EXFLAG_SET) {
437  return (x->ex_flags & EXFLAG_INVALID) == 0;
438  }
439 
440  if (!X509_digest(x, EVP_sha1(), x->sha1_hash, NULL))
441  x->ex_flags |= EXFLAG_INVALID;
442  /* V1 should mean no extensions ... */
444  x->ex_flags |= EXFLAG_V1;
445  /* Handle basic constraints */
446  if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, &j, NULL))) {
447  if (bs->ca)
448  x->ex_flags |= EXFLAG_CA;
449  if (bs->pathlen) {
450  if ((bs->pathlen->type == V_ASN1_NEG_INTEGER)
451  || !bs->ca) {
452  x->ex_flags |= EXFLAG_INVALID;
453  x->ex_pathlen = 0;
454  } else {
455  /* TODO(davidben): |ASN1_INTEGER_get| returns -1 on overflow,
456  * which currently acts as if the constraint isn't present. This
457  * works (an overflowing path length constraint may as well be
458  * infinity), but Chromium's verifier simply treats values above
459  * 255 as an error. */
460  x->ex_pathlen = ASN1_INTEGER_get(bs->pathlen);
461  }
462  } else
463  x->ex_pathlen = -1;
465  x->ex_flags |= EXFLAG_BCONS;
466  } else if (j != -1) {
467  x->ex_flags |= EXFLAG_INVALID;
468  }
469  /* Handle proxy certificates */
470  if ((pci = X509_get_ext_d2i(x, NID_proxyCertInfo, &j, NULL))) {
471  if (x->ex_flags & EXFLAG_CA
473  || X509_get_ext_by_NID(x, NID_issuer_alt_name, -1) >= 0) {
474  x->ex_flags |= EXFLAG_INVALID;
475  }
476  if (pci->pcPathLengthConstraint) {
477  x->ex_pcpathlen = ASN1_INTEGER_get(pci->pcPathLengthConstraint);
478  } else
479  x->ex_pcpathlen = -1;
481  x->ex_flags |= EXFLAG_PROXY;
482  } else if (j != -1) {
483  x->ex_flags |= EXFLAG_INVALID;
484  }
485  /* Handle key usage */
486  if ((usage = X509_get_ext_d2i(x, NID_key_usage, &j, NULL))) {
487  if (usage->length > 0) {
488  x->ex_kusage = usage->data[0];
489  if (usage->length > 1)
490  x->ex_kusage |= usage->data[1] << 8;
491  } else
492  x->ex_kusage = 0;
493  x->ex_flags |= EXFLAG_KUSAGE;
495  } else if (j != -1) {
496  x->ex_flags |= EXFLAG_INVALID;
497  }
498  x->ex_xkusage = 0;
499  if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, &j, NULL))) {
500  x->ex_flags |= EXFLAG_XKUSAGE;
501  for (i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) {
502  switch (OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage, i))) {
503  case NID_server_auth:
504  x->ex_xkusage |= XKU_SSL_SERVER;
505  break;
506 
507  case NID_client_auth:
508  x->ex_xkusage |= XKU_SSL_CLIENT;
509  break;
510 
511  case NID_email_protect:
512  x->ex_xkusage |= XKU_SMIME;
513  break;
514 
515  case NID_code_sign:
516  x->ex_xkusage |= XKU_CODE_SIGN;
517  break;
518 
519  case NID_ms_sgc:
520  case NID_ns_sgc:
521  x->ex_xkusage |= XKU_SGC;
522  break;
523 
524  case NID_OCSP_sign:
525  x->ex_xkusage |= XKU_OCSP_SIGN;
526  break;
527 
528  case NID_time_stamp:
529  x->ex_xkusage |= XKU_TIMESTAMP;
530  break;
531 
532  case NID_dvcs:
533  x->ex_xkusage |= XKU_DVCS;
534  break;
535 
537  x->ex_xkusage |= XKU_ANYEKU;
538  break;
539  }
540  }
541  sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free);
542  } else if (j != -1) {
543  x->ex_flags |= EXFLAG_INVALID;
544  }
545 
546  if ((ns = X509_get_ext_d2i(x, NID_netscape_cert_type, &j, NULL))) {
547  if (ns->length > 0)
548  x->ex_nscert = ns->data[0];
549  else
550  x->ex_nscert = 0;
551  x->ex_flags |= EXFLAG_NSCERT;
553  } else if (j != -1) {
554  x->ex_flags |= EXFLAG_INVALID;
555  }
556  x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, &j, NULL);
557  if (x->skid == NULL && j != -1) {
558  x->ex_flags |= EXFLAG_INVALID;
559  }
560  x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, &j, NULL);
561  if (x->akid == NULL && j != -1) {
562  x->ex_flags |= EXFLAG_INVALID;
563  }
564  /* Does subject name match issuer ? */
566  x->ex_flags |= EXFLAG_SI;
567  /* If SKID matches AKID also indicate self signed */
568  if (X509_check_akid(x, x->akid) == X509_V_OK &&
570  x->ex_flags |= EXFLAG_SS;
571  }
572  x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, &j, NULL);
573  if (x->altname == NULL && j != -1) {
574  x->ex_flags |= EXFLAG_INVALID;
575  }
576  x->nc = X509_get_ext_d2i(x, NID_name_constraints, &j, NULL);
577  if (x->nc == NULL && j != -1) {
578  x->ex_flags |= EXFLAG_INVALID;
579  }
580  if (!setup_crldp(x)) {
581  x->ex_flags |= EXFLAG_INVALID;
582  }
583 
584  for (j = 0; j < X509_get_ext_count(x); j++) {
585  ex = X509_get_ext(x, j);
587  == NID_freshest_crl)
588  x->ex_flags |= EXFLAG_FRESHEST;
590  continue;
592  x->ex_flags |= EXFLAG_CRITICAL;
593  break;
594  }
595  }
596  x->ex_flags |= EXFLAG_SET;
597 
599  return (x->ex_flags & EXFLAG_INVALID) == 0;
600 }
601 
602 /* check_ca returns one if |x| should be considered a CA certificate and zero
603  * otherwise. */
604 static int check_ca(const X509 *x)
605 {
606  /* keyUsage if present should allow cert signing */
608  return 0;
609  /* Version 1 certificates are considered CAs and don't have extensions. */
610  if ((x->ex_flags & V1_ROOT) == V1_ROOT) {
611  return 1;
612  }
613  /* Otherwise, it's only a CA if basicConstraints says so. */
614  return ((x->ex_flags & EXFLAG_BCONS) &&
615  (x->ex_flags & EXFLAG_CA));
616 }
617 
619 {
620  if (!x509v3_cache_extensions(x)) {
621  return 0;
622  }
623  return check_ca(x);
624 }
625 
626 static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x,
627  int ca)
628 {
630  return 0;
631  if (ca)
632  return check_ca(x);
633  /* We need to do digital signatures or key agreement */
635  return 0;
636  /* nsCertType if present should allow SSL client use */
637  if (ns_reject(x, NS_SSL_CLIENT))
638  return 0;
639  return 1;
640 }
641 
642 /*
643  * Key usage needed for TLS/SSL server: digital signature, encipherment or
644  * key agreement. The ssl code can check this more thoroughly for individual
645  * key types.
646  */
647 #define KU_TLS \
648  (KU_DIGITAL_SIGNATURE|KU_KEY_ENCIPHERMENT|KU_KEY_AGREEMENT)
649 
650 static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x,
651  int ca)
652 {
654  return 0;
655  if (ca)
656  return check_ca(x);
657 
658  if (ns_reject(x, NS_SSL_SERVER))
659  return 0;
660  if (ku_reject(x, KU_TLS))
661  return 0;
662 
663  return 1;
664 
665 }
666 
667 static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x,
668  int ca)
669 {
670  int ret;
671  ret = check_purpose_ssl_server(xp, x, ca);
672  if (!ret || ca)
673  return ret;
674  /* We need to encipher or Netscape complains */
676  return 0;
677  return ret;
678 }
679 
680 /* purpose_smime returns one if |x| is a valid S/MIME leaf (|ca| is zero) or CA
681  * (|ca| is one) certificate, and zero otherwise. */
682 static int purpose_smime(const X509 *x, int ca)
683 {
684  if (xku_reject(x, XKU_SMIME))
685  return 0;
686  if (ca) {
687  /* check nsCertType if present */
688  if ((x->ex_flags & EXFLAG_NSCERT) &&
689  (x->ex_nscert & NS_SMIME_CA) == 0) {
690  return 0;
691  }
692 
693  return check_ca(x);
694  }
695  if (x->ex_flags & EXFLAG_NSCERT) {
696  return (x->ex_nscert & NS_SMIME) == NS_SMIME;
697  }
698  return 1;
699 }
700 
701 static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x,
702  int ca)
703 {
704  int ret;
705  ret = purpose_smime(x, ca);
706  if (!ret || ca)
707  return ret;
709  return 0;
710  return ret;
711 }
712 
713 static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x,
714  int ca)
715 {
716  int ret;
717  ret = purpose_smime(x, ca);
718  if (!ret || ca)
719  return ret;
721  return 0;
722  return ret;
723 }
724 
725 static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x,
726  int ca)
727 {
728  if (ca) {
729  return check_ca(x);
730  }
731  if (ku_reject(x, KU_CRL_SIGN))
732  return 0;
733  return 1;
734 }
735 
736 /*
737  * OCSP helper: this is *not* a full OCSP check. It just checks that each CA
738  * is valid. Additional checks must be made on the chain.
739  */
740 
741 static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca)
742 {
743  if (ca)
744  return check_ca(x);
745  /* leaf certificate is checked in OCSP_verify() */
746  return 1;
747 }
748 
749 static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x,
750  int ca)
751 {
752  int i_ext;
753 
754  /* If ca is true we must return if this is a valid CA certificate. */
755  if (ca)
756  return check_ca(x);
757 
758  /*
759  * Check the optional key usage field:
760  * if Key Usage is present, it must be one of digitalSignature
761  * and/or nonRepudiation (other values are not consistent and shall
762  * be rejected).
763  */
764  if ((x->ex_flags & EXFLAG_KUSAGE)
765  && ((x->ex_kusage & ~(KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE)) ||
766  !(x->ex_kusage & (KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE))))
767  return 0;
768 
769  /* Only time stamp key usage is permitted and it's required. */
770  if (!(x->ex_flags & EXFLAG_XKUSAGE) || x->ex_xkusage != XKU_TIMESTAMP)
771  return 0;
772 
773  /* Extended Key Usage MUST be critical */
774  i_ext = X509_get_ext_by_NID((X509 *)x, NID_ext_key_usage, -1);
775  if (i_ext >= 0) {
776  X509_EXTENSION *ext = X509_get_ext((X509 *)x, i_ext);
778  return 0;
779  }
780 
781  return 1;
782 }
783 
784 static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca)
785 {
786  return 1;
787 }
788 
789 /*
790  * Various checks to see if one certificate issued the second. This can be
791  * used to prune a set of possible issuer certificates which have been looked
792  * up using some simple method such as by subject name. These are: 1. Check
793  * issuer_name(subject) == subject_name(issuer) 2. If akid(subject) exists
794  * check it matches issuer 3. If key_usage(issuer) exists check it supports
795  * certificate signing returns 0 for OK, positive for reason for mismatch,
796  * reasons match codes for X509_verify_cert()
797  */
798 
799 int X509_check_issued(X509 *issuer, X509 *subject)
800 {
802  X509_get_issuer_name(subject)))
804  if (!x509v3_cache_extensions(issuer) ||
805  !x509v3_cache_extensions(subject)) {
806  return X509_V_ERR_UNSPECIFIED;
807  }
808 
809  if (subject->akid) {
810  int ret = X509_check_akid(issuer, subject->akid);
811  if (ret != X509_V_OK)
812  return ret;
813  }
814 
815  if (subject->ex_flags & EXFLAG_PROXY) {
816  if (ku_reject(issuer, KU_DIGITAL_SIGNATURE))
818  } else if (ku_reject(issuer, KU_KEY_CERT_SIGN))
820  return X509_V_OK;
821 }
822 
824 {
825 
826  if (!akid)
827  return X509_V_OK;
828 
829  /* Check key ids (if present) */
830  if (akid->keyid && issuer->skid &&
831  ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid))
833  /* Check serial number */
834  if (akid->serial &&
837  /* Check issuer name */
838  if (akid->issuer) {
839  /*
840  * Ugh, for some peculiar reason AKID includes SEQUENCE OF
841  * GeneralName. So look for a DirName. There may be more than one but
842  * we only take any notice of the first.
843  */
844  GENERAL_NAMES *gens;
845  GENERAL_NAME *gen;
846  X509_NAME *nm = NULL;
847  size_t i;
848  gens = akid->issuer;
849  for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
850  gen = sk_GENERAL_NAME_value(gens, i);
851  if (gen->type == GEN_DIRNAME) {
852  nm = gen->d.dirn;
853  break;
854  }
855  }
856  if (nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer)))
858  }
859  return X509_V_OK;
860 }
861 
863 {
864  /* Ignore the return value. On failure, |x->ex_flags| will include
865  * |EXFLAG_INVALID|. */
867  return x->ex_flags;
868 }
869 
871 {
872  if (!x509v3_cache_extensions(x)) {
873  return 0;
874  }
875  if (x->ex_flags & EXFLAG_KUSAGE)
876  return x->ex_kusage;
877  return UINT32_MAX;
878 }
879 
881 {
882  if (!x509v3_cache_extensions(x)) {
883  return 0;
884  }
885  if (x->ex_flags & EXFLAG_XKUSAGE)
886  return x->ex_xkusage;
887  return UINT32_MAX;
888 }
889 
891 {
892  if (!x509v3_cache_extensions(x509)) {
893  return NULL;
894  }
895  return x509->skid;
896 }
897 
899 {
900  if (!x509v3_cache_extensions(x509)) {
901  return NULL;
902  }
903  return x509->akid != NULL ? x509->akid->keyid : NULL;
904 }
905 
906 const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x509)
907 {
908  if (!x509v3_cache_extensions(x509)) {
909  return NULL;
910  }
911  return x509->akid != NULL ? x509->akid->issuer : NULL;
912 }
913 
915 {
916  if (!x509v3_cache_extensions(x509)) {
917  return NULL;
918  }
919  return x509->akid != NULL ? x509->akid->serial : NULL;
920 }
921 
923 {
924  if (!x509v3_cache_extensions(x509) ||
925  (x509->ex_flags & EXFLAG_BCONS) == 0) {
926  return -1;
927  }
928  return x509->ex_pathlen;
929 }
NID_server_auth
#define NID_server_auth
Definition: nid.h:662
NID_freshest_crl
#define NID_freshest_crl
Definition: nid.h:3809
BASIC_CONSTRAINTS_st
Definition: x509v3.h:157
NID_policy_mappings
#define NID_policy_mappings
Definition: nid.h:3298
XKU_TIMESTAMP
#define XKU_TIMESTAMP
Definition: x509v3.h:431
ASN1_OCTET_STRING_cmp
#define ASN1_OCTET_STRING_cmp
Definition: boringssl_prefix_symbols.h:658
GENERAL_NAME_st::type
int type
Definition: x509v3.h:184
x509_purpose_st::purpose
int purpose
Definition: x509v3.h:439
x509_purpose_st::sname
char * sname
Definition: x509v3.h:444
X509_get_subject_name
#define X509_get_subject_name
Definition: boringssl_prefix_symbols.h:2672
PROXY_CERT_INFO_EXTENSION_st::pcPathLengthConstraint
ASN1_INTEGER * pcPathLengthConstraint
Definition: x509v3.h:327
X509_PURPOSE_SSL_CLIENT
#define X509_PURPOSE_SSL_CLIENT
Definition: x509v3.h:448
X509_PURPOSE_set
int X509_PURPOSE_set(int *p, int purpose)
Definition: v3_purp.c:159
purpose_smime
static int purpose_smime(const X509 *x, int ca)
Definition: v3_purp.c:682
BASIC_CONSTRAINTS_st::pathlen
ASN1_INTEGER * pathlen
Definition: x509v3.h:159
ns_reject
#define ns_reject(x, usage)
Definition: v3_purp.c:78
GENERAL_NAME_st
Definition: x509v3.h:173
X509_V_ERR_AKID_SKID_MISMATCH
#define X509_V_ERR_AKID_SKID_MISMATCH
Definition: x509.h:1950
EXFLAG_BCONS
#define EXFLAG_BCONS
Definition: x509v3.h:387
NID_issuer_alt_name
#define NID_issuer_alt_name
Definition: nid.h:479
X509_digest
#define X509_digest
Definition: boringssl_prefix_symbols.h:2627
check_purpose_smime_sign
static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:701
X509_PURPOSE_cleanup
void X509_PURPOSE_cleanup(void)
Definition: v3_purp.c:301
X509_get_key_usage
uint32_t X509_get_key_usage(X509 *x)
Definition: v3_purp.c:870
NID_anyExtendedKeyUsage
#define NID_anyExtendedKeyUsage
Definition: nid.h:4029
GENERAL_NAME_st::directoryName
X509_NAME * directoryName
Definition: x509v3.h:191
DIST_POINT_st::CRLissuer
GENERAL_NAMES * CRLissuer
Definition: x509v3.h:249
X509_get0_authority_serial
const ASN1_INTEGER * X509_get0_authority_serial(X509 *x509)
Definition: v3_purp.c:914
STACK_OF
static STACK_OF(X509_PURPOSE)
Definition: v3_purp.c:130
X509_TRUST_SSL_SERVER
#define X509_TRUST_SSL_SERVER
Definition: x509.h:163
nid_cmp
static int nid_cmp(const void *void_a, const void *void_b)
Definition: v3_purp.c:330
X509_PURPOSE_SMIME_SIGN
#define X509_PURPOSE_SMIME_SIGN
Definition: x509v3.h:451
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
internal.h
ext
void * ext
Definition: x509v3.h:87
NID_authority_key_identifier
#define NID_authority_key_identifier
Definition: nid.h:499
ASN1_INTEGER_get
#define ASN1_INTEGER_get
Definition: boringssl_prefix_symbols.h:645
NID_dvcs
#define NID_dvcs
Definition: nid.h:1419
string.h
x509_st::ex_pathlen
long ex_pathlen
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:146
XKU_ANYEKU
#define XKU_ANYEKU
Definition: x509v3.h:433
CRYPTO_MUTEX_unlock_read
#define CRYPTO_MUTEX_unlock_read
Definition: boringssl_prefix_symbols.h:1127
X509_TRUST_DEFAULT
#define X509_TRUST_DEFAULT
Definition: x509.h:159
PROXY_CERT_INFO_EXTENSION_free
#define PROXY_CERT_INFO_EXTENSION_free
Definition: boringssl_prefix_symbols.h:2051
x509v3.h
UINT32_MAX
#define UINT32_MAX
Definition: stdint-msvc2008.h:142
EXFLAG_FRESHEST
#define EXFLAG_FRESHEST
Definition: x509v3.h:402
EXFLAG_CA
#define EXFLAG_CA
Definition: x509v3.h:392
X509_PURPOSE_get0_name
char * X509_PURPOSE_get0_name(const X509_PURPOSE *xp)
Definition: v3_purp.c:315
xstandard
static X509_PURPOSE xstandard[]
Definition: v3_purp.c:102
setup_crldp
static int setup_crldp(X509 *x)
Definition: v3_purp.c:400
X509_check_akid
int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid)
Definition: v3_purp.c:823
NID_key_usage
#define NID_key_usage
Definition: nid.h:464
X509_TRUST_TSA
#define X509_TRUST_TSA
Definition: x509.h:168
setup.name
name
Definition: setup.py:542
XKU_OCSP_SIGN
#define XKU_OCSP_SIGN
Definition: x509v3.h:430
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
xds_manager.p
p
Definition: xds_manager.py:60
X509_V_OK
#define X509_V_OK
Definition: x509.h:1918
X509_get_ext
#define X509_get_ext
Definition: boringssl_prefix_symbols.h:2656
X509_extension_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:117
X509_NAME_cmp
#define X509_NAME_cmp
Definition: boringssl_prefix_symbols.h:2376
XKU_SSL_SERVER
#define XKU_SSL_SERVER
Definition: x509v3.h:425
NS_SSL_CLIENT
#define NS_SSL_CLIENT
Definition: x509v3.h:416
ex
OPENSSL_EXPORT X509_EXTENSION * ex
Definition: x509.h:1418
DIST_POINT_st
Definition: x509v3.h:246
asn1_string_st::data
unsigned char * data
Definition: asn1.h:546
check_purpose_smime_encrypt
static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:713
X509_PURPOSE_ANY
#define X509_PURPOSE_ANY
Definition: x509v3.h:454
x509_st::skid
ASN1_OCTET_STRING * skid
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:152
X509_PURPOSE_MIN
#define X509_PURPOSE_MIN
Definition: x509v3.h:458
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
X509_PURPOSE_DYNAMIC_NAME
#define X509_PURPOSE_DYNAMIC_NAME
Definition: x509v3.h:436
OPENSSL_malloc
#define OPENSSL_malloc
Definition: boringssl_prefix_symbols.h:1885
X509_V_ERR_KEYUSAGE_NO_CERTSIGN
#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN
Definition: x509.h:1952
EXFLAG_SI
#define EXFLAG_SI
Definition: x509v3.h:394
EXFLAG_SS
#define EXFLAG_SS
Definition: x509v3.h:404
GENERAL_NAME_st::dirn
X509_NAME * dirn
Definition: x509v3.h:199
X509_V_ERR_UNSPECIFIED
#define X509_V_ERR_UNSPECIFIED
Definition: x509.h:1919
x509_purpose_st::check_purpose
int(* check_purpose)(const struct x509_purpose_st *, const X509 *, int)
Definition: x509v3.h:442
NS_SMIME_CA
#define NS_SMIME_CA
Definition: x509v3.h:421
OBJ_obj2nid
#define OBJ_obj2nid
Definition: boringssl_prefix_symbols.h:1857
EXFLAG_SET
#define EXFLAG_SET
Definition: x509v3.h:397
X509_get0_authority_key_id
const ASN1_OCTET_STRING * X509_get0_authority_key_id(X509 *x509)
Definition: v3_purp.c:898
X509_PURPOSE_get_count
int X509_PURPOSE_get_count(void)
Definition: v3_purp.c:169
XKU_DVCS
#define XKU_DVCS
Definition: x509v3.h:432
NID_name_constraints
#define NID_name_constraints
Definition: nid.h:2963
X509_get_issuer_name
#define X509_get_issuer_name
Definition: boringssl_prefix_symbols.h:2664
check_purpose_crl_sign
static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:725
asn1_string_st::length
int length
Definition: asn1.h:544
X509_get_ext_count
#define X509_get_ext_count
Definition: boringssl_prefix_symbols.h:2660
BASIC_CONSTRAINTS_st::ca
int ca
Definition: x509v3.h:158
NID_subject_key_identifier
#define NID_subject_key_identifier
Definition: nid.h:459
NID_crl_distribution_points
#define NID_crl_distribution_points
Definition: nid.h:554
X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
Definition: x509.h:1951
check_purpose_ssl_client
static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:626
X509_EXTENSION_get_object
#define X509_EXTENSION_get_object
Definition: boringssl_prefix_symbols.h:2339
X509_PURPOSE_NS_SSL_SERVER
#define X509_PURPOSE_NS_SSL_SERVER
Definition: x509v3.h:450
X509_PURPOSE_SSL_SERVER
#define X509_PURPOSE_SSL_SERVER
Definition: x509v3.h:449
KU_KEY_ENCIPHERMENT
#define KU_KEY_ENCIPHERMENT
Definition: x509v3.h:408
V1_ROOT
#define V1_ROOT
Definition: v3_purp.c:73
X509_get_extended_key_usage
uint32_t X509_get_extended_key_usage(X509 *x)
Definition: v3_purp.c:880
AUTHORITY_KEYID_st
Definition: x509v3.h:257
X509_V_ERR_SUBJECT_ISSUER_MISMATCH
#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH
Definition: x509.h:1949
EXFLAG_KUSAGE
#define EXFLAG_KUSAGE
Definition: x509v3.h:388
x509_purpose_st
Definition: x509v3.h:438
x509_purpose_st::name
char * name
Definition: x509v3.h:443
XKU_SMIME
#define XKU_SMIME
Definition: x509v3.h:427
NID_email_protect
#define NID_email_protect
Definition: nid.h:677
err.h
no_check
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:784
ku_reject
#define ku_reject(x, usage)
Definition: v3_purp.c:74
arg
Definition: cmdline.cc:40
NID_inhibit_any_policy
#define NID_inhibit_any_policy
Definition: nid.h:3303
x509v3_cache_extensions
int x509v3_cache_extensions(X509 *x)
Definition: v3_purp.c:415
X509_check_purpose
int X509_check_purpose(X509 *x, int id, int ca)
Definition: v3_purp.c:142
X509_PURPOSE_get0_sname
char * X509_PURPOSE_get0_sname(const X509_PURPOSE *xp)
Definition: v3_purp.c:320
ASN1_OBJECT_free
#define ASN1_OBJECT_free
Definition: boringssl_prefix_symbols.h:655
NID_undef
#define NID_undef
Definition: nid.h:85
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
X509_get0_authority_issuer
const GENERAL_NAMES * X509_get0_authority_issuer(X509 *x509)
Definition: v3_purp.c:906
check_ca
static int check_ca(const X509 *x)
Definition: v3_purp.c:604
DIST_POINT_st::distpoint
DIST_POINT_NAME * distpoint
Definition: x509v3.h:247
gen
OPENSSL_EXPORT GENERAL_NAME * gen
Definition: x509v3.h:495
xp_cmp
static int xp_cmp(const X509_PURPOSE **a, const X509_PURPOSE **b)
EXFLAG_INVALID
#define EXFLAG_INVALID
Definition: x509v3.h:396
x509_st::ex_flags
unsigned long ex_flags
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:148
check_purpose_ssl_server
static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:650
ocsp_helper
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:741
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
NID_code_sign
#define NID_code_sign
Definition: nid.h:672
PROXY_CERT_INFO_EXTENSION_st
Definition: x509v3.h:326
DIST_POINT_NAME_st::type
int type
Definition: x509v3.h:223
EXFLAG_XKUSAGE
#define EXFLAG_XKUSAGE
Definition: x509v3.h:389
NS_SMIME
#define NS_SMIME
Definition: x509v3.h:418
DIST_POINT_st::dp_reasons
int dp_reasons
Definition: x509v3.h:250
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
X509_check_issued
int X509_check_issued(X509 *issuer, X509 *subject)
Definition: v3_purp.c:799
AUTHORITY_KEYID_st::issuer
GENERAL_NAMES * issuer
Definition: x509v3.h:259
X509_PURPOSE_get_trust
int X509_PURPOSE_get_trust(const X509_PURPOSE *xp)
Definition: v3_purp.c:325
EXFLAG_CRITICAL
#define EXFLAG_CRITICAL
Definition: x509v3.h:398
X509_VERSION_1
#define X509_VERSION_1
Definition: x509.h:321
CRYPTO_MUTEX_lock_read
#define CRYPTO_MUTEX_lock_read
Definition: boringssl_prefix_symbols.h:1125
X509_PURPOSE_get0
X509_PURPOSE * X509_PURPOSE_get0(int idx)
Definition: v3_purp.c:176
X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE
#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE
Definition: x509.h:1960
DIST_POINT_st::reasons
ASN1_BIT_STRING * reasons
Definition: x509v3.h:248
NID_policy_constraints
#define NID_policy_constraints
Definition: nid.h:1859
X509_get_extension_flags
uint32_t X509_get_extension_flags(X509 *x)
Definition: v3_purp.c:862
CRLDP_ALL_REASONS
#define CRLDP_ALL_REASONS
Definition: x509v3.h:232
digest.h
EXFLAG_NSCERT
#define EXFLAG_NSCERT
Definition: x509v3.h:390
bloaty::usage
const char usage[]
Definition: bloaty.cc:1843
X509_PURPOSE_COUNT
#define X509_PURPOSE_COUNT
Definition: v3_purp.c:128
x509_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:139
GENERAL_NAME_st::d
union GENERAL_NAME_st::@370 d
x509_purpose_st::flags
int flags
Definition: x509v3.h:441
X509_PURPOSE_OCSP_HELPER
#define X509_PURPOSE_OCSP_HELPER
Definition: x509v3.h:455
OPENSSL_strdup
#define OPENSSL_strdup
Definition: boringssl_prefix_symbols.h:1891
X509_PURPOSE_CRL_SIGN
#define X509_PURPOSE_CRL_SIGN
Definition: x509v3.h:453
absl::flags_internal
Definition: abseil-cpp/absl/flags/commandlineflag.h:40
XKU_SGC
#define XKU_SGC
Definition: x509v3.h:429
X509_check_ca
int X509_check_ca(X509 *x)
Definition: v3_purp.c:618
AUTHORITY_KEYID_st::serial
ASN1_INTEGER * serial
Definition: x509v3.h:260
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
X509V3_R_INVALID_PURPOSE
#define X509V3_R_INVALID_PURPOSE
Definition: x509v3.h:987
NID_ms_sgc
#define NID_ms_sgc
Definition: nid.h:702
X509_supported_extension
int X509_supported_extension(X509_EXTENSION *ex)
Definition: v3_purp.c:337
NID_ext_key_usage
#define NID_ext_key_usage
Definition: nid.h:649
XKU_CODE_SIGN
#define XKU_CODE_SIGN
Definition: x509v3.h:428
X509_get_version
#define X509_get_version
Definition: boringssl_prefix_symbols.h:2673
CRYPTO_MUTEX_lock_write
#define CRYPTO_MUTEX_lock_write
Definition: boringssl_prefix_symbols.h:1126
check_purpose_ns_ssl_server
static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:667
BASIC_CONSTRAINTS_free
#define BASIC_CONSTRAINTS_free
Definition: boringssl_prefix_symbols.h:771
NS_SSL_SERVER
#define NS_SSL_SERVER
Definition: x509v3.h:417
X509_PURPOSE_get_id
int X509_PURPOSE_get_id(const X509_PURPOSE *xp)
Definition: v3_purp.c:310
KU_KEY_AGREEMENT
#define KU_KEY_AGREEMENT
Definition: x509v3.h:410
AUTHORITY_KEYID_st::keyid
ASN1_OCTET_STRING * keyid
Definition: x509v3.h:258
arg
struct arg arg
xptable_free
static void xptable_free(X509_PURPOSE *p)
Definition: v3_purp.c:288
EVP_sha1
const OPENSSL_EXPORT EVP_MD * EVP_sha1(void)
check_purpose_timestamp_sign
static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:749
X509_TRUST_EMAIL
#define X509_TRUST_EMAIL
Definition: x509.h:164
NID_client_auth
#define NID_client_auth
Definition: nid.h:667
NID_subject_alt_name
#define NID_subject_alt_name
Definition: nid.h:474
KU_DIGITAL_SIGNATURE
#define KU_DIGITAL_SIGNATURE
Definition: x509v3.h:406
X509_PURPOSE_get_by_id
int X509_PURPOSE_get_by_id(int purpose)
Definition: v3_purp.c:197
asn1_string_st::type
int type
Definition: asn1.h:545
X509_get_ext_d2i
#define X509_get_ext_d2i
Definition: boringssl_prefix_symbols.h:2661
X509_PURPOSE_add
int X509_PURPOSE_add(int id, int trust, int flags, int(*ck)(const X509_PURPOSE *, const X509 *, int), char *name, char *sname, void *arg)
Definition: v3_purp.c:214
X509_get0_subject_key_id
const ASN1_OCTET_STRING * X509_get0_subject_key_id(X509 *x509)
Definition: v3_purp.c:890
obj.h
X509_get_serialNumber
#define X509_get_serialNumber
Definition: boringssl_prefix_symbols.h:2670
ns
static int64_t ns
Definition: bloaty/third_party/re2/util/benchmark.cc:43
X509_PURPOSE_TIMESTAMP_SIGN
#define X509_PURPOSE_TIMESTAMP_SIGN
Definition: x509v3.h:456
X509_PURPOSE_DYNAMIC
#define X509_PURPOSE_DYNAMIC
Definition: x509v3.h:435
NID_proxyCertInfo
#define NID_proxyCertInfo
Definition: nid.h:2948
X509_PURPOSE_SMIME_ENCRYPT
#define X509_PURPOSE_SMIME_ENCRYPT
Definition: x509v3.h:452
NID_netscape_cert_type
#define NID_netscape_cert_type
Definition: nid.h:406
XKU_SSL_CLIENT
#define XKU_SSL_CLIENT
Definition: x509v3.h:426
ASN1_BIT_STRING_free
OPENSSL_EXPORT void ASN1_BIT_STRING_free(ASN1_BIT_STRING *str)
flags
uint32_t flags
Definition: retry_filter.cc:632
mem.h
EXFLAG_V1
#define EXFLAG_V1
Definition: x509v3.h:395
autogen_x86imm.tmp
tmp
Definition: autogen_x86imm.py:12
DIST_POINT_set_dpname
#define DIST_POINT_set_dpname
Definition: boringssl_prefix_symbols.h:1257
setup_dp
static int setup_dp(X509 *x, DIST_POINT *dp)
Definition: v3_purp.c:373
X509_PURPOSE_MAX
#define X509_PURPOSE_MAX
Definition: x509v3.h:459
X509_TRUST_COMPAT
#define X509_TRUST_COMPAT
Definition: x509.h:161
X509_TRUST_SSL_CLIENT
#define X509_TRUST_SSL_CLIENT
Definition: x509.h:162
X509_EXTENSION_get_critical
#define X509_EXTENSION_get_critical
Definition: boringssl_prefix_symbols.h:2337
ASN1_INTEGER_cmp
#define ASN1_INTEGER_cmp
Definition: boringssl_prefix_symbols.h:642
NID_OCSP_sign
#define NID_OCSP_sign
Definition: nid.h:902
x509_purpose_st::trust
int trust
Definition: x509v3.h:440
thread.h
NID_time_stamp
#define NID_time_stamp
Definition: nid.h:682
KU_CRL_SIGN
#define KU_CRL_SIGN
Definition: x509v3.h:412
OPENSSL_free
#define OPENSSL_free
Definition: boringssl_prefix_symbols.h:1869
GEN_DIRNAME
#define GEN_DIRNAME
Definition: x509v3.h:178
NID_certificate_policies
#define NID_certificate_policies
Definition: nid.h:494
CRYPTO_MUTEX_unlock_write
#define CRYPTO_MUTEX_unlock_write
Definition: boringssl_prefix_symbols.h:1128
NID_ns_sgc
#define NID_ns_sgc
Definition: nid.h:712
x509_st::akid
AUTHORITY_KEYID * akid
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:153
V_ASN1_NEG_INTEGER
#define V_ASN1_NEG_INTEGER
Definition: asn1.h:156
X509_name_st
Definition: third_party/boringssl-with-bazel/src/crypto/x509/internal.h:95
X509_get_pathlen
long X509_get_pathlen(X509 *x509)
Definition: v3_purp.c:922
KU_KEY_CERT_SIGN
#define KU_KEY_CERT_SIGN
Definition: x509v3.h:411
NID_basic_constraints
#define NID_basic_constraints
Definition: nid.h:484
asn1_string_st
Definition: asn1.h:543
EXFLAG_PROXY
#define EXFLAG_PROXY
Definition: x509v3.h:399
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
ERR_R_MALLOC_FAILURE
#define ERR_R_MALLOC_FAILURE
Definition: err.h:371
xku_reject
#define xku_reject(x, usage)
Definition: v3_purp.c:76
KU_NON_REPUDIATION
#define KU_NON_REPUDIATION
Definition: x509v3.h:407
X509_PURPOSE_get_by_sname
int X509_PURPOSE_get_by_sname(char *sname)
Definition: v3_purp.c:185
id
uint32_t id
Definition: flow_control_fuzzer.cc:70
x509_purpose_st::usr_data
void * usr_data
Definition: x509v3.h:445
KU_TLS
#define KU_TLS
Definition: v3_purp.c:647
X509_get_ext_by_NID
#define X509_get_ext_by_NID
Definition: boringssl_prefix_symbols.h:2657


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:50