2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
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
11 # define HEADER_APPS_H
13 # include "internal/nelem.h"
15 # if defined(__unix) || defined(__unix__)
16 # include <sys/time.h> /* struct timeval for DTLS */
20 # include <openssl/e_os2.h>
21 # include <openssl/ossl_typ.h>
22 # include <openssl/bio.h>
23 # include <openssl/x509.h>
24 # include <openssl/lhash.h>
25 # include <openssl/conf.h>
26 # include <openssl/txt_db.h>
27 # include <openssl/engine.h>
28 # include <openssl/ocsp.h>
31 # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
32 # define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
34 # define openssl_fdset(a,b) FD_SET(a, b)
38 * quick macro when you need to pass an unsigned char instead of a char.
39 * this is true for some implementations of the is*() functions, for
42 #define _UC(c) ((unsigned char)(c))
44 void app_RAND_load_conf(CONF
*c
, const char *section
);
45 void app_RAND_write(void);
47 extern char *default_config_file
;
51 extern const unsigned char tls13_aes128gcmsha256_id
[];
52 extern const unsigned char tls13_aes256gcmsha384_id
[];
53 BIO
*dup_bio_in(int format
);
54 BIO
*dup_bio_out(int format
);
55 BIO
*dup_bio_err(int format
);
56 BIO
*bio_open_owner(const char *filename
, int format
, int private);
57 BIO
*bio_open_default(const char *filename
, char mode
, int format
);
58 BIO
*bio_open_default_quiet(const char *filename
, char mode
, int format
);
59 CONF
*app_load_config(const char *filename
);
60 CONF
*app_load_config_quiet(const char *filename
);
61 int app_load_modules(const CONF
*config
);
62 void unbuffer(FILE *fp
);
63 void wait_for_async(SSL
*s
);
64 # if defined(OPENSSL_SYS_MSDOS)
65 int has_stdin_waiting(void);
68 void corrupt_signature(const ASN1_STRING
*signature
);
69 int set_cert_times(X509
*x
, const char *startdate
, const char *enddate
,
73 * Common verification options.
77 OPT_V_POLICY, OPT_V_PURPOSE, OPT_V_VERIFY_NAME, OPT_V_VERIFY_DEPTH, \
78 OPT_V_ATTIME, OPT_V_VERIFY_HOSTNAME, OPT_V_VERIFY_EMAIL, \
79 OPT_V_VERIFY_IP, OPT_V_IGNORE_CRITICAL, OPT_V_ISSUER_CHECKS, \
80 OPT_V_CRL_CHECK, OPT_V_CRL_CHECK_ALL, OPT_V_POLICY_CHECK, \
81 OPT_V_EXPLICIT_POLICY, OPT_V_INHIBIT_ANY, OPT_V_INHIBIT_MAP, \
82 OPT_V_X509_STRICT, OPT_V_EXTENDED_CRL, OPT_V_USE_DELTAS, \
83 OPT_V_POLICY_PRINT, OPT_V_CHECK_SS_SIG, OPT_V_TRUSTED_FIRST, \
84 OPT_V_SUITEB_128_ONLY, OPT_V_SUITEB_128, OPT_V_SUITEB_192, \
85 OPT_V_PARTIAL_CHAIN, OPT_V_NO_ALT_CHAINS, OPT_V_NO_CHECK_TIME, \
86 OPT_V_VERIFY_AUTH_LEVEL, OPT_V_ALLOW_PROXY_CERTS, \
89 # define OPT_V_OPTIONS \
90 { "policy", OPT_V_POLICY, 's', "adds policy to the acceptable policy set"}, \
91 { "purpose", OPT_V_PURPOSE, 's', \
92 "certificate chain purpose"}, \
93 { "verify_name", OPT_V_VERIFY_NAME, 's', "verification policy name"}, \
94 { "verify_depth", OPT_V_VERIFY_DEPTH, 'n', \
95 "chain depth limit" }, \
96 { "auth_level", OPT_V_VERIFY_AUTH_LEVEL, 'n', \
97 "chain authentication security level" }, \
98 { "attime", OPT_V_ATTIME, 'M', "verification epoch time" }, \
99 { "verify_hostname", OPT_V_VERIFY_HOSTNAME, 's', \
100 "expected peer hostname" }, \
101 { "verify_email", OPT_V_VERIFY_EMAIL, 's', \
102 "expected peer email" }, \
103 { "verify_ip", OPT_V_VERIFY_IP, 's', \
104 "expected peer IP address" }, \
105 { "ignore_critical", OPT_V_IGNORE_CRITICAL, '-', \
106 "permit unhandled critical extensions"}, \
107 { "issuer_checks", OPT_V_ISSUER_CHECKS, '-', "(deprecated)"}, \
108 { "crl_check", OPT_V_CRL_CHECK, '-', "check leaf certificate revocation" }, \
109 { "crl_check_all", OPT_V_CRL_CHECK_ALL, '-', "check full chain revocation" }, \
110 { "policy_check", OPT_V_POLICY_CHECK, '-', "perform rfc5280 policy checks"}, \
111 { "explicit_policy", OPT_V_EXPLICIT_POLICY, '-', \
112 "set policy variable require-explicit-policy"}, \
113 { "inhibit_any", OPT_V_INHIBIT_ANY, '-', \
114 "set policy variable inhibit-any-policy"}, \
115 { "inhibit_map", OPT_V_INHIBIT_MAP, '-', \
116 "set policy variable inhibit-policy-mapping"}, \
117 { "x509_strict", OPT_V_X509_STRICT, '-', \
118 "disable certificate compatibility work-arounds"}, \
119 { "extended_crl", OPT_V_EXTENDED_CRL, '-', \
120 "enable extended CRL features"}, \
121 { "use_deltas", OPT_V_USE_DELTAS, '-', \
123 { "policy_print", OPT_V_POLICY_PRINT, '-', \
124 "print policy processing diagnostics"}, \
125 { "check_ss_sig", OPT_V_CHECK_SS_SIG, '-', \
126 "check root CA self-signatures"}, \
127 { "trusted_first", OPT_V_TRUSTED_FIRST, '-', \
128 "search trust store first (default)" }, \
129 { "suiteB_128_only", OPT_V_SUITEB_128_ONLY, '-', "Suite B 128-bit-only mode"}, \
130 { "suiteB_128", OPT_V_SUITEB_128, '-', \
131 "Suite B 128-bit mode allowing 192-bit algorithms"}, \
132 { "suiteB_192", OPT_V_SUITEB_192, '-', "Suite B 192-bit-only mode" }, \
133 { "partial_chain", OPT_V_PARTIAL_CHAIN, '-', \
134 "accept chains anchored by intermediate trust-store CAs"}, \
135 { "no_alt_chains", OPT_V_NO_ALT_CHAINS, '-', "(deprecated)" }, \
136 { "no_check_time", OPT_V_NO_CHECK_TIME, '-', "ignore certificate validity time" }, \
137 { "allow_proxy_certs", OPT_V_ALLOW_PROXY_CERTS, '-', "allow the use of proxy certificates" }
139 # define OPT_V_CASES \
140 OPT_V__FIRST: case OPT_V__LAST: break; \
142 case OPT_V_PURPOSE: \
143 case OPT_V_VERIFY_NAME: \
144 case OPT_V_VERIFY_DEPTH: \
145 case OPT_V_VERIFY_AUTH_LEVEL: \
147 case OPT_V_VERIFY_HOSTNAME: \
148 case OPT_V_VERIFY_EMAIL: \
149 case OPT_V_VERIFY_IP: \
150 case OPT_V_IGNORE_CRITICAL: \
151 case OPT_V_ISSUER_CHECKS: \
152 case OPT_V_CRL_CHECK: \
153 case OPT_V_CRL_CHECK_ALL: \
154 case OPT_V_POLICY_CHECK: \
155 case OPT_V_EXPLICIT_POLICY: \
156 case OPT_V_INHIBIT_ANY: \
157 case OPT_V_INHIBIT_MAP: \
158 case OPT_V_X509_STRICT: \
159 case OPT_V_EXTENDED_CRL: \
160 case OPT_V_USE_DELTAS: \
161 case OPT_V_POLICY_PRINT: \
162 case OPT_V_CHECK_SS_SIG: \
163 case OPT_V_TRUSTED_FIRST: \
164 case OPT_V_SUITEB_128_ONLY: \
165 case OPT_V_SUITEB_128: \
166 case OPT_V_SUITEB_192: \
167 case OPT_V_PARTIAL_CHAIN: \
168 case OPT_V_NO_ALT_CHAINS: \
169 case OPT_V_NO_CHECK_TIME: \
170 case OPT_V_ALLOW_PROXY_CERTS
173 * Common "extended validation" options.
175 # define OPT_X_ENUM \
177 OPT_X_KEY, OPT_X_CERT, OPT_X_CHAIN, OPT_X_CHAIN_BUILD, \
178 OPT_X_CERTFORM, OPT_X_KEYFORM, \
181 # define OPT_X_OPTIONS \
182 { "xkey", OPT_X_KEY, '<', "key for Extended certificates"}, \
183 { "xcert", OPT_X_CERT, '<', "cert for Extended certificates"}, \
184 { "xchain", OPT_X_CHAIN, '<', "chain for Extended certificates"}, \
185 { "xchain_build", OPT_X_CHAIN_BUILD, '-', \
186 "build certificate chain for the extended certificates"}, \
187 { "xcertform", OPT_X_CERTFORM, 'F', \
188 "format of Extended certificate (PEM or DER) PEM default " }, \
189 { "xkeyform", OPT_X_KEYFORM, 'F', \
190 "format of Extended certificate's key (PEM or DER) PEM default"}
192 # define OPT_X_CASES \
193 OPT_X__FIRST: case OPT_X__LAST: break; \
197 case OPT_X_CHAIN_BUILD: \
198 case OPT_X_CERTFORM: \
202 * Common SSL options.
203 * Any changes here must be coordinated with ../ssl/ssl_conf.c
205 # define OPT_S_ENUM \
207 OPT_S_NOSSL3, OPT_S_NOTLS1, OPT_S_NOTLS1_1, OPT_S_NOTLS1_2, \
208 OPT_S_NOTLS1_3, OPT_S_BUGS, OPT_S_NO_COMP, OPT_S_NOTICKET, \
209 OPT_S_SERVERPREF, OPT_S_LEGACYRENEG, OPT_S_LEGACYCONN, \
210 OPT_S_ONRESUMP, OPT_S_NOLEGACYCONN, OPT_S_ALLOW_NO_DHE_KEX, \
211 OPT_S_STRICT, OPT_S_SIGALGS, OPT_S_CLIENTSIGALGS, OPT_S_GROUPS, \
212 OPT_S_CURVES, OPT_S_NAMEDCURVE, OPT_S_CIPHER, OPT_S_DHPARAM, \
213 OPT_S_RECORD_PADDING, OPT_S_DEBUGBROKE, OPT_S_COMP, \
214 OPT_S_NO_RENEGOTIATION, OPT_S__LAST
216 # define OPT_S_OPTIONS \
217 {"no_ssl3", OPT_S_NOSSL3, '-',"Just disable SSLv3" }, \
218 {"no_tls1", OPT_S_NOTLS1, '-', "Just disable TLSv1"}, \
219 {"no_tls1_1", OPT_S_NOTLS1_1, '-', "Just disable TLSv1.1" }, \
220 {"no_tls1_2", OPT_S_NOTLS1_2, '-', "Just disable TLSv1.2"}, \
221 {"no_tls1_3", OPT_S_NOTLS1_3, '-', "Just disable TLSv1.3"}, \
222 {"bugs", OPT_S_BUGS, '-', "Turn on SSL bug compatibility"}, \
223 {"no_comp", OPT_S_NO_COMP, '-', "Disable SSL/TLS compression (default)" }, \
224 {"comp", OPT_S_COMP, '-', "Use SSL/TLS-level compression" }, \
225 {"no_ticket", OPT_S_NOTICKET, '-', \
226 "Disable use of TLS session tickets"}, \
227 {"serverpref", OPT_S_SERVERPREF, '-', "Use server's cipher preferences"}, \
228 {"legacy_renegotiation", OPT_S_LEGACYRENEG, '-', \
229 "Enable use of legacy renegotiation (dangerous)"}, \
230 {"no_renegotiation", OPT_S_NO_RENEGOTIATION, '-', \
231 "Disable all renegotiation."}, \
232 {"legacy_server_connect", OPT_S_LEGACYCONN, '-', \
233 "Allow initial connection to servers that don't support RI"}, \
234 {"no_resumption_on_reneg", OPT_S_ONRESUMP, '-', \
235 "Disallow session resumption on renegotiation"}, \
236 {"no_legacy_server_connect", OPT_S_NOLEGACYCONN, '-', \
237 "Disallow initial connection to servers that don't support RI"}, \
238 {"allow_no_dhe_kex", OPT_S_ALLOW_NO_DHE_KEX, '-', \
239 "In TLSv1.3 allow non-(ec)dhe based key exchange on resumption"}, \
240 {"strict", OPT_S_STRICT, '-', \
241 "Enforce strict certificate checks as per TLS standard"}, \
242 {"sigalgs", OPT_S_SIGALGS, 's', \
243 "Signature algorithms to support (colon-separated list)" }, \
244 {"client_sigalgs", OPT_S_CLIENTSIGALGS, 's', \
245 "Signature algorithms to support for client certificate" \
246 " authentication (colon-separated list)" }, \
247 {"groups", OPT_S_GROUPS, 's', \
248 "Groups to advertise (colon-separated list)" }, \
249 {"curves", OPT_S_CURVES, 's', \
250 "Groups to advertise (colon-separated list)" }, \
251 {"named_curve", OPT_S_NAMEDCURVE, 's', \
252 "Elliptic curve used for ECDHE (server-side only)" }, \
253 {"cipher", OPT_S_CIPHER, 's', "Specify cipher list to be used"}, \
254 {"dhparam", OPT_S_DHPARAM, '<', \
255 "DH parameter file to use, in cert file if not specified"}, \
256 {"record_padding", OPT_S_RECORD_PADDING, 's', \
257 "Block size to pad TLS 1.3 records to."}, \
258 {"debug_broken_protocol", OPT_S_DEBUGBROKE, '-', \
259 "Perform all sorts of protocol violations for testing purposes"}
262 # define OPT_S_CASES \
263 OPT_S__FIRST: case OPT_S__LAST: break; \
266 case OPT_S_NOTLS1_1: \
267 case OPT_S_NOTLS1_2: \
268 case OPT_S_NOTLS1_3: \
270 case OPT_S_NO_COMP: \
272 case OPT_S_NOTICKET: \
273 case OPT_S_SERVERPREF: \
274 case OPT_S_LEGACYRENEG: \
275 case OPT_S_LEGACYCONN: \
276 case OPT_S_ONRESUMP: \
277 case OPT_S_NOLEGACYCONN: \
278 case OPT_S_ALLOW_NO_DHE_KEX: \
280 case OPT_S_SIGALGS: \
281 case OPT_S_CLIENTSIGALGS: \
284 case OPT_S_NAMEDCURVE: \
286 case OPT_S_DHPARAM: \
287 case OPT_S_RECORD_PADDING: \
288 case OPT_S_NO_RENEGOTIATION: \
289 case OPT_S_DEBUGBROKE
291 #define IS_NO_PROT_FLAG(o) \
292 (o == OPT_S_NOSSL3 || o == OPT_S_NOTLS1 || o == OPT_S_NOTLS1_1 \
293 || o == OPT_S_NOTLS1_2 || o == OPT_S_NOTLS1_3)
296 * Random state options.
298 # define OPT_R_ENUM \
299 OPT_R__FIRST=1500, OPT_R_RAND, OPT_R_WRITERAND, OPT_R__LAST
301 # define OPT_R_OPTIONS \
302 {"rand", OPT_R_RAND, 's', "Load the file(s) into the random number generator"}, \
303 {"writerand", OPT_R_WRITERAND, '>', "Write random data to the specified file"}
305 # define OPT_R_CASES \
306 OPT_R__FIRST: case OPT_R__LAST: break; \
307 case OPT_R_RAND: case OPT_R_WRITERAND
312 extern const char OPT_HELP_STR
[];
313 extern const char OPT_MORE_STR
[];
314 typedef struct options_st
{
318 * value type: - no value (also the value zero), n number, p positive
319 * number, u unsigned, l long, s string, < input file, > output file,
320 * f any format, F der/pem format, E der/pem/engine format identifier.
321 * l, n and u include zero; p does not.
328 * A string/int pairing; widely use for option value lookup, hence the
329 * name OPT_PAIR. But that name is misleading in s_cb.c, so we also use
330 * the "generic" name STRINT_PAIR.
332 typedef struct string_int_pair_st
{
335 } OPT_PAIR
, STRINT_PAIR
;
337 /* Flags to pass into opt_format; see FORMAT_xxx, below. */
338 # define OPT_FMT_PEMDER (1L << 1)
339 # define OPT_FMT_PKCS12 (1L << 2)
340 # define OPT_FMT_SMIME (1L << 3)
341 # define OPT_FMT_ENGINE (1L << 4)
342 # define OPT_FMT_MSBLOB (1L << 5)
343 # define OPT_FMT_NETSCAPE (1L << 6)
344 # define OPT_FMT_NSS (1L << 7)
345 # define OPT_FMT_TEXT (1L << 8)
346 # define OPT_FMT_HTTP (1L << 9)
347 # define OPT_FMT_PVK (1L << 10)
348 # define OPT_FMT_PDE (OPT_FMT_PEMDER | OPT_FMT_ENGINE)
349 # define OPT_FMT_PDS (OPT_FMT_PEMDER | OPT_FMT_SMIME)
350 # define OPT_FMT_ANY ( \
351 OPT_FMT_PEMDER | OPT_FMT_PKCS12 | OPT_FMT_SMIME | \
352 OPT_FMT_ENGINE | OPT_FMT_MSBLOB | OPT_FMT_NETSCAPE | \
353 OPT_FMT_NSS | OPT_FMT_TEXT | OPT_FMT_HTTP | OPT_FMT_PVK)
355 char *opt_progname(const char *argv0
);
356 char *opt_getprog(void);
357 char *opt_init(int ac
, char **av
, const OPTIONS
* o
);
359 int opt_format(const char *s
, unsigned long flags
, int *result
);
360 int opt_int(const char *arg
, int *result
);
361 int opt_ulong(const char *arg
, unsigned long *result
);
362 int opt_long(const char *arg
, long *result
);
363 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \
364 defined(INTMAX_MAX) && defined(UINTMAX_MAX)
365 int opt_imax(const char *arg
, intmax_t *result
);
366 int opt_umax(const char *arg
, uintmax_t *result
);
368 # define opt_imax opt_long
369 # define opt_umax opt_ulong
370 # define intmax_t long
371 # define uintmax_t unsigned long
373 int opt_pair(const char *arg
, const OPT_PAIR
* pairs
, int *result
);
374 int opt_cipher(const char *name
, const EVP_CIPHER
**cipherp
);
375 int opt_md(const char *name
, const EVP_MD
**mdp
);
377 char *opt_flag(void);
378 char *opt_unknown(void);
379 char **opt_rest(void);
380 int opt_num_rest(void);
381 int opt_verify(int i
, X509_VERIFY_PARAM
*vpm
);
383 void opt_help(const OPTIONS
* list
);
384 int opt_format_error(const char *s
, unsigned long flags
);
386 typedef struct args_st
{
393 * VMS C only for now, implemented in vms_decc_init.c
394 * If other C compilers forget to terminate argv with NULL, this function
397 char **copy_argv(int *argc
, char *argv
[]);
399 * Win32-specific argv initialization that splits OS-supplied UNICODE
400 * command line string to array of UTF8-encoded strings.
402 void win32_utf8argv(int *argc
, char **argv
[]);
405 # define PW_MIN_LENGTH 4
406 typedef struct pw_cb_data
{
407 const void *password
;
408 const char *prompt_info
;
411 int password_callback(char *buf
, int bufsiz
, int verify
, PW_CB_DATA
*cb_data
);
413 int setup_ui_method(void);
414 void destroy_ui_method(void);
415 const UI_METHOD
*get_ui_method(void);
417 int chopup_args(ARGS
*arg
, char *buf
);
418 # ifdef HEADER_X509_H
419 int dump_cert_text(BIO
*out
, X509
*x
);
420 void print_name(BIO
*out
, const char *title
, X509_NAME
*nm
,
421 unsigned long lflags
);
423 void print_bignum_var(BIO
*, const BIGNUM
*, const char*,
424 int, unsigned char *);
425 void print_array(BIO
*, const char *, int, const unsigned char *);
426 int set_nameopt(const char *arg
);
427 unsigned long get_nameopt(void);
428 int set_cert_ex(unsigned long *flags
, const char *arg
);
429 int set_name_ex(unsigned long *flags
, const char *arg
);
430 int set_ext_copy(int *copy_type
, const char *arg
);
431 int copy_extensions(X509
*x
, X509_REQ
*req
, int copy_type
);
432 int app_passwd(const char *arg1
, const char *arg2
, char **pass1
, char **pass2
);
433 int add_oid_section(CONF
*conf
);
434 X509
*load_cert(const char *file
, int format
, const char *cert_descrip
);
435 X509_CRL
*load_crl(const char *infile
, int format
);
436 EVP_PKEY
*load_key(const char *file
, int format
, int maybe_stdin
,
437 const char *pass
, ENGINE
*e
, const char *key_descrip
);
438 EVP_PKEY
*load_pubkey(const char *file
, int format
, int maybe_stdin
,
439 const char *pass
, ENGINE
*e
, const char *key_descrip
);
440 int load_certs(const char *file
, STACK_OF(X509
) **certs
, int format
,
441 const char *pass
, const char *cert_descrip
);
442 int load_crls(const char *file
, STACK_OF(X509_CRL
) **crls
, int format
,
443 const char *pass
, const char *cert_descrip
);
444 X509_STORE
*setup_verify(const char *CAfile
, const char *CApath
,
445 int noCAfile
, int noCApath
);
446 __owur
int ctx_set_verify_locations(SSL_CTX
*ctx
, const char *CAfile
,
447 const char *CApath
, int noCAfile
,
450 #ifndef OPENSSL_NO_CT
453 * Sets the file to load the Certificate Transparency log list from.
454 * If path is NULL, loads from the default file path.
455 * Returns 1 on success, 0 otherwise.
457 __owur
int ctx_set_ctlog_list_file(SSL_CTX
*ctx
, const char *path
);
461 ENGINE
*setup_engine(const char *engine
, int debug
);
462 void release_engine(ENGINE
*e
);
464 # ifndef OPENSSL_NO_OCSP
465 OCSP_RESPONSE
*process_responder(OCSP_REQUEST
*req
,
466 const char *host
, const char *path
,
467 const char *port
, int use_ssl
,
468 STACK_OF(CONF_VALUE
) *headers
,
472 /* Functions defined in ca.c and also used in ocsp.c */
473 int unpack_revinfo(ASN1_TIME
**prevtm
, int *preason
, ASN1_OBJECT
**phold
,
474 ASN1_GENERALIZEDTIME
**pinvtm
, const char *str
);
477 # define DB_exp_date 1
478 # define DB_rev_date 2
479 # define DB_serial 3 /* index - unique */
481 # define DB_name 5 /* index - unique when active and not
485 # define DB_TYPE_REV 'R' /* Revoked */
486 # define DB_TYPE_EXP 'E' /* Expired */
487 # define DB_TYPE_VAL 'V' /* Valid ; inserted with: ca ... -valid */
488 # define DB_TYPE_SUSP 'S' /* Suspended */
490 typedef struct db_attr_st
{
493 typedef struct ca_db_st
{
498 void* app_malloc(int sz
, const char *what
);
499 BIGNUM
*load_serial(const char *serialfile
, int create
, ASN1_INTEGER
**retai
);
500 int save_serial(const char *serialfile
, const char *suffix
, const BIGNUM
*serial
,
501 ASN1_INTEGER
**retai
);
502 int rotate_serial(const char *serialfile
, const char *new_suffix
,
503 const char *old_suffix
);
504 int rand_serial(BIGNUM
*b
, ASN1_INTEGER
*ai
);
505 CA_DB
*load_index(const char *dbfile
, DB_ATTR
*dbattr
);
506 int index_index(CA_DB
*db
);
507 int save_index(const char *dbfile
, const char *suffix
, CA_DB
*db
);
508 int rotate_index(const char *dbfile
, const char *new_suffix
,
509 const char *old_suffix
);
510 void free_index(CA_DB
*db
);
511 # define index_name_cmp_noconst(a, b) \
512 index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \
513 (const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
514 int index_name_cmp(const OPENSSL_CSTRING
*a
, const OPENSSL_CSTRING
*b
);
515 int parse_yesno(const char *str
, int def
);
517 X509_NAME
*parse_name(const char *str
, long chtype
, int multirdn
);
518 void policies_print(X509_STORE_CTX
*ctx
);
519 int bio_to_mem(unsigned char **out
, int maxlen
, BIO
*in
);
520 int pkey_ctrl_string(EVP_PKEY_CTX
*ctx
, const char *value
);
521 int init_gen_str(EVP_PKEY_CTX
**pctx
,
522 const char *algname
, ENGINE
*e
, int do_param
);
523 int do_X509_sign(X509
*x
, EVP_PKEY
*pkey
, const EVP_MD
*md
,
524 STACK_OF(OPENSSL_STRING
) *sigopts
);
525 int do_X509_REQ_sign(X509_REQ
*x
, EVP_PKEY
*pkey
, const EVP_MD
*md
,
526 STACK_OF(OPENSSL_STRING
) *sigopts
);
527 int do_X509_CRL_sign(X509_CRL
*x
, EVP_PKEY
*pkey
, const EVP_MD
*md
,
528 STACK_OF(OPENSSL_STRING
) *sigopts
);
530 extern char *psk_key
;
533 unsigned char *next_protos_parse(size_t *outlen
, const char *in
);
535 void print_cert_checks(BIO
*bio
, X509
*x
,
536 const char *checkhost
,
537 const char *checkemail
, const char *checkip
);
539 void store_setup_crl_download(X509_STORE
*st
);
541 /* See OPT_FMT_xxx, above. */
542 /* On some platforms, it's important to distinguish between text and binary
543 * files. On some, there might even be specific file formats for different
544 * contents. The FORMAT_xxx macros are meant to express an intent with the
545 * file being read or created.
547 # define B_FORMAT_TEXT 0x8000
548 # define FORMAT_UNDEF 0
549 # define FORMAT_TEXT (1 | B_FORMAT_TEXT) /* Generic text */
550 # define FORMAT_BINARY 2 /* Generic binary */
551 # define FORMAT_BASE64 (3 | B_FORMAT_TEXT) /* Base64 */
552 # define FORMAT_ASN1 4 /* ASN.1/DER */
553 # define FORMAT_PEM (5 | B_FORMAT_TEXT)
554 # define FORMAT_PKCS12 6
555 # define FORMAT_SMIME (7 | B_FORMAT_TEXT)
556 # define FORMAT_ENGINE 8 /* Not really a file format */
557 # define FORMAT_PEMRSA (9 | B_FORMAT_TEXT) /* PEM RSAPubicKey format */
558 # define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */
559 # define FORMAT_MSBLOB 11 /* MS Key blob format */
560 # define FORMAT_PVK 12 /* MS PVK file format */
561 # define FORMAT_HTTP 13 /* Download using HTTP */
562 # define FORMAT_NSS 14 /* NSS keylog format */
564 # define EXT_COPY_NONE 0
565 # define EXT_COPY_ADD 1
566 # define EXT_COPY_ALL 2
568 # define NETSCAPE_CERT_HDR "certificate"
570 # define APP_PASS_LEN 1024
573 * IETF RFC 5280 says serial number must be <= 20 bytes. Use 159 bits
574 * so that the first bit will never be one, so that the DER encoding
575 * rules won't force a leading octet.
577 # define SERIAL_RAND_BITS 159
579 int app_isdir(const char *);
580 int app_access(const char *, int flag
);
581 int fileno_stdin(void);
582 int fileno_stdout(void);
583 int raw_read_stdin(void *, int);
584 int raw_write_stdout(const void *, int);
588 double app_tminterval(int stop
, int usertime
);
590 void make_uppercase(char *string
);
592 typedef struct verify_options_st
{
599 extern VERIFY_CB_ARGS verify_args
;