xref: /onnv-gate/usr/src/common/openssl/apps/apps.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /* apps/apps.h */
2*0Sstevel@tonic-gate /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3*0Sstevel@tonic-gate  * All rights reserved.
4*0Sstevel@tonic-gate  *
5*0Sstevel@tonic-gate  * This package is an SSL implementation written
6*0Sstevel@tonic-gate  * by Eric Young (eay@cryptsoft.com).
7*0Sstevel@tonic-gate  * The implementation was written so as to conform with Netscapes SSL.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * This library is free for commercial and non-commercial use as long as
10*0Sstevel@tonic-gate  * the following conditions are aheared to.  The following conditions
11*0Sstevel@tonic-gate  * apply to all code found in this distribution, be it the RC4, RSA,
12*0Sstevel@tonic-gate  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13*0Sstevel@tonic-gate  * included with this distribution is covered by the same copyright terms
14*0Sstevel@tonic-gate  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15*0Sstevel@tonic-gate  *
16*0Sstevel@tonic-gate  * Copyright remains Eric Young's, and as such any Copyright notices in
17*0Sstevel@tonic-gate  * the code are not to be removed.
18*0Sstevel@tonic-gate  * If this package is used in a product, Eric Young should be given attribution
19*0Sstevel@tonic-gate  * as the author of the parts of the library used.
20*0Sstevel@tonic-gate  * This can be in the form of a textual message at program startup or
21*0Sstevel@tonic-gate  * in documentation (online or textual) provided with the package.
22*0Sstevel@tonic-gate  *
23*0Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
24*0Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
25*0Sstevel@tonic-gate  * are met:
26*0Sstevel@tonic-gate  * 1. Redistributions of source code must retain the copyright
27*0Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
28*0Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
29*0Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
30*0Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
31*0Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this software
32*0Sstevel@tonic-gate  *    must display the following acknowledgement:
33*0Sstevel@tonic-gate  *    "This product includes cryptographic software written by
34*0Sstevel@tonic-gate  *     Eric Young (eay@cryptsoft.com)"
35*0Sstevel@tonic-gate  *    The word 'cryptographic' can be left out if the rouines from the library
36*0Sstevel@tonic-gate  *    being used are not cryptographic related :-).
37*0Sstevel@tonic-gate  * 4. If you include any Windows specific code (or a derivative thereof) from
38*0Sstevel@tonic-gate  *    the apps directory (application code) you must include an acknowledgement:
39*0Sstevel@tonic-gate  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40*0Sstevel@tonic-gate  *
41*0Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42*0Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43*0Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44*0Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45*0Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46*0Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47*0Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48*0Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49*0Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50*0Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51*0Sstevel@tonic-gate  * SUCH DAMAGE.
52*0Sstevel@tonic-gate  *
53*0Sstevel@tonic-gate  * The licence and distribution terms for any publically available version or
54*0Sstevel@tonic-gate  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55*0Sstevel@tonic-gate  * copied and put under another distribution licence
56*0Sstevel@tonic-gate  * [including the GNU Public Licence.]
57*0Sstevel@tonic-gate  */
58*0Sstevel@tonic-gate /* ====================================================================
59*0Sstevel@tonic-gate  * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
60*0Sstevel@tonic-gate  *
61*0Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
62*0Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
63*0Sstevel@tonic-gate  * are met:
64*0Sstevel@tonic-gate  *
65*0Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
66*0Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
67*0Sstevel@tonic-gate  *
68*0Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
69*0Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in
70*0Sstevel@tonic-gate  *    the documentation and/or other materials provided with the
71*0Sstevel@tonic-gate  *    distribution.
72*0Sstevel@tonic-gate  *
73*0Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this
74*0Sstevel@tonic-gate  *    software must display the following acknowledgment:
75*0Sstevel@tonic-gate  *    "This product includes software developed by the OpenSSL Project
76*0Sstevel@tonic-gate  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77*0Sstevel@tonic-gate  *
78*0Sstevel@tonic-gate  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79*0Sstevel@tonic-gate  *    endorse or promote products derived from this software without
80*0Sstevel@tonic-gate  *    prior written permission. For written permission, please contact
81*0Sstevel@tonic-gate  *    openssl-core@openssl.org.
82*0Sstevel@tonic-gate  *
83*0Sstevel@tonic-gate  * 5. Products derived from this software may not be called "OpenSSL"
84*0Sstevel@tonic-gate  *    nor may "OpenSSL" appear in their names without prior written
85*0Sstevel@tonic-gate  *    permission of the OpenSSL Project.
86*0Sstevel@tonic-gate  *
87*0Sstevel@tonic-gate  * 6. Redistributions of any form whatsoever must retain the following
88*0Sstevel@tonic-gate  *    acknowledgment:
89*0Sstevel@tonic-gate  *    "This product includes software developed by the OpenSSL Project
90*0Sstevel@tonic-gate  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91*0Sstevel@tonic-gate  *
92*0Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93*0Sstevel@tonic-gate  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94*0Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95*0Sstevel@tonic-gate  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
96*0Sstevel@tonic-gate  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97*0Sstevel@tonic-gate  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98*0Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99*0Sstevel@tonic-gate  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100*0Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101*0Sstevel@tonic-gate  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102*0Sstevel@tonic-gate  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103*0Sstevel@tonic-gate  * OF THE POSSIBILITY OF SUCH DAMAGE.
104*0Sstevel@tonic-gate  * ====================================================================
105*0Sstevel@tonic-gate  *
106*0Sstevel@tonic-gate  * This product includes cryptographic software written by Eric Young
107*0Sstevel@tonic-gate  * (eay@cryptsoft.com).  This product includes software written by Tim
108*0Sstevel@tonic-gate  * Hudson (tjh@cryptsoft.com).
109*0Sstevel@tonic-gate  *
110*0Sstevel@tonic-gate  */
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate #ifndef HEADER_APPS_H
113*0Sstevel@tonic-gate #define HEADER_APPS_H
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate #include "e_os.h"
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate #include <openssl/buffer.h>
118*0Sstevel@tonic-gate #include <openssl/bio.h>
119*0Sstevel@tonic-gate #include <openssl/crypto.h>
120*0Sstevel@tonic-gate #include <openssl/x509.h>
121*0Sstevel@tonic-gate #include <openssl/lhash.h>
122*0Sstevel@tonic-gate #include <openssl/conf.h>
123*0Sstevel@tonic-gate #include <openssl/txt_db.h>
124*0Sstevel@tonic-gate #ifndef OPENSSL_NO_ENGINE
125*0Sstevel@tonic-gate #include <openssl/engine.h>
126*0Sstevel@tonic-gate #endif
127*0Sstevel@tonic-gate #include <openssl/ossl_typ.h>
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
130*0Sstevel@tonic-gate int app_RAND_write_file(const char *file, BIO *bio_e);
131*0Sstevel@tonic-gate /* When `file' is NULL, use defaults.
132*0Sstevel@tonic-gate  * `bio_e' is for error messages. */
133*0Sstevel@tonic-gate void app_RAND_allow_write_file(void);
134*0Sstevel@tonic-gate long app_RAND_load_files(char *file); /* `file' is a list of files to read,
135*0Sstevel@tonic-gate                                        * separated by LIST_SEPARATOR_CHAR
136*0Sstevel@tonic-gate                                        * (see e_os.h).  The string is
137*0Sstevel@tonic-gate                                        * destroyed! */
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate #ifdef OPENSSL_SYS_WIN32
140*0Sstevel@tonic-gate #define rename(from,to) WIN32_rename((from),(to))
141*0Sstevel@tonic-gate int WIN32_rename(char *oldname,char *newname);
142*0Sstevel@tonic-gate #endif
143*0Sstevel@tonic-gate 
144*0Sstevel@tonic-gate /* VMS below version 7.0 doesn't have strcasecmp() */
145*0Sstevel@tonic-gate #ifdef OPENSSL_SYS_VMS
146*0Sstevel@tonic-gate #define strcasecmp(str1,str2) VMS_strcasecmp((str1),(str2))
147*0Sstevel@tonic-gate int VMS_strcasecmp(const char *str1, const char *str2);
148*0Sstevel@tonic-gate #endif
149*0Sstevel@tonic-gate 
150*0Sstevel@tonic-gate #ifndef MONOLITH
151*0Sstevel@tonic-gate 
152*0Sstevel@tonic-gate #define MAIN(a,v)	main(a,v)
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate #ifndef NON_MAIN
155*0Sstevel@tonic-gate CONF *config=NULL;
156*0Sstevel@tonic-gate BIO *bio_err=NULL;
157*0Sstevel@tonic-gate #else
158*0Sstevel@tonic-gate extern CONF *config;
159*0Sstevel@tonic-gate extern BIO *bio_err;
160*0Sstevel@tonic-gate #endif
161*0Sstevel@tonic-gate 
162*0Sstevel@tonic-gate #else
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate #define MAIN(a,v)	PROG(a,v)
165*0Sstevel@tonic-gate extern CONF *config;
166*0Sstevel@tonic-gate extern char *default_config_file;
167*0Sstevel@tonic-gate extern BIO *bio_err;
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate #endif
170*0Sstevel@tonic-gate 
171*0Sstevel@tonic-gate #include <signal.h>
172*0Sstevel@tonic-gate 
173*0Sstevel@tonic-gate #ifdef SIGPIPE
174*0Sstevel@tonic-gate #define do_pipe_sig()	signal(SIGPIPE,SIG_IGN)
175*0Sstevel@tonic-gate #else
176*0Sstevel@tonic-gate #define do_pipe_sig()
177*0Sstevel@tonic-gate #endif
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate #if defined(MONOLITH) && !defined(OPENSSL_C)
180*0Sstevel@tonic-gate #  define apps_startup() \
181*0Sstevel@tonic-gate 		do_pipe_sig()
182*0Sstevel@tonic-gate #  define apps_shutdown()
183*0Sstevel@tonic-gate #else
184*0Sstevel@tonic-gate #  ifndef OPENSSL_NO_ENGINE
185*0Sstevel@tonic-gate #    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
186*0Sstevel@tonic-gate      defined(OPENSSL_SYS_WIN32)
187*0Sstevel@tonic-gate #      ifdef _O_BINARY
188*0Sstevel@tonic-gate #        define apps_startup() \
189*0Sstevel@tonic-gate 			do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
190*0Sstevel@tonic-gate 			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
191*0Sstevel@tonic-gate 			ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
192*0Sstevel@tonic-gate #      else
193*0Sstevel@tonic-gate #        define apps_startup() \
194*0Sstevel@tonic-gate 			do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
195*0Sstevel@tonic-gate 			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
196*0Sstevel@tonic-gate 			ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
197*0Sstevel@tonic-gate #      endif
198*0Sstevel@tonic-gate #    else
199*0Sstevel@tonic-gate #      define apps_startup() \
200*0Sstevel@tonic-gate 			do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
201*0Sstevel@tonic-gate 			ERR_load_crypto_strings(); ENGINE_load_builtin_engines(); \
202*0Sstevel@tonic-gate 			setup_ui_method(); } while(0)
203*0Sstevel@tonic-gate #    endif
204*0Sstevel@tonic-gate #    define apps_shutdown() \
205*0Sstevel@tonic-gate 			do { CONF_modules_unload(1); destroy_ui_method(); \
206*0Sstevel@tonic-gate 			EVP_cleanup(); ENGINE_cleanup(); \
207*0Sstevel@tonic-gate 			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
208*0Sstevel@tonic-gate 			ERR_free_strings(); } while(0)
209*0Sstevel@tonic-gate #  else
210*0Sstevel@tonic-gate #    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
211*0Sstevel@tonic-gate      defined(OPENSSL_SYS_WIN32)
212*0Sstevel@tonic-gate #      ifdef _O_BINARY
213*0Sstevel@tonic-gate #        define apps_startup() \
214*0Sstevel@tonic-gate 			do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
215*0Sstevel@tonic-gate 			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
216*0Sstevel@tonic-gate 			setup_ui_method(); } while(0)
217*0Sstevel@tonic-gate #      else
218*0Sstevel@tonic-gate #        define apps_startup() \
219*0Sstevel@tonic-gate 			do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
220*0Sstevel@tonic-gate 			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
221*0Sstevel@tonic-gate 			setup_ui_method(); } while(0)
222*0Sstevel@tonic-gate #      endif
223*0Sstevel@tonic-gate #    else
224*0Sstevel@tonic-gate #      define apps_startup() \
225*0Sstevel@tonic-gate 			do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
226*0Sstevel@tonic-gate 			ERR_load_crypto_strings(); \
227*0Sstevel@tonic-gate 			setup_ui_method(); } while(0)
228*0Sstevel@tonic-gate #    endif
229*0Sstevel@tonic-gate #    define apps_shutdown() \
230*0Sstevel@tonic-gate 			do { CONF_modules_unload(1); destroy_ui_method(); \
231*0Sstevel@tonic-gate 			EVP_cleanup(); \
232*0Sstevel@tonic-gate 			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
233*0Sstevel@tonic-gate 			ERR_free_strings(); } while(0)
234*0Sstevel@tonic-gate #  endif
235*0Sstevel@tonic-gate #endif
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate typedef struct args_st
238*0Sstevel@tonic-gate 	{
239*0Sstevel@tonic-gate 	char **data;
240*0Sstevel@tonic-gate 	int count;
241*0Sstevel@tonic-gate 	} ARGS;
242*0Sstevel@tonic-gate 
243*0Sstevel@tonic-gate #define PW_MIN_LENGTH 4
244*0Sstevel@tonic-gate typedef struct pw_cb_data
245*0Sstevel@tonic-gate 	{
246*0Sstevel@tonic-gate 	const void *password;
247*0Sstevel@tonic-gate 	const char *prompt_info;
248*0Sstevel@tonic-gate 	} PW_CB_DATA;
249*0Sstevel@tonic-gate 
250*0Sstevel@tonic-gate int password_callback(char *buf, int bufsiz, int verify,
251*0Sstevel@tonic-gate 	PW_CB_DATA *cb_data);
252*0Sstevel@tonic-gate 
253*0Sstevel@tonic-gate int setup_ui_method(void);
254*0Sstevel@tonic-gate void destroy_ui_method(void);
255*0Sstevel@tonic-gate 
256*0Sstevel@tonic-gate int should_retry(int i);
257*0Sstevel@tonic-gate int args_from_file(char *file, int *argc, char **argv[]);
258*0Sstevel@tonic-gate int str2fmt(char *s);
259*0Sstevel@tonic-gate void program_name(char *in,char *out,int size);
260*0Sstevel@tonic-gate int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]);
261*0Sstevel@tonic-gate #ifdef HEADER_X509_H
262*0Sstevel@tonic-gate int dump_cert_text(BIO *out, X509 *x);
263*0Sstevel@tonic-gate void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags);
264*0Sstevel@tonic-gate #endif
265*0Sstevel@tonic-gate int set_cert_ex(unsigned long *flags, const char *arg);
266*0Sstevel@tonic-gate int set_name_ex(unsigned long *flags, const char *arg);
267*0Sstevel@tonic-gate int set_ext_copy(int *copy_type, const char *arg);
268*0Sstevel@tonic-gate int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
269*0Sstevel@tonic-gate int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
270*0Sstevel@tonic-gate int add_oid_section(BIO *err, CONF *conf);
271*0Sstevel@tonic-gate X509 *load_cert(BIO *err, const char *file, int format,
272*0Sstevel@tonic-gate 	const char *pass, ENGINE *e, const char *cert_descrip);
273*0Sstevel@tonic-gate EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
274*0Sstevel@tonic-gate 	const char *pass, ENGINE *e, const char *key_descrip);
275*0Sstevel@tonic-gate EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
276*0Sstevel@tonic-gate 	const char *pass, ENGINE *e, const char *key_descrip);
277*0Sstevel@tonic-gate STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
278*0Sstevel@tonic-gate 	const char *pass, ENGINE *e, const char *cert_descrip);
279*0Sstevel@tonic-gate X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
280*0Sstevel@tonic-gate #ifndef OPENSSL_NO_ENGINE
281*0Sstevel@tonic-gate ENGINE *setup_engine(BIO *err, const char *engine, int debug);
282*0Sstevel@tonic-gate #endif
283*0Sstevel@tonic-gate 
284*0Sstevel@tonic-gate int load_config(BIO *err, CONF *cnf);
285*0Sstevel@tonic-gate char *make_config_name(void);
286*0Sstevel@tonic-gate 
287*0Sstevel@tonic-gate /* Functions defined in ca.c and also used in ocsp.c */
288*0Sstevel@tonic-gate int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
289*0Sstevel@tonic-gate 			ASN1_GENERALIZEDTIME **pinvtm, char *str);
290*0Sstevel@tonic-gate 
291*0Sstevel@tonic-gate #define DB_type         0
292*0Sstevel@tonic-gate #define DB_exp_date     1
293*0Sstevel@tonic-gate #define DB_rev_date     2
294*0Sstevel@tonic-gate #define DB_serial       3       /* index - unique */
295*0Sstevel@tonic-gate #define DB_file         4
296*0Sstevel@tonic-gate #define DB_name         5       /* index - unique when active and not disabled */
297*0Sstevel@tonic-gate #define DB_NUMBER       6
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate #define DB_TYPE_REV	'R'
300*0Sstevel@tonic-gate #define DB_TYPE_EXP	'E'
301*0Sstevel@tonic-gate #define DB_TYPE_VAL	'V'
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate typedef struct db_attr_st
304*0Sstevel@tonic-gate 	{
305*0Sstevel@tonic-gate 	int unique_subject;
306*0Sstevel@tonic-gate 	} DB_ATTR;
307*0Sstevel@tonic-gate typedef struct ca_db_st
308*0Sstevel@tonic-gate 	{
309*0Sstevel@tonic-gate 	DB_ATTR attributes;
310*0Sstevel@tonic-gate 	TXT_DB *db;
311*0Sstevel@tonic-gate 	} CA_DB;
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai);
314*0Sstevel@tonic-gate int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai);
315*0Sstevel@tonic-gate int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix);
316*0Sstevel@tonic-gate CA_DB *load_index(char *dbfile, DB_ATTR *dbattr);
317*0Sstevel@tonic-gate int index_index(CA_DB *db);
318*0Sstevel@tonic-gate int save_index(char *dbfile, char *suffix, CA_DB *db);
319*0Sstevel@tonic-gate int rotate_index(char *dbfile, char *new_suffix, char *old_suffix);
320*0Sstevel@tonic-gate void free_index(CA_DB *db);
321*0Sstevel@tonic-gate int index_name_cmp(const char **a, const char **b);
322*0Sstevel@tonic-gate 
323*0Sstevel@tonic-gate X509_NAME *do_subject(char *str, long chtype);
324*0Sstevel@tonic-gate 
325*0Sstevel@tonic-gate #define FORMAT_UNDEF    0
326*0Sstevel@tonic-gate #define FORMAT_ASN1     1
327*0Sstevel@tonic-gate #define FORMAT_TEXT     2
328*0Sstevel@tonic-gate #define FORMAT_PEM      3
329*0Sstevel@tonic-gate #define FORMAT_NETSCAPE 4
330*0Sstevel@tonic-gate #define FORMAT_PKCS12   5
331*0Sstevel@tonic-gate #define FORMAT_SMIME    6
332*0Sstevel@tonic-gate #define FORMAT_ENGINE   7
333*0Sstevel@tonic-gate #define FORMAT_IISSGC	8	/* XXX this stupid macro helps us to avoid
334*0Sstevel@tonic-gate 				 * adding yet another param to load_*key() */
335*0Sstevel@tonic-gate 
336*0Sstevel@tonic-gate #define EXT_COPY_NONE	0
337*0Sstevel@tonic-gate #define EXT_COPY_ADD	1
338*0Sstevel@tonic-gate #define EXT_COPY_ALL	2
339*0Sstevel@tonic-gate 
340*0Sstevel@tonic-gate #define NETSCAPE_CERT_HDR	"certificate"
341*0Sstevel@tonic-gate 
342*0Sstevel@tonic-gate #define APP_PASS_LEN	1024
343*0Sstevel@tonic-gate 
344*0Sstevel@tonic-gate #endif
345