2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
58 /* ====================================================================
59 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
87 * 6. Redistributions of any form whatsoever must retain the following
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
112 #ifndef HEADER_APPS_H
113 # define HEADER_APPS_H
118 # include <openssl/bio.h>
119 # include <openssl/x509.h>
120 # include <openssl/lhash.h>
121 # include <openssl/conf.h>
122 # include <openssl/txt_db.h>
123 # ifndef OPENSSL_NO_ENGINE
124 # include <openssl/engine.h>
126 # ifndef OPENSSL_NO_OCSP
127 # include <openssl/ocsp.h>
129 # include <openssl/ossl_typ.h>
130 # ifndef OPENSSL_SYS_NETWARE
134 # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
135 # define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
137 # define openssl_fdset(a,b) FD_SET(a, b)
140 int app_RAND_load_file(const char *file, int dont_warn);
141 int app_RAND_write_file(const char *file);
143 * When `file' is NULL, use defaults. `bio_e' is for error messages.
145 void app_RAND_allow_write_file(void);
146 long app_RAND_load_files(char *file); /* `file' is a list of files to read,
147 * separated by LIST_SEPARATOR_CHAR
148 * (see e_os.h). The string is
151 extern char *default_config_file;
155 BIO *dup_bio_in(void);
156 BIO *dup_bio_out(void);
157 BIO *bio_open_owner(const char *filename, const char *mode, int private);
158 BIO *bio_open_default(const char *filename, const char *mode);
159 BIO *bio_open_default_quiet(const char *filename, const char *mode);
160 CONF *app_load_config(const char *filename);
161 CONF *app_load_config_quiet(const char *filename);
162 int app_load_modules(const CONF *config);
163 void unbuffer(FILE *fp);
165 /* Often used in calls to bio_open_default. */
166 # define RB(xformat) (((xformat) & B_FORMAT_TEXT) ? "rb" : "r")
167 # define WB(xformat) (((xformat) & B_FORMAT_TEXT) ? "wb" : "w")
168 # define AB(xformat) (((xformat) & B_FORMAT_TEXT) ? "ab" : "a")
171 * Common verification options.
173 # define OPT_V_ENUM \
175 OPT_V_POLICY, OPT_V_PURPOSE, OPT_V_VERIFY_NAME, OPT_V_VERIFY_DEPTH, \
176 OPT_V_ATTIME, OPT_V_VERIFY_HOSTNAME, OPT_V_VERIFY_EMAIL, \
177 OPT_V_VERIFY_IP, OPT_V_IGNORE_CRITICAL, OPT_V_ISSUER_CHECKS, \
178 OPT_V_CRL_CHECK, OPT_V_CRL_CHECK_ALL, OPT_V_POLICY_CHECK, \
179 OPT_V_EXPLICIT_POLICY, OPT_V_INHIBIT_ANY, OPT_V_INHIBIT_MAP, \
180 OPT_V_X509_STRICT, OPT_V_EXTENDED_CRL, OPT_V_USE_DELTAS, \
181 OPT_V_POLICY_PRINT, OPT_V_CHECK_SS_SIG, OPT_V_TRUSTED_FIRST, \
182 OPT_V_SUITEB_128_ONLY, OPT_V_SUITEB_128, OPT_V_SUITEB_192, \
183 OPT_V_PARTIAL_CHAIN, OPT_V_NO_ALT_CHAINS, OPT_V_NO_CHECK_TIME, \
186 # define OPT_V_OPTIONS \
187 { "policy", OPT_V_POLICY, 's' }, \
188 { "purpose", OPT_V_PURPOSE, 's' }, \
189 { "verify_name", OPT_V_VERIFY_NAME, 's' }, \
190 { "verify_depth", OPT_V_VERIFY_DEPTH, 'p' }, \
191 { "attime", OPT_V_ATTIME, 'p' }, \
192 { "verify_hostname", OPT_V_VERIFY_HOSTNAME, 's' }, \
193 { "verify_email", OPT_V_VERIFY_EMAIL, 's' }, \
194 { "verify_ip", OPT_V_VERIFY_IP, 's' }, \
195 { "ignore_critical", OPT_V_IGNORE_CRITICAL, '-' }, \
196 { "issuer_checks", OPT_V_ISSUER_CHECKS, '-' }, \
197 { "crl_check", OPT_V_CRL_CHECK, '-', "Check that peer cert has not been revoked" }, \
198 { "crl_check_all", OPT_V_CRL_CHECK_ALL, '-', "Also check all certs in the chain" }, \
199 { "policy_check", OPT_V_POLICY_CHECK, '-' }, \
200 { "explicit_policy", OPT_V_EXPLICIT_POLICY, '-' }, \
201 { "inhibit_any", OPT_V_INHIBIT_ANY, '-' }, \
202 { "inhibit_map", OPT_V_INHIBIT_MAP, '-' }, \
203 { "x509_strict", OPT_V_X509_STRICT, '-' }, \
204 { "extended_crl", OPT_V_EXTENDED_CRL, '-' }, \
205 { "use_deltas", OPT_V_USE_DELTAS, '-' }, \
206 { "policy_print", OPT_V_POLICY_PRINT, '-' }, \
207 { "check_ss_sig", OPT_V_CHECK_SS_SIG, '-' }, \
208 { "trusted_first", OPT_V_TRUSTED_FIRST, '-', "Use locally-trusted CA's first in building chain" }, \
209 { "suiteB_128_only", OPT_V_SUITEB_128_ONLY, '-' }, \
210 { "suiteB_128", OPT_V_SUITEB_128, '-' }, \
211 { "suiteB_192", OPT_V_SUITEB_192, '-' }, \
212 { "partial_chain", OPT_V_PARTIAL_CHAIN, '-' }, \
213 { "no_alt_chains", OPT_V_NO_ALT_CHAINS, '-', "Only use the first cert chain found" }, \
214 { "no_check_time", OPT_V_NO_CHECK_TIME, '-', "Do not check validity against current time" }
216 # define OPT_V_CASES \
217 OPT_V__FIRST: case OPT_V__LAST: break; \
219 case OPT_V_PURPOSE: \
220 case OPT_V_VERIFY_NAME: \
221 case OPT_V_VERIFY_DEPTH: \
223 case OPT_V_VERIFY_HOSTNAME: \
224 case OPT_V_VERIFY_EMAIL: \
225 case OPT_V_VERIFY_IP: \
226 case OPT_V_IGNORE_CRITICAL: \
227 case OPT_V_ISSUER_CHECKS: \
228 case OPT_V_CRL_CHECK: \
229 case OPT_V_CRL_CHECK_ALL: \
230 case OPT_V_POLICY_CHECK: \
231 case OPT_V_EXPLICIT_POLICY: \
232 case OPT_V_INHIBIT_ANY: \
233 case OPT_V_INHIBIT_MAP: \
234 case OPT_V_X509_STRICT: \
235 case OPT_V_EXTENDED_CRL: \
236 case OPT_V_USE_DELTAS: \
237 case OPT_V_POLICY_PRINT: \
238 case OPT_V_CHECK_SS_SIG: \
239 case OPT_V_TRUSTED_FIRST: \
240 case OPT_V_SUITEB_128_ONLY: \
241 case OPT_V_SUITEB_128: \
242 case OPT_V_SUITEB_192: \
243 case OPT_V_PARTIAL_CHAIN: \
244 case OPT_V_NO_ALT_CHAINS: \
245 case OPT_V_NO_CHECK_TIME
248 * Common "extended"? options.
250 # define OPT_X_ENUM \
252 OPT_X_KEY, OPT_X_CERT, OPT_X_CHAIN, OPT_X_CHAIN_BUILD, \
253 OPT_X_CERTFORM, OPT_X_KEYFORM, \
256 # define OPT_X_OPTIONS \
257 { "xkey", OPT_X_KEY, '<' }, \
258 { "xcert", OPT_X_CERT, '<' }, \
259 { "xchain", OPT_X_CHAIN, '<' }, \
260 { "xchain_build", OPT_X_CHAIN_BUILD, '-' }, \
261 { "xcertform", OPT_X_CERTFORM, 'F' }, \
262 { "xkeyform", OPT_X_KEYFORM, 'F' }
264 # define OPT_X_CASES \
265 OPT_X__FIRST: case OPT_X__LAST: break; \
269 case OPT_X_CHAIN_BUILD: \
270 case OPT_X_CERTFORM: \
274 * Common SSL options.
275 * Any changes here must be coordinated with ../ssl/ssl_conf.c
277 # define OPT_S_ENUM \
279 OPT_S_NOSSL3, OPT_S_NOTLS1, OPT_S_NOTLS1_1, OPT_S_NOTLS1_2, \
280 OPT_S_BUGS, OPT_S_NOCOMP, OPT_S_ECDHSINGLE, OPT_S_NOTICKET, \
281 OPT_S_SERVERPREF, OPT_S_LEGACYRENEG, OPT_S_LEGACYCONN, \
282 OPT_S_ONRESUMP, OPT_S_NOLEGACYCONN, OPT_S_STRICT, OPT_S_SIGALGS, \
283 OPT_S_CLIENTSIGALGS, OPT_S_CURVES, OPT_S_NAMEDCURVE, OPT_S_CIPHER, \
284 OPT_S_DHPARAM, OPT_S_DEBUGBROKE, \
287 # define OPT_S_OPTIONS \
288 {"no_ssl3", OPT_S_NOSSL3, '-' }, \
289 {"no_tls1", OPT_S_NOTLS1, '-' }, \
290 {"no_tls1_1", OPT_S_NOTLS1_1, '-' }, \
291 {"no_tls1_2", OPT_S_NOTLS1_2, '-' }, \
292 {"bugs", OPT_S_BUGS, '-' }, \
293 {"no_comp", OPT_S_NOCOMP, '-', "Don't use SSL/TLS-level compression" }, \
294 {"ecdh_single", OPT_S_ECDHSINGLE, '-' }, \
295 {"no_ticket", OPT_S_NOTICKET, '-' }, \
296 {"serverpref", OPT_S_SERVERPREF, '-' }, \
297 {"legacy_renegotiation", OPT_S_LEGACYRENEG, '-' }, \
298 {"legacy_server_connect", OPT_S_LEGACYCONN, '-' }, \
299 {"no_resumption_on_reneg", OPT_S_ONRESUMP, '-' }, \
300 {"no_legacy_server_connect", OPT_S_NOLEGACYCONN, '-' }, \
301 {"strict", OPT_S_STRICT, '-' }, \
302 {"sigalgs", OPT_S_SIGALGS, 's', \
303 "Signature algorithms to support (colon-separated list)" }, \
304 {"client_sigalgs", OPT_S_CLIENTSIGALGS, 's', \
305 "Signature algorithms to support for client certificate" \
306 " authentication (colon-separated list)" }, \
307 {"curves", OPT_S_CURVES, 's', \
308 "Elliptic curves to advertise (colon-separated list)" }, \
309 {"named_curve", OPT_S_NAMEDCURVE, 's', \
310 "Elliptic curve used for ECDHE (server-side only)" }, \
311 {"cipher", OPT_S_CIPHER, 's', }, \
312 {"dhparam", OPT_S_DHPARAM, '<' }, \
313 {"debug_broken_protocol", OPT_S_DEBUGBROKE, '-' }
315 # define OPT_S_CASES \
316 OPT_S__FIRST: case OPT_S__LAST: break; \
319 case OPT_S_NOTLS1_1: \
320 case OPT_S_NOTLS1_2: \
323 case OPT_S_ECDHSINGLE: \
324 case OPT_S_NOTICKET: \
325 case OPT_S_SERVERPREF: \
326 case OPT_S_LEGACYRENEG: \
327 case OPT_S_LEGACYCONN: \
328 case OPT_S_ONRESUMP: \
329 case OPT_S_NOLEGACYCONN: \
331 case OPT_S_SIGALGS: \
332 case OPT_S_CLIENTSIGALGS: \
334 case OPT_S_NAMEDCURVE: \
336 case OPT_S_DHPARAM: \
337 case OPT_S_DEBUGBROKE
342 extern const char OPT_HELP_STR[];
343 extern const char OPT_MORE_STR[];
344 typedef struct options_st {
348 * value type: - no value (also the value zero), n number, p positive
349 * number, u unsigned, s string, < input file, > output file, f der/pem
350 * format, F any format identifier. n and u include zero; p does not.
357 * A string/int pairing; widely use for option value lookup, hence the
358 * name OPT_PAIR. But that name is misleading in s_cb.c, so we also use
359 * the "generic" name STRINT_PAIR.
361 typedef struct string_int_pair_st {
364 } OPT_PAIR, STRINT_PAIR;
366 /* Flags to pass into opt_format; see FORMAT_xxx, below. */
367 # define OPT_FMT_PEMDER (1L << 1)
368 # define OPT_FMT_PKCS12 (1L << 2)
369 # define OPT_FMT_SMIME (1L << 3)
370 # define OPT_FMT_ENGINE (1L << 4)
371 # define OPT_FMT_MSBLOB (1L << 5)
372 # define OPT_FMT_NETSCAPE (1L << 6)
373 # define OPT_FMT_NSS (1L << 7)
374 # define OPT_FMT_TEXT (1L << 8)
375 # define OPT_FMT_HTTP (1L << 9)
376 # define OPT_FMT_PVK (1L << 10)
377 # define OPT_FMT_ANY ( \
378 OPT_FMT_PEMDER | OPT_FMT_PKCS12 | OPT_FMT_SMIME | \
379 OPT_FMT_ENGINE | OPT_FMT_MSBLOB | OPT_FMT_NETSCAPE | \
380 OPT_FMT_NSS | OPT_FMT_TEXT | OPT_FMT_HTTP | OPT_FMT_PVK)
382 char *opt_progname(const char *argv0);
383 char *opt_getprog(void);
384 char *opt_init(int ac, char **av, const OPTIONS * o);
386 int opt_format(const char *s, unsigned long flags, int *result);
387 int opt_int(const char *arg, int *result);
388 int opt_ulong(const char *arg, unsigned long *result);
389 int opt_long(const char *arg, long *result);
390 int opt_pair(const char *arg, const OPT_PAIR * pairs, int *result);
391 int opt_cipher(const char *name, const EVP_CIPHER **cipherp);
392 int opt_md(const char *name, const EVP_MD **mdp);
394 char *opt_flag(void);
395 char *opt_unknown(void);
396 char *opt_reset(void);
397 char **opt_rest(void);
398 int opt_num_rest(void);
399 int opt_verify(int i, X509_VERIFY_PARAM *vpm);
400 void opt_help(const OPTIONS * list);
401 int opt_format_error(const char *s, unsigned long flags);
404 typedef struct args_st {
410 # define PW_MIN_LENGTH 4
411 typedef struct pw_cb_data {
412 const void *password;
413 const char *prompt_info;
416 int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data);
418 int setup_ui_method(void);
419 void destroy_ui_method(void);
421 int chopup_args(ARGS *arg, char *buf);
422 # ifdef HEADER_X509_H
423 int dump_cert_text(BIO *out, X509 *x);
424 void print_name(BIO *out, const char *title, X509_NAME *nm,
425 unsigned long lflags);
427 void print_bignum_var(BIO *, BIGNUM *, const char*, int, unsigned char *);
428 void print_array(BIO *, const char *, int, const unsigned char *);
429 int set_cert_ex(unsigned long *flags, const char *arg);
430 int set_name_ex(unsigned long *flags, const char *arg);
431 int set_ext_copy(int *copy_type, const char *arg);
432 int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
433 int app_passwd(char *arg1, char *arg2, char **pass1, char **pass2);
434 int add_oid_section(CONF *conf);
435 X509 *load_cert(const char *file, int format,
436 const char *pass, ENGINE *e, const char *cert_descrip);
437 X509_CRL *load_crl(const char *infile, int format);
438 int load_cert_crl_http(const char *url, X509 **pcert, X509_CRL **pcrl);
439 EVP_PKEY *load_key(const char *file, int format, int maybe_stdin,
440 const char *pass, ENGINE *e, const char *key_descrip);
441 EVP_PKEY *load_pubkey(const char *file, int format, int maybe_stdin,
442 const char *pass, ENGINE *e, const char *key_descrip);
443 STACK_OF(X509) *load_certs(const char *file, int format,
444 const char *pass, ENGINE *e,
445 const char *cert_descrip);
446 STACK_OF(X509_CRL) *load_crls(const char *file, int format,
447 const char *pass, ENGINE *e,
448 const char *cert_descrip);
449 X509_STORE *setup_verify(char *CAfile, char *CApath);
450 int ctx_set_verify_locations(SSL_CTX *ctx,
451 const char *CAfile, const char *CApath);
452 # ifdef OPENSSL_NO_ENGINE
453 # define setup_engine(engine, debug) NULL
455 ENGINE *setup_engine(const char *engine, int debug);
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'
479 # define DB_TYPE_EXP 'E'
480 # define DB_TYPE_VAL 'V'
482 typedef struct db_attr_st {
485 typedef struct ca_db_st {
490 void* app_malloc(int sz, const char *what);
491 BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai);
492 int save_serial(char *serialfile, char *suffix, BIGNUM *serial,
493 ASN1_INTEGER **retai);
494 int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix);
495 int rand_serial(BIGNUM *b, ASN1_INTEGER *ai);
496 CA_DB *load_index(char *dbfile, DB_ATTR *dbattr);
497 int index_index(CA_DB *db);
498 int save_index(const char *dbfile, const char *suffix, CA_DB *db);
499 int rotate_index(const char *dbfile, const char *new_suffix,
500 const char *old_suffix);
501 void free_index(CA_DB *db);
502 # define index_name_cmp_noconst(a, b) \
503 index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \
504 (const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
505 int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b);
506 int parse_yesno(const char *str, int def);
508 X509_NAME *parse_name(const char *str, long chtype, int multirdn);
509 int args_verify(char ***pargs, int *pargc,
510 int *badarg, X509_VERIFY_PARAM **pm);
511 void policies_print(X509_STORE_CTX *ctx);
512 int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
513 int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
514 int init_gen_str(EVP_PKEY_CTX **pctx,
515 const char *algname, ENGINE *e, int do_param);
516 int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
517 STACK_OF(OPENSSL_STRING) *sigopts);
518 int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
519 STACK_OF(OPENSSL_STRING) *sigopts);
520 int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
521 STACK_OF(OPENSSL_STRING) *sigopts);
522 # ifndef OPENSSL_NO_PSK
523 extern char *psk_key;
525 # ifndef OPENSSL_NO_JPAKE
526 void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
527 void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
530 unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
532 void print_cert_checks(BIO *bio, X509 *x,
533 const char *checkhost,
534 const char *checkemail, const char *checkip);
536 void store_setup_crl_download(X509_STORE *st);
538 /* See OPT_FMT_xxx, above. */
539 # define B_FORMAT_TEXT 0x8000
540 # define FORMAT_UNDEF 0
541 # define FORMAT_ASN1 1
542 # define FORMAT_TEXT (2 | B_FORMAT_TEXT)
543 # define FORMAT_PEM (3 | B_FORMAT_TEXT)
544 # define FORMAT_PKCS12 5
545 # define FORMAT_SMIME (6 | B_FORMAT_TEXT)
546 # define FORMAT_ENGINE 7
547 # define FORMAT_PEMRSA (9 | B_FORMAT_TEXT) /* PEM RSAPubicKey format */
548 # define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */
549 # define FORMAT_MSBLOB 11 /* MS Key blob format */
550 # define FORMAT_PVK 12 /* MS PVK file format */
551 # define FORMAT_HTTP 13 /* Download using HTTP */
552 # define FORMAT_NSS 14 /* NSS keylog format */
554 # define EXT_COPY_NONE 0
555 # define EXT_COPY_ADD 1
556 # define EXT_COPY_ALL 2
558 # define NETSCAPE_CERT_HDR "certificate"
560 # define APP_PASS_LEN 1024
562 # define SERIAL_RAND_BITS 64
565 int app_isdir(const char *);
566 int app_access(const char *, int flag);
567 int raw_read_stdin(void *, int);
568 int raw_write_stdout(const void *, int);
572 double app_tminterval(int stop, int usertime);