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