• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
2  * project 1999. */
3 /* ====================================================================
4  * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *
18  * 3. All advertising materials mentioning features or use of this
19  *    software must display the following acknowledgment:
20  *    "This product includes software developed by the OpenSSL Project
21  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
22  *
23  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
24  *    endorse or promote products derived from this software without
25  *    prior written permission. For written permission, please contact
26  *    licensing@OpenSSL.org.
27  *
28  * 5. Products derived from this software may not be called "OpenSSL"
29  *    nor may "OpenSSL" appear in their names without prior written
30  *    permission of the OpenSSL Project.
31  *
32  * 6. Redistributions of any form whatsoever must retain the following
33  *    acknowledgment:
34  *    "This product includes software developed by the OpenSSL Project
35  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
36  *
37  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
38  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
41  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
44  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
46  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
48  * OF THE POSSIBILITY OF SUCH DAMAGE.
49  * ====================================================================
50  *
51  * This product includes cryptographic software written by Eric Young
52  * (eay@cryptsoft.com).  This product includes software written by Tim
53  * Hudson (tjh@cryptsoft.com). */
54 
55 #ifndef HEADER_X509V3_H
56 #define HEADER_X509V3_H
57 
58 #include <openssl/bio.h>
59 #include <openssl/conf.h>
60 #include <openssl/lhash.h>
61 #include <openssl/x509.h>
62 
63 #if defined(__cplusplus)
64 extern "C" {
65 #endif
66 
67 
68 // Legacy X.509 library.
69 //
70 // This header is part of OpenSSL's X.509 implementation. It is retained for
71 // compatibility but otherwise underdocumented and not actively maintained. In
72 // the future, a replacement library will be available. Meanwhile, minimize
73 // dependencies on this header where possible.
74 
75 
76 // Forward reference
77 struct v3_ext_method;
78 struct v3_ext_ctx;
79 
80 // Useful typedefs
81 
82 typedef void *(*X509V3_EXT_NEW)(void);
83 typedef void (*X509V3_EXT_FREE)(void *);
84 typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long);
85 typedef int (*X509V3_EXT_I2D)(void *, unsigned char **);
86 typedef STACK_OF(CONF_VALUE) *(*X509V3_EXT_I2V)(
87     const struct v3_ext_method *method, void *ext,
88     STACK_OF(CONF_VALUE) *extlist);
89 typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method,
90                                 struct v3_ext_ctx *ctx,
91                                 STACK_OF(CONF_VALUE) *values);
92 typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, void *ext);
93 typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method,
94                                 struct v3_ext_ctx *ctx, const char *str);
95 typedef int (*X509V3_EXT_I2R)(const struct v3_ext_method *method, void *ext,
96                               BIO *out, int indent);
97 typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method,
98                                 struct v3_ext_ctx *ctx, const char *str);
99 
100 // V3 extension structure
101 
102 struct v3_ext_method {
103   int ext_nid;
104   int ext_flags;
105   // If this is set the following four fields are ignored
106   ASN1_ITEM_EXP *it;
107   // Old style ASN1 calls
108   X509V3_EXT_NEW ext_new;
109   X509V3_EXT_FREE ext_free;
110   X509V3_EXT_D2I d2i;
111   X509V3_EXT_I2D i2d;
112 
113   // The following pair is used for string extensions
114   X509V3_EXT_I2S i2s;
115   X509V3_EXT_S2I s2i;
116 
117   // The following pair is used for multi-valued extensions
118   X509V3_EXT_I2V i2v;
119   X509V3_EXT_V2I v2i;
120 
121   // The following are used for raw extensions
122   X509V3_EXT_I2R i2r;
123   X509V3_EXT_R2I r2i;
124 
125   void *usr_data;  // Any extension specific data
126 };
127 
128 typedef struct X509V3_CONF_METHOD_st {
129   char *(*get_string)(void *db, const char *section, const char *value);
130   STACK_OF(CONF_VALUE) *(*get_section)(void *db, const char *section);
131   void (*free_string)(void *db, char *string);
132   void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section);
133 } X509V3_CONF_METHOD;
134 
135 // Context specific info
136 struct v3_ext_ctx {
137 #define CTX_TEST 0x1
138   int flags;
139   X509 *issuer_cert;
140   X509 *subject_cert;
141   X509_REQ *subject_req;
142   X509_CRL *crl;
143   const X509V3_CONF_METHOD *db_meth;
144   void *db;
145   // Maybe more here
146 };
147 
148 typedef struct v3_ext_method X509V3_EXT_METHOD;
149 
150 DEFINE_STACK_OF(X509V3_EXT_METHOD)
151 
152 // ext_flags values
153 #define X509V3_EXT_DYNAMIC 0x1
154 #define X509V3_EXT_CTX_DEP 0x2
155 #define X509V3_EXT_MULTILINE 0x4
156 
157 struct BASIC_CONSTRAINTS_st {
158   int ca;
159   ASN1_INTEGER *pathlen;
160 };
161 
162 
163 typedef struct otherName_st {
164   ASN1_OBJECT *type_id;
165   ASN1_TYPE *value;
166 } OTHERNAME;
167 
168 typedef struct EDIPartyName_st {
169   ASN1_STRING *nameAssigner;
170   ASN1_STRING *partyName;
171 } EDIPARTYNAME;
172 
173 typedef struct GENERAL_NAME_st {
174 #define GEN_OTHERNAME 0
175 #define GEN_EMAIL 1
176 #define GEN_DNS 2
177 #define GEN_X400 3
178 #define GEN_DIRNAME 4
179 #define GEN_EDIPARTY 5
180 #define GEN_URI 6
181 #define GEN_IPADD 7
182 #define GEN_RID 8
183 
184   int type;
185   union {
186     char *ptr;
187     OTHERNAME *otherName;  // otherName
188     ASN1_IA5STRING *rfc822Name;
189     ASN1_IA5STRING *dNSName;
190     ASN1_TYPE *x400Address;
191     X509_NAME *directoryName;
192     EDIPARTYNAME *ediPartyName;
193     ASN1_IA5STRING *uniformResourceIdentifier;
194     ASN1_OCTET_STRING *iPAddress;
195     ASN1_OBJECT *registeredID;
196 
197     // Old names
198     ASN1_OCTET_STRING *ip;  // iPAddress
199     X509_NAME *dirn;        // dirn
200     ASN1_IA5STRING *ia5;    // rfc822Name, dNSName, uniformResourceIdentifier
201     ASN1_OBJECT *rid;       // registeredID
202     ASN1_TYPE *other;       // x400Address
203   } d;
204 } GENERAL_NAME;
205 
206 DEFINE_STACK_OF(GENERAL_NAME)
207 
208 typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
209 
210 DEFINE_STACK_OF(GENERAL_NAMES)
211 
212 typedef struct ACCESS_DESCRIPTION_st {
213   ASN1_OBJECT *method;
214   GENERAL_NAME *location;
215 } ACCESS_DESCRIPTION;
216 
217 DEFINE_STACK_OF(ACCESS_DESCRIPTION)
218 
219 typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
220 
221 typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;
222 
223 typedef struct DIST_POINT_NAME_st {
224   int type;
225   union {
226     GENERAL_NAMES *fullname;
227     STACK_OF(X509_NAME_ENTRY) *relativename;
228   } name;
229   // If relativename then this contains the full distribution point name
230   X509_NAME *dpname;
231 } DIST_POINT_NAME;
232 // All existing reasons
233 #define CRLDP_ALL_REASONS 0x807f
234 
235 #define CRL_REASON_NONE (-1)
236 #define CRL_REASON_UNSPECIFIED 0
237 #define CRL_REASON_KEY_COMPROMISE 1
238 #define CRL_REASON_CA_COMPROMISE 2
239 #define CRL_REASON_AFFILIATION_CHANGED 3
240 #define CRL_REASON_SUPERSEDED 4
241 #define CRL_REASON_CESSATION_OF_OPERATION 5
242 #define CRL_REASON_CERTIFICATE_HOLD 6
243 #define CRL_REASON_REMOVE_FROM_CRL 8
244 #define CRL_REASON_PRIVILEGE_WITHDRAWN 9
245 #define CRL_REASON_AA_COMPROMISE 10
246 
247 struct DIST_POINT_st {
248   DIST_POINT_NAME *distpoint;
249   ASN1_BIT_STRING *reasons;
250   GENERAL_NAMES *CRLissuer;
251   int dp_reasons;
252 };
253 
254 typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
255 
256 DEFINE_STACK_OF(DIST_POINT)
257 
258 struct AUTHORITY_KEYID_st {
259   ASN1_OCTET_STRING *keyid;
260   GENERAL_NAMES *issuer;
261   ASN1_INTEGER *serial;
262 };
263 
264 typedef struct NOTICEREF_st {
265   ASN1_STRING *organization;
266   STACK_OF(ASN1_INTEGER) *noticenos;
267 } NOTICEREF;
268 
269 typedef struct USERNOTICE_st {
270   NOTICEREF *noticeref;
271   ASN1_STRING *exptext;
272 } USERNOTICE;
273 
274 typedef struct POLICYQUALINFO_st {
275   ASN1_OBJECT *pqualid;
276   union {
277     ASN1_IA5STRING *cpsuri;
278     USERNOTICE *usernotice;
279     ASN1_TYPE *other;
280   } d;
281 } POLICYQUALINFO;
282 
283 DEFINE_STACK_OF(POLICYQUALINFO)
284 
285 typedef struct POLICYINFO_st {
286   ASN1_OBJECT *policyid;
287   STACK_OF(POLICYQUALINFO) *qualifiers;
288 } POLICYINFO;
289 
290 typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
291 
292 DEFINE_STACK_OF(POLICYINFO)
293 
294 typedef struct POLICY_MAPPING_st {
295   ASN1_OBJECT *issuerDomainPolicy;
296   ASN1_OBJECT *subjectDomainPolicy;
297 } POLICY_MAPPING;
298 
299 DEFINE_STACK_OF(POLICY_MAPPING)
300 
301 typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
302 
303 typedef struct GENERAL_SUBTREE_st {
304   GENERAL_NAME *base;
305   ASN1_INTEGER *minimum;
306   ASN1_INTEGER *maximum;
307 } GENERAL_SUBTREE;
308 
309 DEFINE_STACK_OF(GENERAL_SUBTREE)
310 
311 struct NAME_CONSTRAINTS_st {
312   STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
313   STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
314 };
315 
316 typedef struct POLICY_CONSTRAINTS_st {
317   ASN1_INTEGER *requireExplicitPolicy;
318   ASN1_INTEGER *inhibitPolicyMapping;
319 } POLICY_CONSTRAINTS;
320 
321 // Proxy certificate structures, see RFC 3820
322 typedef struct PROXY_POLICY_st {
323   ASN1_OBJECT *policyLanguage;
324   ASN1_OCTET_STRING *policy;
325 } PROXY_POLICY;
326 
327 typedef struct PROXY_CERT_INFO_EXTENSION_st {
328   ASN1_INTEGER *pcPathLengthConstraint;
329   PROXY_POLICY *proxyPolicy;
330 } PROXY_CERT_INFO_EXTENSION;
331 
332 DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
333 DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
334 
335 struct ISSUING_DIST_POINT_st {
336   DIST_POINT_NAME *distpoint;
337   int onlyuser;
338   int onlyCA;
339   ASN1_BIT_STRING *onlysomereasons;
340   int indirectCRL;
341   int onlyattr;
342 };
343 
344 // Values in idp_flags field
345 // IDP present
346 #define IDP_PRESENT 0x1
347 // IDP values inconsistent
348 #define IDP_INVALID 0x2
349 // onlyuser true
350 #define IDP_ONLYUSER 0x4
351 // onlyCA true
352 #define IDP_ONLYCA 0x8
353 // onlyattr true
354 #define IDP_ONLYATTR 0x10
355 // indirectCRL true
356 #define IDP_INDIRECT 0x20
357 // onlysomereasons present
358 #define IDP_REASONS 0x40
359 
360 #define X509V3_conf_err(val)                                               \
361   ERR_add_error_data(6, "section:", (val)->section, ",name:", (val)->name, \
362                      ",value:", (val)->value);
363 
364 #define X509V3_set_ctx_test(ctx) \
365   X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
366 #define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
367 
368 #define EXT_BITSTRING(nid, table)                                        \
369   {                                                                      \
370     nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), 0, 0, 0, 0, 0, 0,            \
371         (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING,                             \
372         (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, NULL, NULL, (void *)(table) \
373   }
374 
375 #define EXT_IA5STRING(nid)                                   \
376   {                                                          \
377     nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), 0, 0, 0, 0,       \
378         (X509V3_EXT_I2S)i2s_ASN1_IA5STRING,                  \
379         (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, 0, 0, 0, 0, NULL \
380   }
381 
382 #define EXT_END \
383   { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
384 
385 
386 // X509_PURPOSE stuff
387 
388 #define EXFLAG_BCONS 0x1
389 #define EXFLAG_KUSAGE 0x2
390 #define EXFLAG_XKUSAGE 0x4
391 #define EXFLAG_NSCERT 0x8
392 
393 #define EXFLAG_CA 0x10
394 // Really self issued not necessarily self signed
395 #define EXFLAG_SI 0x20
396 #define EXFLAG_V1 0x40
397 #define EXFLAG_INVALID 0x80
398 #define EXFLAG_SET 0x100
399 #define EXFLAG_CRITICAL 0x200
400 #define EXFLAG_PROXY 0x400
401 
402 #define EXFLAG_INVALID_POLICY 0x800
403 #define EXFLAG_FRESHEST 0x1000
404 // Self signed
405 #define EXFLAG_SS 0x2000
406 
407 #define KU_DIGITAL_SIGNATURE 0x0080
408 #define KU_NON_REPUDIATION 0x0040
409 #define KU_KEY_ENCIPHERMENT 0x0020
410 #define KU_DATA_ENCIPHERMENT 0x0010
411 #define KU_KEY_AGREEMENT 0x0008
412 #define KU_KEY_CERT_SIGN 0x0004
413 #define KU_CRL_SIGN 0x0002
414 #define KU_ENCIPHER_ONLY 0x0001
415 #define KU_DECIPHER_ONLY 0x8000
416 
417 #define NS_SSL_CLIENT 0x80
418 #define NS_SSL_SERVER 0x40
419 #define NS_SMIME 0x20
420 #define NS_OBJSIGN 0x10
421 #define NS_SSL_CA 0x04
422 #define NS_SMIME_CA 0x02
423 #define NS_OBJSIGN_CA 0x01
424 #define NS_ANY_CA (NS_SSL_CA | NS_SMIME_CA | NS_OBJSIGN_CA)
425 
426 #define XKU_SSL_SERVER 0x1
427 #define XKU_SSL_CLIENT 0x2
428 #define XKU_SMIME 0x4
429 #define XKU_CODE_SIGN 0x8
430 #define XKU_SGC 0x10
431 #define XKU_OCSP_SIGN 0x20
432 #define XKU_TIMESTAMP 0x40
433 #define XKU_DVCS 0x80
434 #define XKU_ANYEKU 0x100
435 
436 #define X509_PURPOSE_DYNAMIC 0x1
437 #define X509_PURPOSE_DYNAMIC_NAME 0x2
438 
439 typedef struct x509_purpose_st {
440   int purpose;
441   int trust;  // Default trust ID
442   int flags;
443   int (*check_purpose)(const struct x509_purpose_st *, const X509 *, int);
444   char *name;
445   char *sname;
446   void *usr_data;
447 } X509_PURPOSE;
448 
449 #define X509_PURPOSE_SSL_CLIENT 1
450 #define X509_PURPOSE_SSL_SERVER 2
451 #define X509_PURPOSE_NS_SSL_SERVER 3
452 #define X509_PURPOSE_SMIME_SIGN 4
453 #define X509_PURPOSE_SMIME_ENCRYPT 5
454 #define X509_PURPOSE_CRL_SIGN 6
455 #define X509_PURPOSE_ANY 7
456 #define X509_PURPOSE_OCSP_HELPER 8
457 #define X509_PURPOSE_TIMESTAMP_SIGN 9
458 
459 #define X509_PURPOSE_MIN 1
460 #define X509_PURPOSE_MAX 9
461 
462 DEFINE_STACK_OF(X509_PURPOSE)
463 
464 DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
465 
466 DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)
467 
468 DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
469 OPENSSL_EXPORT GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a);
470 
471 // GENERAL_NAME_cmp returns zero if |a| and |b| are equal and a non-zero
472 // value otherwise. Note this function does not provide a comparison suitable
473 // for sorting.
474 OPENSSL_EXPORT int GENERAL_NAME_cmp(const GENERAL_NAME *a,
475                                     const GENERAL_NAME *b);
476 
477 
478 
479 OPENSSL_EXPORT ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
480                                                     X509V3_CTX *ctx,
481                                                     STACK_OF(CONF_VALUE) *nval);
482 OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(
483     X509V3_EXT_METHOD *method, ASN1_BIT_STRING *bits,
484     STACK_OF(CONF_VALUE) *extlist);
485 
486 // i2v_GENERAL_NAME serializes |gen| as a |CONF_VALUE|. If |ret| is non-NULL, it
487 // appends the value to |ret| and returns |ret| on success or NULL on error. If
488 // it returns NULL, the caller is still responsible for freeing |ret|. If |ret|
489 // is NULL, it returns a newly-allocated |STACK_OF(CONF_VALUE)| containing the
490 // result. |method| is ignored.
491 //
492 // Do not use this function. This is an internal implementation detail of the
493 // human-readable print functions. If extracting a SAN list from a certificate,
494 // look at |gen| directly.
495 OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(
496     X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);
497 OPENSSL_EXPORT int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
498 
499 DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
500 
501 // i2v_GENERAL_NAMES serializes |gen| as a list of |CONF_VALUE|s. If |ret| is
502 // non-NULL, it appends the values to |ret| and returns |ret| on success or NULL
503 // on error. If it returns NULL, the caller is still responsible for freeing
504 // |ret|. If |ret| is NULL, it returns a newly-allocated |STACK_OF(CONF_VALUE)|
505 // containing the results. |method| is ignored.
506 //
507 // Do not use this function. This is an internal implementation detail of the
508 // human-readable print functions. If extracting a SAN list from a certificate,
509 // look at |gen| directly.
510 OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(
511     X509V3_EXT_METHOD *method, GENERAL_NAMES *gen,
512     STACK_OF(CONF_VALUE) *extlist);
513 OPENSSL_EXPORT GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
514                                                 X509V3_CTX *ctx,
515                                                 STACK_OF(CONF_VALUE) *nval);
516 
517 DECLARE_ASN1_FUNCTIONS(OTHERNAME)
518 DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
519 OPENSSL_EXPORT int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b);
520 OPENSSL_EXPORT void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type,
521                                             void *value);
522 OPENSSL_EXPORT void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype);
523 OPENSSL_EXPORT int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
524                                                ASN1_OBJECT *oid,
525                                                ASN1_TYPE *value);
526 OPENSSL_EXPORT int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen,
527                                                ASN1_OBJECT **poid,
528                                                ASN1_TYPE **pvalue);
529 
530 OPENSSL_EXPORT char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
531                                            const ASN1_OCTET_STRING *ia5);
532 OPENSSL_EXPORT ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(
533     X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str);
534 
535 DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
536 OPENSSL_EXPORT int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a);
537 
538 DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
539 DECLARE_ASN1_FUNCTIONS(POLICYINFO)
540 DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)
541 DECLARE_ASN1_FUNCTIONS(USERNOTICE)
542 DECLARE_ASN1_FUNCTIONS(NOTICEREF)
543 
544 DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
545 DECLARE_ASN1_FUNCTIONS(DIST_POINT)
546 DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
547 DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
548 
549 OPENSSL_EXPORT int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn,
550                                          X509_NAME *iname);
551 
552 OPENSSL_EXPORT int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc);
553 
554 DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
555 DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
556 
557 DECLARE_ASN1_ITEM(POLICY_MAPPING)
558 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
559 DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
560 
561 DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
562 DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
563 
564 DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
565 DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
566 
567 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
568 DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
569 
570 OPENSSL_EXPORT GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
571                                               const X509V3_EXT_METHOD *method,
572                                               X509V3_CTX *ctx, int gen_type,
573                                               const char *value, int is_nc);
574 
575 OPENSSL_EXPORT GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method,
576                                               X509V3_CTX *ctx, CONF_VALUE *cnf);
577 OPENSSL_EXPORT GENERAL_NAME *v2i_GENERAL_NAME_ex(
578     GENERAL_NAME *out, const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
579     CONF_VALUE *cnf, int is_nc);
580 OPENSSL_EXPORT void X509V3_conf_free(CONF_VALUE *val);
581 
582 // X509V3_EXT_conf_nid contains the only exposed instance of an LHASH in our
583 // public headers. The |conf| pointer must be NULL but cryptography.io wraps
584 // this function so we cannot, yet, replace the type with a dummy struct.
585 OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
586                                                    X509V3_CTX *ctx, int ext_nid,
587                                                    const char *value);
588 
589 OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx,
590                                                     int ext_nid,
591                                                     const char *value);
592 OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx,
593                                                 const char *name,
594                                                 const char *value);
595 OPENSSL_EXPORT int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx,
596                                            const char *section,
597                                            STACK_OF(X509_EXTENSION) **sk);
598 OPENSSL_EXPORT int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx,
599                                         const char *section, X509 *cert);
600 OPENSSL_EXPORT int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx,
601                                             const char *section, X509_REQ *req);
602 OPENSSL_EXPORT int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx,
603                                             const char *section, X509_CRL *crl);
604 
605 OPENSSL_EXPORT int X509V3_add_value_bool_nf(const char *name, int asn1_bool,
606                                             STACK_OF(CONF_VALUE) **extlist);
607 OPENSSL_EXPORT int X509V3_get_value_bool(const CONF_VALUE *value,
608                                          int *asn1_bool);
609 OPENSSL_EXPORT int X509V3_get_value_int(const CONF_VALUE *value,
610                                         ASN1_INTEGER **aint);
611 OPENSSL_EXPORT void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
612 
613 OPENSSL_EXPORT char *X509V3_get_string(X509V3_CTX *ctx, const char *name,
614                                        const char *section);
615 OPENSSL_EXPORT STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx,
616                                                         const char *section);
617 OPENSSL_EXPORT void X509V3_string_free(X509V3_CTX *ctx, char *str);
618 OPENSSL_EXPORT void X509V3_section_free(X509V3_CTX *ctx,
619                                         STACK_OF(CONF_VALUE) *section);
620 OPENSSL_EXPORT void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
621                                    X509_REQ *req, X509_CRL *crl, int flags);
622 
623 // X509V3_add_value appends a |CONF_VALUE| containing |name| and |value| to
624 // |*extlist|. It returns one on success and zero on error. If |*extlist| is
625 // NULL, it sets |*extlist| to a newly-allocated |STACK_OF(CONF_VALUE)|
626 // containing the result. Either |name| or |value| may be NULL to omit the
627 // field.
628 //
629 // On failure, if |*extlist| was NULL, |*extlist| will remain NULL when the
630 // function returns.
631 OPENSSL_EXPORT int X509V3_add_value(const char *name, const char *value,
632                                     STACK_OF(CONF_VALUE) **extlist);
633 
634 // X509V3_add_value_uchar behaves like |X509V3_add_value| but takes an
635 // |unsigned char| pointer.
636 OPENSSL_EXPORT int X509V3_add_value_uchar(const char *name,
637                                           const unsigned char *value,
638                                           STACK_OF(CONF_VALUE) **extlist);
639 
640 // X509V3_add_value_bool behaves like |X509V3_add_value| but stores the value
641 // "TRUE" if |asn1_bool| is non-zero and "FALSE" otherwise.
642 OPENSSL_EXPORT int X509V3_add_value_bool(const char *name, int asn1_bool,
643                                          STACK_OF(CONF_VALUE) **extlist);
644 
645 // X509V3_add_value_bool behaves like |X509V3_add_value| but stores a string
646 // representation of |aint|. Note this string representation may be decimal or
647 // hexadecimal, depending on the size of |aint|.
648 OPENSSL_EXPORT int X509V3_add_value_int(const char *name,
649                                         const ASN1_INTEGER *aint,
650                                         STACK_OF(CONF_VALUE) **extlist);
651 
652 OPENSSL_EXPORT char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth,
653                                       const ASN1_INTEGER *aint);
654 OPENSSL_EXPORT ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth,
655                                               const char *value);
656 OPENSSL_EXPORT char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth,
657                                          const ASN1_ENUMERATED *aint);
658 OPENSSL_EXPORT char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth,
659                                                const ASN1_ENUMERATED *aint);
660 OPENSSL_EXPORT int X509V3_EXT_add(X509V3_EXT_METHOD *ext);
661 OPENSSL_EXPORT int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);
662 OPENSSL_EXPORT int X509V3_EXT_add_alias(int nid_to, int nid_from);
663 OPENSSL_EXPORT void X509V3_EXT_cleanup(void);
664 
665 OPENSSL_EXPORT const X509V3_EXT_METHOD *X509V3_EXT_get(
666     const X509_EXTENSION *ext);
667 OPENSSL_EXPORT const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
668 OPENSSL_EXPORT int X509V3_add_standard_extensions(void);
669 OPENSSL_EXPORT STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
670 
671 // X509V3_EXT_d2i decodes |ext| and returns a pointer to a newly-allocated
672 // structure, with type dependent on the type of the extension. It returns NULL
673 // if |ext| is an unsupported extension or if there was a syntax error in the
674 // extension. The caller should cast the return value to the expected type and
675 // free the structure when done.
676 //
677 // WARNING: Casting the return value to the wrong type is a potentially
678 // exploitable memory error, so callers must not use this function before
679 // checking |ext| is of a known type.
680 OPENSSL_EXPORT void *X509V3_EXT_d2i(const X509_EXTENSION *ext);
681 
682 // X509V3_get_d2i finds and decodes the extension in |extensions| of type |nid|.
683 // If found, it decodes it and returns a newly-allocated structure, with type
684 // dependent on |nid|. If the extension is not found or on error, it returns
685 // NULL. The caller may distinguish these cases using the |out_critical| value.
686 //
687 // If |out_critical| is not NULL, this function sets |*out_critical| to one if
688 // the extension is found and critical, zero if it is found and not critical, -1
689 // if it is not found, and -2 if there is an invalid duplicate extension. Note
690 // this function may set |*out_critical| to one or zero and still return NULL if
691 // the extension is found but has a syntax error.
692 //
693 // If |out_idx| is not NULL, this function looks for the first occurrence of the
694 // extension after |*out_idx|. It then sets |*out_idx| to the index of the
695 // extension, or -1 if not found. If |out_idx| is non-NULL, duplicate extensions
696 // are not treated as an error. Callers, however, should not rely on this
697 // behavior as it may be removed in the future. Duplicate extensions are
698 // forbidden in RFC 5280.
699 //
700 // WARNING: This function is difficult to use correctly. Callers should pass a
701 // non-NULL |out_critical| and check both the return value and |*out_critical|
702 // to handle errors. If the return value is NULL and |*out_critical| is not -1,
703 // there was an error. Otherwise, the function succeeded and but may return NULL
704 // for a missing extension. Callers should pass NULL to |out_idx| so that
705 // duplicate extensions are handled correctly.
706 //
707 // Additionally, casting the return value to the wrong type is a potentially
708 // exploitable memory error, so callers must ensure the cast and |nid| match.
709 OPENSSL_EXPORT void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *extensions,
710                                     int nid, int *out_critical, int *out_idx);
711 
712 // X509V3_EXT_free casts |ext_data| into the type that corresponds to |nid| and
713 // releases memory associated with it. It returns one on success and zero if
714 // |nid| is not a known extension.
715 //
716 // WARNING: Casting |ext_data| to the wrong type is a potentially exploitable
717 // memory error, so callers must ensure |ext_data|'s type matches |nid|.
718 //
719 // TODO(davidben): OpenSSL upstream no longer exposes this function. Remove it?
720 OPENSSL_EXPORT int X509V3_EXT_free(int nid, void *ext_data);
721 
722 // X509V3_EXT_i2d casts |ext_struc| into the type that corresponds to
723 // |ext_nid|, serializes it, and returns a newly-allocated |X509_EXTENSION|
724 // object containing the serialization, or NULL on error. The |X509_EXTENSION|
725 // has OID |ext_nid| and is critical if |crit| is one.
726 //
727 // WARNING: Casting |ext_struc| to the wrong type is a potentially exploitable
728 // memory error, so callers must ensure |ext_struct|'s type matches |ext_nid|.
729 OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit,
730                                               void *ext_struc);
731 
732 // The following constants control the behavior of |X509V3_add1_i2d| and related
733 // functions.
734 
735 // X509V3_ADD_OP_MASK can be ANDed with the flags to determine how duplicate
736 // extensions are processed.
737 #define X509V3_ADD_OP_MASK 0xfL
738 
739 // X509V3_ADD_DEFAULT causes the function to fail if the extension was already
740 // present.
741 #define X509V3_ADD_DEFAULT 0L
742 
743 // X509V3_ADD_APPEND causes the function to unconditionally appended the new
744 // extension to to the extensions list, even if there is a duplicate.
745 #define X509V3_ADD_APPEND 1L
746 
747 // X509V3_ADD_REPLACE causes the function to replace the existing extension, or
748 // append if it is not present.
749 #define X509V3_ADD_REPLACE 2L
750 
751 // X509V3_ADD_REPLACE causes the function to replace the existing extension and
752 // fail if it is not present.
753 #define X509V3_ADD_REPLACE_EXISTING 3L
754 
755 // X509V3_ADD_KEEP_EXISTING causes the function to succeed without replacing the
756 // extension if already present.
757 #define X509V3_ADD_KEEP_EXISTING 4L
758 
759 // X509V3_ADD_DELETE causes the function to remove the matching extension. No
760 // new extension is added. If there is no matching extension, the function
761 // fails. The |value| parameter is ignored in this mode.
762 #define X509V3_ADD_DELETE 5L
763 
764 // X509V3_ADD_SILENT may be ORed into one of the values above to indicate the
765 // function should not add to the error queue on duplicate or missing extension.
766 // The function will continue to return zero in those cases, and it will
767 // continue to return -1 and add to the error queue on other errors.
768 #define X509V3_ADD_SILENT 0x10
769 
770 // X509V3_add1_i2d casts |value| to the type that corresponds to |nid|,
771 // serializes it, and appends it to the extension list in |*x|. If |*x| is NULL,
772 // it will set |*x| to a newly-allocated |STACK_OF(X509_EXTENSION)| as needed.
773 // The |crit| parameter determines whether the new extension is critical.
774 // |flags| may be some combination of the |X509V3_ADD_*| constants to control
775 // the function's behavior on duplicate extension.
776 //
777 // This function returns one on success, zero if the operation failed due to a
778 // missing or duplicate extension, and -1 on other errors.
779 //
780 // WARNING: Casting |value| to the wrong type is a potentially exploitable
781 // memory error, so callers must ensure |value|'s type matches |nid|.
782 OPENSSL_EXPORT int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid,
783                                    void *value, int crit, unsigned long flags);
784 
785 #define X509V3_EXT_UNKNOWN_MASK (0xfL << 16)
786 
787 // X509V3_EXT_DEFAULT causes unknown extensions or syntax errors to return
788 // failure.
789 #define X509V3_EXT_DEFAULT 0
790 // X509V3_EXT_ERROR_UNKNOWN causes unknown extensions or syntax errors to print
791 // as "<Not Supported>" or "<Parse Error>", respectively.
792 #define X509V3_EXT_ERROR_UNKNOWN (1L << 16)
793 // X509V3_EXT_PARSE_UNKNOWN is deprecated and behaves like
794 // |X509V3_EXT_DUMP_UNKNOWN|.
795 #define X509V3_EXT_PARSE_UNKNOWN (2L << 16)
796 // X509V3_EXT_DUMP_UNKNOWN causes unknown extensions to be displayed as a
797 // hexdump.
798 #define X509V3_EXT_DUMP_UNKNOWN (3L << 16)
799 
800 OPENSSL_EXPORT void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val,
801                                        int indent, int ml);
802 OPENSSL_EXPORT int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext,
803                                     unsigned long flag, int indent);
804 OPENSSL_EXPORT int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag,
805                                        int indent);
806 
807 // X509V3_extensions_print prints |title|, followed by a human-readable
808 // representation of |exts| to |out|. It returns one on success and zero on
809 // error. The output is indented by |indent| spaces. |flag| is one of the
810 // |X509V3_EXT_*| constants and controls printing of unknown extensions and
811 // syntax errors.
812 OPENSSL_EXPORT int X509V3_extensions_print(BIO *out, const char *title,
813                                            const STACK_OF(X509_EXTENSION) *exts,
814                                            unsigned long flag, int indent);
815 
816 OPENSSL_EXPORT int X509_check_ca(X509 *x);
817 OPENSSL_EXPORT int X509_check_purpose(X509 *x, int id, int ca);
818 OPENSSL_EXPORT int X509_supported_extension(X509_EXTENSION *ex);
819 OPENSSL_EXPORT int X509_PURPOSE_set(int *p, int purpose);
820 OPENSSL_EXPORT int X509_check_issued(X509 *issuer, X509 *subject);
821 OPENSSL_EXPORT int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid);
822 
823 OPENSSL_EXPORT uint32_t X509_get_extension_flags(X509 *x);
824 OPENSSL_EXPORT uint32_t X509_get_key_usage(X509 *x);
825 OPENSSL_EXPORT uint32_t X509_get_extended_key_usage(X509 *x);
826 
827 // X509_get0_subject_key_id returns |x509|'s subject key identifier, if present.
828 // (See RFC 5280, section 4.2.1.2.) It returns NULL if the extension is not
829 // present or if some extension in |x509| was invalid.
830 //
831 // Note that decoding an |X509| object will not check for invalid extensions. To
832 // detect the error case, call |X509_get_extensions_flags| and check the
833 // |EXFLAG_INVALID| bit.
834 OPENSSL_EXPORT const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x509);
835 
836 // X509_get0_authority_key_id returns keyIdentifier of |x509|'s authority key
837 // identifier, if the extension and field are present. (See RFC 5280,
838 // section 4.2.1.1.) It returns NULL if the extension is not present, if it is
839 // present but lacks a keyIdentifier field, or if some extension in |x509| was
840 // invalid.
841 //
842 // Note that decoding an |X509| object will not check for invalid extensions. To
843 // detect the error case, call |X509_get_extensions_flags| and check the
844 // |EXFLAG_INVALID| bit.
845 OPENSSL_EXPORT const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x509);
846 
847 // X509_get0_authority_issuer returns the authorityCertIssuer of |x509|'s
848 // authority key identifier, if the extension and field are present. (See
849 // RFC 5280, section 4.2.1.1.) It returns NULL if the extension is not present,
850 // if it is present but lacks a authorityCertIssuer field, or if some extension
851 // in |x509| was invalid.
852 //
853 // Note that decoding an |X509| object will not check for invalid extensions. To
854 // detect the error case, call |X509_get_extensions_flags| and check the
855 // |EXFLAG_INVALID| bit.
856 OPENSSL_EXPORT const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x509);
857 
858 // X509_get0_authority_serial returns the authorityCertSerialNumber of |x509|'s
859 // authority key identifier, if the extension and field are present. (See
860 // RFC 5280, section 4.2.1.1.) It returns NULL if the extension is not present,
861 // if it is present but lacks a authorityCertSerialNumber field, or if some
862 // extension in |x509| was invalid.
863 //
864 // Note that decoding an |X509| object will not check for invalid extensions. To
865 // detect the error case, call |X509_get_extensions_flags| and check the
866 // |EXFLAG_INVALID| bit.
867 OPENSSL_EXPORT const ASN1_INTEGER *X509_get0_authority_serial(X509 *x509);
868 
869 OPENSSL_EXPORT int X509_PURPOSE_get_count(void);
870 OPENSSL_EXPORT X509_PURPOSE *X509_PURPOSE_get0(int idx);
871 OPENSSL_EXPORT int X509_PURPOSE_get_by_sname(char *sname);
872 OPENSSL_EXPORT int X509_PURPOSE_get_by_id(int id);
873 OPENSSL_EXPORT int X509_PURPOSE_add(int id, int trust, int flags,
874                                     int (*ck)(const X509_PURPOSE *,
875                                               const X509 *, int),
876                                     char *name, char *sname, void *arg);
877 OPENSSL_EXPORT char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp);
878 OPENSSL_EXPORT char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp);
879 OPENSSL_EXPORT int X509_PURPOSE_get_trust(const X509_PURPOSE *xp);
880 OPENSSL_EXPORT void X509_PURPOSE_cleanup(void);
881 OPENSSL_EXPORT int X509_PURPOSE_get_id(const X509_PURPOSE *);
882 
883 OPENSSL_EXPORT STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
884 OPENSSL_EXPORT STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x);
885 OPENSSL_EXPORT void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
886 OPENSSL_EXPORT STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x);
887 // Flags for X509_check_* functions
888 
889 // Deprecated: this flag does nothing
890 #define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0
891 // Disable wildcard matching for dnsName fields and common name.
892 #define X509_CHECK_FLAG_NO_WILDCARDS 0x2
893 // X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS does nothing, but is necessary in
894 // OpenSSL to enable standard wildcard matching. In BoringSSL, this behavior is
895 // always enabled.
896 #define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0
897 // Deprecated: this flag does nothing
898 #define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0
899 // Deprecated: this flag does nothing
900 #define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0
901 // Skip the subject common name fallback if subjectAltNames is missing.
902 #define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20
903 
904 OPENSSL_EXPORT int X509_check_host(X509 *x, const char *chk, size_t chklen,
905                                    unsigned int flags, char **peername);
906 OPENSSL_EXPORT int X509_check_email(X509 *x, const char *chk, size_t chklen,
907                                     unsigned int flags);
908 OPENSSL_EXPORT int X509_check_ip(X509 *x, const unsigned char *chk,
909                                  size_t chklen, unsigned int flags);
910 OPENSSL_EXPORT int X509_check_ip_asc(X509 *x, const char *ipasc,
911                                      unsigned int flags);
912 
913 OPENSSL_EXPORT ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
914 OPENSSL_EXPORT ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
915 OPENSSL_EXPORT int X509V3_NAME_from_section(X509_NAME *nm,
916                                             STACK_OF(CONF_VALUE) *dn_sk,
917                                             unsigned long chtype);
918 
919 OPENSSL_EXPORT void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node,
920                                            int indent);
921 DEFINE_STACK_OF(X509_POLICY_NODE)
922 
923 // BEGIN ERROR CODES
924 // The following lines are auto generated by the script mkerr.pl. Any changes
925 // made after this point may be overwritten when the script is next run.
926 
927 
928 #if defined(__cplusplus)
929 }  // extern C
930 
931 extern "C++" {
932 
933 BSSL_NAMESPACE_BEGIN
934 
935 BORINGSSL_MAKE_DELETER(ACCESS_DESCRIPTION, ACCESS_DESCRIPTION_free)
936 BORINGSSL_MAKE_DELETER(AUTHORITY_KEYID, AUTHORITY_KEYID_free)
937 BORINGSSL_MAKE_DELETER(BASIC_CONSTRAINTS, BASIC_CONSTRAINTS_free)
938 // TODO(davidben): Move this to conf.h and rename to CONF_VALUE_free.
939 BORINGSSL_MAKE_DELETER(CONF_VALUE, X509V3_conf_free)
940 BORINGSSL_MAKE_DELETER(DIST_POINT, DIST_POINT_free)
941 BORINGSSL_MAKE_DELETER(GENERAL_NAME, GENERAL_NAME_free)
942 BORINGSSL_MAKE_DELETER(GENERAL_SUBTREE, GENERAL_SUBTREE_free)
943 BORINGSSL_MAKE_DELETER(NAME_CONSTRAINTS, NAME_CONSTRAINTS_free)
944 BORINGSSL_MAKE_DELETER(POLICY_MAPPING, POLICY_MAPPING_free)
945 BORINGSSL_MAKE_DELETER(POLICYINFO, POLICYINFO_free)
946 
947 BSSL_NAMESPACE_END
948 
949 }  // extern C++
950 #endif
951 
952 #define X509V3_R_BAD_IP_ADDRESS 100
953 #define X509V3_R_BAD_OBJECT 101
954 #define X509V3_R_BN_DEC2BN_ERROR 102
955 #define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 103
956 #define X509V3_R_CANNOT_FIND_FREE_FUNCTION 104
957 #define X509V3_R_DIRNAME_ERROR 105
958 #define X509V3_R_DISTPOINT_ALREADY_SET 106
959 #define X509V3_R_DUPLICATE_ZONE_ID 107
960 #define X509V3_R_ERROR_CONVERTING_ZONE 108
961 #define X509V3_R_ERROR_CREATING_EXTENSION 109
962 #define X509V3_R_ERROR_IN_EXTENSION 110
963 #define X509V3_R_EXPECTED_A_SECTION_NAME 111
964 #define X509V3_R_EXTENSION_EXISTS 112
965 #define X509V3_R_EXTENSION_NAME_ERROR 113
966 #define X509V3_R_EXTENSION_NOT_FOUND 114
967 #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 115
968 #define X509V3_R_EXTENSION_VALUE_ERROR 116
969 #define X509V3_R_ILLEGAL_EMPTY_EXTENSION 117
970 #define X509V3_R_ILLEGAL_HEX_DIGIT 118
971 #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 119
972 #define X509V3_R_INVALID_BOOLEAN_STRING 120
973 #define X509V3_R_INVALID_EXTENSION_STRING 121
974 #define X509V3_R_INVALID_MULTIPLE_RDNS 122
975 #define X509V3_R_INVALID_NAME 123
976 #define X509V3_R_INVALID_NULL_ARGUMENT 124
977 #define X509V3_R_INVALID_NULL_NAME 125
978 #define X509V3_R_INVALID_NULL_VALUE 126
979 #define X509V3_R_INVALID_NUMBER 127
980 #define X509V3_R_INVALID_NUMBERS 128
981 #define X509V3_R_INVALID_OBJECT_IDENTIFIER 129
982 #define X509V3_R_INVALID_OPTION 130
983 #define X509V3_R_INVALID_POLICY_IDENTIFIER 131
984 #define X509V3_R_INVALID_PROXY_POLICY_SETTING 132
985 #define X509V3_R_INVALID_PURPOSE 133
986 #define X509V3_R_INVALID_SECTION 134
987 #define X509V3_R_INVALID_SYNTAX 135
988 #define X509V3_R_ISSUER_DECODE_ERROR 136
989 #define X509V3_R_MISSING_VALUE 137
990 #define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 138
991 #define X509V3_R_NO_CONFIG_DATABASE 139
992 #define X509V3_R_NO_ISSUER_CERTIFICATE 140
993 #define X509V3_R_NO_ISSUER_DETAILS 141
994 #define X509V3_R_NO_POLICY_IDENTIFIER 142
995 #define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 143
996 #define X509V3_R_NO_PUBLIC_KEY 144
997 #define X509V3_R_NO_SUBJECT_DETAILS 145
998 #define X509V3_R_ODD_NUMBER_OF_DIGITS 146
999 #define X509V3_R_OPERATION_NOT_DEFINED 147
1000 #define X509V3_R_OTHERNAME_ERROR 148
1001 #define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 149
1002 #define X509V3_R_POLICY_PATH_LENGTH 150
1003 #define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 151
1004 #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 152
1005 #define X509V3_R_SECTION_NOT_FOUND 153
1006 #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 154
1007 #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 155
1008 #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 156
1009 #define X509V3_R_UNKNOWN_EXTENSION 157
1010 #define X509V3_R_UNKNOWN_EXTENSION_NAME 158
1011 #define X509V3_R_UNKNOWN_OPTION 159
1012 #define X509V3_R_UNSUPPORTED_OPTION 160
1013 #define X509V3_R_UNSUPPORTED_TYPE 161
1014 #define X509V3_R_USER_TOO_LONG 162
1015 #define X509V3_R_INVALID_VALUE 163
1016 #define X509V3_R_TRAILING_DATA_IN_EXTENSION 164
1017 
1018 #endif
1019