• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #ifndef OPENSSL_HEADER_X509_INTERNAL_H
11 #define OPENSSL_HEADER_X509_INTERNAL_H
12 
13 #include <openssl/base.h>
14 #include <openssl/evp.h>
15 #include <openssl/x509.h>
16 
17 #include "../asn1/internal.h"
18 #include "../internal.h"
19 
20 #if defined(__cplusplus)
21 extern "C" {
22 #endif
23 
24 
25 // Internal structures.
26 
27 typedef struct X509_val_st {
28   ASN1_TIME *notBefore;
29   ASN1_TIME *notAfter;
30 } X509_VAL;
31 
32 DECLARE_ASN1_FUNCTIONS_const(X509_VAL)
33 
34 struct X509_pubkey_st {
35   X509_ALGOR *algor;
36   ASN1_BIT_STRING *public_key;
37   EVP_PKEY *pkey;
38 } /* X509_PUBKEY */;
39 
40 // X509_PUBKEY is an |ASN1_ITEM| whose ASN.1 type is SubjectPublicKeyInfo and C
41 // type is |X509_PUBKEY*|.
42 DECLARE_ASN1_ITEM(X509_PUBKEY)
43 
44 struct X509_name_entry_st {
45   ASN1_OBJECT *object;
46   ASN1_STRING *value;
47   int set;
48 } /* X509_NAME_ENTRY */;
49 
50 // X509_NAME_ENTRY is an |ASN1_ITEM| whose ASN.1 type is AttributeTypeAndValue
51 // (RFC 5280) and C type is |X509_NAME_ENTRY*|.
52 DECLARE_ASN1_ITEM(X509_NAME_ENTRY)
53 
54 // we always keep X509_NAMEs in 2 forms.
55 struct X509_name_st {
56   STACK_OF(X509_NAME_ENTRY) *entries;
57   int modified;  // true if 'bytes' needs to be built
58   BUF_MEM *bytes;
59   unsigned char *canon_enc;
60   int canon_enclen;
61 } /* X509_NAME */;
62 
63 struct x509_attributes_st {
64   ASN1_OBJECT *object;
65   STACK_OF(ASN1_TYPE) *set;
66 } /* X509_ATTRIBUTE */;
67 
68 // X509_ATTRIBUTE is an |ASN1_ITEM| whose ASN.1 type is Attribute (RFC 2986) and
69 // C type is |X509_ATTRIBUTE*|.
70 DECLARE_ASN1_ITEM(X509_ATTRIBUTE)
71 
72 typedef struct x509_cert_aux_st {
73   STACK_OF(ASN1_OBJECT) *trust;   // trusted uses
74   STACK_OF(ASN1_OBJECT) *reject;  // rejected uses
75   ASN1_UTF8STRING *alias;         // "friendly name"
76   ASN1_OCTET_STRING *keyid;       // key id of private key
77 } X509_CERT_AUX;
78 
79 DECLARE_ASN1_FUNCTIONS_const(X509_CERT_AUX)
80 
81 struct X509_extension_st {
82   ASN1_OBJECT *object;
83   ASN1_BOOLEAN critical;
84   ASN1_OCTET_STRING *value;
85 } /* X509_EXTENSION */;
86 
87 // X509_EXTENSION is an |ASN1_ITEM| whose ASN.1 type is X.509 Extension (RFC
88 // 5280) and C type is |X509_EXTENSION*|.
89 DECLARE_ASN1_ITEM(X509_EXTENSION)
90 
91 // X509_EXTENSIONS is an |ASN1_ITEM| whose ASN.1 type is SEQUENCE of Extension
92 // (RFC 5280) and C type is |STACK_OF(X509_EXTENSION)*|.
93 DECLARE_ASN1_ITEM(X509_EXTENSIONS)
94 
95 typedef struct {
96   ASN1_INTEGER *version;  // [ 0 ] default of v1
97   ASN1_INTEGER *serialNumber;
98   X509_ALGOR *signature;
99   X509_NAME *issuer;
100   X509_VAL *validity;
101   X509_NAME *subject;
102   X509_PUBKEY *key;
103   ASN1_BIT_STRING *issuerUID;            // [ 1 ] optional in v2
104   ASN1_BIT_STRING *subjectUID;           // [ 2 ] optional in v2
105   STACK_OF(X509_EXTENSION) *extensions;  // [ 3 ] optional in v3
106   ASN1_ENCODING enc;
107 } X509_CINF;
108 
109 // TODO(https://crbug.com/boringssl/407): This is not const because it contains
110 // an |X509_NAME|.
111 DECLARE_ASN1_FUNCTIONS(X509_CINF)
112 
113 struct x509_st {
114   X509_CINF *cert_info;
115   X509_ALGOR *sig_alg;
116   ASN1_BIT_STRING *signature;
117   CRYPTO_refcount_t references;
118   CRYPTO_EX_DATA ex_data;
119   // These contain copies of various extension values
120   long ex_pathlen;
121   uint32_t ex_flags;
122   uint32_t ex_kusage;
123   uint32_t ex_xkusage;
124   ASN1_OCTET_STRING *skid;
125   AUTHORITY_KEYID *akid;
126   STACK_OF(DIST_POINT) *crldp;
127   STACK_OF(GENERAL_NAME) *altname;
128   NAME_CONSTRAINTS *nc;
129   unsigned char cert_hash[SHA256_DIGEST_LENGTH];
130   X509_CERT_AUX *aux;
131   CRYPTO_MUTEX lock;
132 } /* X509 */;
133 
134 // X509 is an |ASN1_ITEM| whose ASN.1 type is X.509 Certificate (RFC 5280) and C
135 // type is |X509*|.
136 DECLARE_ASN1_ITEM(X509)
137 
138 typedef struct {
139   ASN1_ENCODING enc;
140   ASN1_INTEGER *version;
141   X509_NAME *subject;
142   X509_PUBKEY *pubkey;
143   //  d=2 hl=2 l=  0 cons: cont: 00
144   STACK_OF(X509_ATTRIBUTE) *attributes;  // [ 0 ]
145 } X509_REQ_INFO;
146 
147 // TODO(https://crbug.com/boringssl/407): This is not const because it contains
148 // an |X509_NAME|.
149 DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
150 
151 struct X509_req_st {
152   X509_REQ_INFO *req_info;
153   X509_ALGOR *sig_alg;
154   ASN1_BIT_STRING *signature;
155 } /* X509_REQ */;
156 
157 // X509_REQ is an |ASN1_ITEM| whose ASN.1 type is CertificateRequest (RFC 2986)
158 // and C type is |X509_REQ*|.
159 DECLARE_ASN1_ITEM(X509_REQ)
160 
161 struct x509_revoked_st {
162   ASN1_INTEGER *serialNumber;
163   ASN1_TIME *revocationDate;
164   STACK_OF(X509_EXTENSION) /* optional */ *extensions;
165   // Revocation reason
166   int reason;
167 } /* X509_REVOKED */;
168 
169 // X509_REVOKED is an |ASN1_ITEM| whose ASN.1 type is an element of the
170 // revokedCertificates field of TBSCertList (RFC 5280) and C type is
171 // |X509_REVOKED*|.
172 DECLARE_ASN1_ITEM(X509_REVOKED)
173 
174 typedef struct {
175   ASN1_INTEGER *version;
176   X509_ALGOR *sig_alg;
177   X509_NAME *issuer;
178   ASN1_TIME *lastUpdate;
179   ASN1_TIME *nextUpdate;
180   STACK_OF(X509_REVOKED) *revoked;
181   STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
182   ASN1_ENCODING enc;
183 } X509_CRL_INFO;
184 
185 // TODO(https://crbug.com/boringssl/407): This is not const because it contains
186 // an |X509_NAME|.
187 DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
188 
189 // Values in idp_flags field
190 // IDP present
191 #define IDP_PRESENT 0x1
192 // IDP values inconsistent
193 #define IDP_INVALID 0x2
194 // onlyuser true
195 #define IDP_ONLYUSER 0x4
196 // onlyCA true
197 #define IDP_ONLYCA 0x8
198 // onlyattr true
199 #define IDP_ONLYATTR 0x10
200 // indirectCRL true
201 #define IDP_INDIRECT 0x20
202 // onlysomereasons present
203 #define IDP_REASONS 0x40
204 
205 struct X509_crl_st {
206   // actual signature
207   X509_CRL_INFO *crl;
208   X509_ALGOR *sig_alg;
209   ASN1_BIT_STRING *signature;
210   CRYPTO_refcount_t references;
211   int flags;
212   // Copies of various extensions
213   AUTHORITY_KEYID *akid;
214   ISSUING_DIST_POINT *idp;
215   // Convenient breakdown of IDP
216   int idp_flags;
217   unsigned char crl_hash[SHA256_DIGEST_LENGTH];
218 } /* X509_CRL */;
219 
220 // X509_CRL is an |ASN1_ITEM| whose ASN.1 type is X.509 CertificateList (RFC
221 // 5280) and C type is |X509_CRL*|.
222 DECLARE_ASN1_ITEM(X509_CRL)
223 
224 // GENERAL_NAME is an |ASN1_ITEM| whose ASN.1 type is GeneralName and C type is
225 // |GENERAL_NAME*|.
226 DECLARE_ASN1_ITEM(GENERAL_NAME)
227 
228 // GENERAL_NAMES is an |ASN1_ITEM| whose ASN.1 type is SEQUENCE OF GeneralName
229 // and C type is |GENERAL_NAMES*|, aka |STACK_OF(GENERAL_NAME)*|.
230 DECLARE_ASN1_ITEM(GENERAL_NAMES)
231 
232 struct X509_VERIFY_PARAM_st {
233   int64_t check_time;               // POSIX time to use
234   unsigned long flags;              // Various verify flags
235   int purpose;                      // purpose to check untrusted certificates
236   int trust;                        // trust setting to check
237   int depth;                        // Verify depth
238   STACK_OF(ASN1_OBJECT) *policies;  // Permissible policies
239   // The following fields specify acceptable peer identities.
240   STACK_OF(OPENSSL_STRING) *hosts;  // Set of acceptable names
241   unsigned int hostflags;           // Flags to control matching features
242   char *email;                      // If not NULL email address to match
243   size_t emaillen;
244   unsigned char *ip;     // If not NULL IP address to match
245   size_t iplen;          // Length of IP address
246   unsigned char poison;  // Fail all verifications at name checking
247 } /* X509_VERIFY_PARAM */;
248 
249 struct x509_object_st {
250   // one of the above types
251   int type;
252   union {
253     char *ptr;
254     X509 *x509;
255     X509_CRL *crl;
256     EVP_PKEY *pkey;
257   } data;
258 } /* X509_OBJECT */;
259 
260 // NETSCAPE_SPKI is an |ASN1_ITEM| whose ASN.1 type is
261 // SignedPublicKeyAndChallenge and C type is |NETSCAPE_SPKI*|.
262 DECLARE_ASN1_ITEM(NETSCAPE_SPKI)
263 
264 // NETSCAPE_SPKAC is an |ASN1_ITEM| whose ASN.1 type is PublicKeyAndChallenge
265 // and C type is |NETSCAPE_SPKAC*|.
266 DECLARE_ASN1_ITEM(NETSCAPE_SPKAC)
267 
268 // This is a static that defines the function interface
269 struct x509_lookup_method_st {
270   int (*new_item)(X509_LOOKUP *ctx);
271   void (*free)(X509_LOOKUP *ctx);
272   int (*ctrl)(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
273               char **ret);
274   int (*get_by_subject)(X509_LOOKUP *ctx, int type, X509_NAME *name,
275                         X509_OBJECT *ret);
276 } /* X509_LOOKUP_METHOD */;
277 
278 DEFINE_STACK_OF(X509_LOOKUP)
279 
280 // This is used to hold everything.  It is used for all certificate
281 // validation.  Once we have a certificate chain, the 'verify'
282 // function is then called to actually check the cert chain.
283 struct x509_store_st {
284   // The following is a cache of trusted certs
285   STACK_OF(X509_OBJECT) *objs;  // Cache of all objects
286   CRYPTO_MUTEX objs_lock;
287 
288   // These are external lookup methods
289   STACK_OF(X509_LOOKUP) *get_cert_methods;
290 
291   X509_VERIFY_PARAM *param;
292 
293   // Callbacks for various operations
294   X509_STORE_CTX_verify_cb verify_cb;       // error callback
295 
296   CRYPTO_refcount_t references;
297 } /* X509_STORE */;
298 
299 // This is the functions plus an instance of the local variables.
300 struct x509_lookup_st {
301   const X509_LOOKUP_METHOD *method;  // the functions
302   void *method_data;           // method data
303 
304   X509_STORE *store_ctx;  // who owns us
305 } /* X509_LOOKUP */;
306 
307 // This is a used when verifying cert chains.  Since the
308 // gathering of the cert chain can take some time (and have to be
309 // 'retried', this needs to be kept and passed around.
310 struct x509_store_ctx_st {
311   X509_STORE *ctx;
312 
313   // The following are set by the caller
314   X509 *cert;                 // The cert to check
315   STACK_OF(X509) *untrusted;  // chain of X509s - untrusted - passed in
316   STACK_OF(X509_CRL) *crls;   // set of CRLs passed in
317 
318   X509_VERIFY_PARAM *param;
319 
320   // trusted_stack, if non-NULL, is a set of trusted certificates to consider
321   // instead of those from |X509_STORE|.
322   STACK_OF(X509) *trusted_stack;
323 
324   // Callbacks for various operations
325   X509_STORE_CTX_verify_cb verify_cb;       // error callback
326 
327   // The following is built up
328   int last_untrusted;     // index of last untrusted cert
329   STACK_OF(X509) *chain;  // chain of X509s - built up and trusted
330 
331   // When something goes wrong, this is why
332   int error_depth;
333   int error;
334   X509 *current_cert;
335   X509_CRL *current_crl;  // current CRL
336 
337   X509 *current_crl_issuer;  // issuer of current CRL
338   int current_crl_score;     // score of current CRL
339 
340   CRYPTO_EX_DATA ex_data;
341 } /* X509_STORE_CTX */;
342 
343 ASN1_TYPE *ASN1_generate_v3(const char *str, const X509V3_CTX *cnf);
344 
345 int X509_CERT_AUX_print(BIO *bp, X509_CERT_AUX *x, int indent);
346 
347 
348 // RSA-PSS functions.
349 
350 // x509_rsa_pss_to_ctx configures |ctx| for an RSA-PSS operation based on
351 // signature algorithm parameters in |sigalg| (which must have type
352 // |NID_rsassaPss|) and key |pkey|. It returns one on success and zero on
353 // error.
354 int x509_rsa_pss_to_ctx(EVP_MD_CTX *ctx, const X509_ALGOR *sigalg,
355                         EVP_PKEY *pkey);
356 
357 // x509_rsa_pss_to_ctx sets |algor| to the signature algorithm parameters for
358 // |ctx|, which must have been configured for an RSA-PSS signing operation. It
359 // returns one on success and zero on error.
360 int x509_rsa_ctx_to_pss(EVP_MD_CTX *ctx, X509_ALGOR *algor);
361 
362 // x509_print_rsa_pss_params prints a human-readable representation of RSA-PSS
363 // parameters in |sigalg| to |bp|. It returns one on success and zero on
364 // error.
365 int x509_print_rsa_pss_params(BIO *bp, const X509_ALGOR *sigalg, int indent,
366                               ASN1_PCTX *pctx);
367 
368 
369 // Signature algorithm functions.
370 
371 // x509_digest_sign_algorithm encodes the signing parameters of |ctx| as an
372 // AlgorithmIdentifier and saves the result in |algor|. It returns one on
373 // success, or zero on error.
374 int x509_digest_sign_algorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor);
375 
376 // x509_digest_verify_init sets up |ctx| for a signature verification operation
377 // with public key |pkey| and parameters from |algor|. The |ctx| argument must
378 // have been initialised with |EVP_MD_CTX_init|. It returns one on success, or
379 // zero on error.
380 int x509_digest_verify_init(EVP_MD_CTX *ctx, const X509_ALGOR *sigalg,
381                             EVP_PKEY *pkey);
382 
383 
384 // Path-building functions.
385 
386 // X509_policy_check checks certificate policies in |certs|. |user_policies| is
387 // the user-initial-policy-set. If |user_policies| is NULL or empty, it is
388 // interpreted as anyPolicy. |flags| is a set of |X509_V_FLAG_*| values to
389 // apply. It returns |X509_V_OK| on success and |X509_V_ERR_*| on error. It
390 // additionally sets |*out_current_cert| to the certificate where the error
391 // occurred. If the function succeeded, or the error applies to the entire
392 // chain, it sets |*out_current_cert| to NULL.
393 int X509_policy_check(const STACK_OF(X509) *certs,
394                       const STACK_OF(ASN1_OBJECT) *user_policies,
395                       unsigned long flags, X509 **out_current_cert);
396 
397 // x509_check_issued_with_callback calls |X509_check_issued|, but allows the
398 // verify callback to override the result. It returns one on success and zero on
399 // error.
400 //
401 // TODO(davidben): Reduce the scope of the verify callback and remove this. The
402 // callback only runs with |X509_V_FLAG_CB_ISSUER_CHECK|, which is only used by
403 // one internal project and rust-openssl, who use it by mistake.
404 int x509_check_issued_with_callback(X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
405 
406 // x509v3_bytes_to_hex encodes |len| bytes from |in| to hex and returns a
407 // newly-allocated NUL-terminated string containing the result, or NULL on
408 // allocation error.
409 //
410 // This function was historically named |hex_to_string| in OpenSSL. Despite the
411 // name, |hex_to_string| converted to hex.
412 OPENSSL_EXPORT char *x509v3_bytes_to_hex(const uint8_t *in, size_t len);
413 
414 // x509v3_hex_string_to_bytes decodes |str| in hex and returns a newly-allocated
415 // array containing the result, or NULL on error. On success, it sets |*len| to
416 // the length of the result. Colon separators between bytes in the input are
417 // allowed and ignored.
418 //
419 // This function was historically named |string_to_hex| in OpenSSL. Despite the
420 // name, |string_to_hex| converted from hex.
421 unsigned char *x509v3_hex_to_bytes(const char *str, size_t *len);
422 
423 // x509v3_conf_name_matches returns one if |name| is equal to |cmp| or begins
424 // with |cmp| followed by '.', and zero otherwise.
425 int x509v3_conf_name_matches(const char *name, const char *cmp);
426 
427 // x509v3_looks_like_dns_name returns one if |in| looks like a DNS name and zero
428 // otherwise.
429 OPENSSL_EXPORT int x509v3_looks_like_dns_name(const unsigned char *in,
430                                               size_t len);
431 
432 // x509v3_cache_extensions fills in a number of fields relating to X.509
433 // extensions in |x|. It returns one on success and zero if some extensions were
434 // invalid.
435 OPENSSL_EXPORT int x509v3_cache_extensions(X509 *x);
436 
437 // x509v3_a2i_ipadd decodes |ipasc| as an IPv4 or IPv6 address. IPv6 addresses
438 // use colon-separated syntax while IPv4 addresses use dotted decimal syntax. If
439 // it decodes an IPv4 address, it writes the result to the first four bytes of
440 // |ipout| and returns four. If it decodes an IPv6 address, it writes the result
441 // to all 16 bytes of |ipout| and returns 16. Otherwise, it returns zero.
442 int x509v3_a2i_ipadd(unsigned char ipout[16], const char *ipasc);
443 
444 // A |BIT_STRING_BITNAME| is used to contain a list of bit names.
445 typedef struct {
446   int bitnum;
447   const char *lname;
448   const char *sname;
449 } BIT_STRING_BITNAME;
450 
451 // x509V3_add_value_asn1_string appends a |CONF_VALUE| with the specified name
452 // and value to |*extlist|. if |*extlist| is NULL, it sets |*extlist| to a
453 // newly-allocated |STACK_OF(CONF_VALUE)| first. It returns one on success and
454 // zero on error.
455 int x509V3_add_value_asn1_string(const char *name, const ASN1_STRING *value,
456                                  STACK_OF(CONF_VALUE) **extlist);
457 
458 // X509V3_NAME_from_section adds attributes to |nm| by interpreting the
459 // key/value pairs in |dn_sk|. It returns one on success and zero on error.
460 // |chtype|, which should be one of |MBSTRING_*| constants, determines the
461 // character encoding used to interpret values.
462 int X509V3_NAME_from_section(X509_NAME *nm, const STACK_OF(CONF_VALUE) *dn_sk,
463                              int chtype);
464 
465 // X509V3_bool_from_string decodes |str| as a boolean. On success, it returns
466 // one and sets |*out_bool| to resulting value. Otherwise, it returns zero.
467 int X509V3_bool_from_string(const char *str, ASN1_BOOLEAN *out_bool);
468 
469 // X509V3_get_value_bool decodes |value| as a boolean. On success, it returns
470 // one and sets |*out_bool| to the resulting value. Otherwise, it returns zero.
471 int X509V3_get_value_bool(const CONF_VALUE *value, ASN1_BOOLEAN *out_bool);
472 
473 // X509V3_get_value_int decodes |value| as an integer. On success, it returns
474 // one and sets |*aint| to the resulting value. Otherwise, it returns zero. If
475 // |*aint| was non-NULL at the start of the function, it frees the previous
476 // value before writing a new one.
477 int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint);
478 
479 // X509V3_get_section behaves like |NCONF_get_section| but queries |ctx|'s
480 // config database.
481 const STACK_OF(CONF_VALUE) *X509V3_get_section(const X509V3_CTX *ctx,
482                                                const char *section);
483 
484 // X509V3_add_value appends a |CONF_VALUE| containing |name| and |value| to
485 // |*extlist|. It returns one on success and zero on error. If |*extlist| is
486 // NULL, it sets |*extlist| to a newly-allocated |STACK_OF(CONF_VALUE)|
487 // containing the result. Either |name| or |value| may be NULL to omit the
488 // field.
489 //
490 // On failure, if |*extlist| was NULL, |*extlist| will remain NULL when the
491 // function returns.
492 int X509V3_add_value(const char *name, const char *value,
493                      STACK_OF(CONF_VALUE) **extlist);
494 
495 // X509V3_add_value_bool behaves like |X509V3_add_value| but stores the value
496 // "TRUE" if |asn1_bool| is non-zero and "FALSE" otherwise.
497 int X509V3_add_value_bool(const char *name, int asn1_bool,
498                           STACK_OF(CONF_VALUE) **extlist);
499 
500 // X509V3_add_value_bool behaves like |X509V3_add_value| but stores a string
501 // representation of |aint|. Note this string representation may be decimal or
502 // hexadecimal, depending on the size of |aint|.
503 int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint,
504                          STACK_OF(CONF_VALUE) **extlist);
505 
506 STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
507 
508 #define X509V3_conf_err(val)                                               \
509   ERR_add_error_data(6, "section:", (val)->section, ",name:", (val)->name, \
510                      ",value:", (val)->value);
511 
512 // GENERAL_NAME_cmp returns zero if |a| and |b| are equal and a non-zero
513 // value otherwise. Note this function does not provide a comparison suitable
514 // for sorting.
515 //
516 // This function is exported for testing.
517 OPENSSL_EXPORT int GENERAL_NAME_cmp(const GENERAL_NAME *a,
518                                     const GENERAL_NAME *b);
519 
520 // X509_VERIFY_PARAM_lookup returns a pre-defined |X509_VERIFY_PARAM| named by
521 // |name|, or NULL if no such name is defined.
522 const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
523 
524 GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method,
525                                const X509V3_CTX *ctx, const CONF_VALUE *cnf);
526 GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
527                                   const X509V3_EXT_METHOD *method,
528                                   const X509V3_CTX *ctx, const CONF_VALUE *cnf,
529                                   int is_nc);
530 GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
531                                  const X509V3_CTX *ctx,
532                                  const STACK_OF(CONF_VALUE) *nval);
533 
534 // TODO(https://crbug.com/boringssl/407): Make |issuer| const once the
535 // |X509_NAME| issue is resolved.
536 int X509_check_akid(X509 *issuer, const AUTHORITY_KEYID *akid);
537 
538 int X509_is_valid_trust_id(int trust);
539 
540 int X509_PURPOSE_get_trust(const X509_PURPOSE *xp);
541 
542 // TODO(https://crbug.com/boringssl/695): Remove this.
543 int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname);
544 
545 
546 #if defined(__cplusplus)
547 }  // extern C
548 #endif
549 
550 #endif  // OPENSSL_HEADER_X509_INTERNAL_H
551