1*de0e0e4dSAntonio Huete Jimenez /* $OpenBSD: apps.h,v 1.31 2022/01/10 12:17:49 tb Exp $ */ 2f5b1c8a1SJohn Marino /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3f5b1c8a1SJohn Marino * All rights reserved. 4f5b1c8a1SJohn Marino * 5f5b1c8a1SJohn Marino * This package is an SSL implementation written 6f5b1c8a1SJohn Marino * by Eric Young (eay@cryptsoft.com). 7f5b1c8a1SJohn Marino * The implementation was written so as to conform with Netscapes SSL. 8f5b1c8a1SJohn Marino * 9f5b1c8a1SJohn Marino * This library is free for commercial and non-commercial use as long as 10f5b1c8a1SJohn Marino * the following conditions are aheared to. The following conditions 11f5b1c8a1SJohn Marino * apply to all code found in this distribution, be it the RC4, RSA, 12f5b1c8a1SJohn Marino * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13f5b1c8a1SJohn Marino * included with this distribution is covered by the same copyright terms 14f5b1c8a1SJohn Marino * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15f5b1c8a1SJohn Marino * 16f5b1c8a1SJohn Marino * Copyright remains Eric Young's, and as such any Copyright notices in 17f5b1c8a1SJohn Marino * the code are not to be removed. 18f5b1c8a1SJohn Marino * If this package is used in a product, Eric Young should be given attribution 19f5b1c8a1SJohn Marino * as the author of the parts of the library used. 20f5b1c8a1SJohn Marino * This can be in the form of a textual message at program startup or 21f5b1c8a1SJohn Marino * in documentation (online or textual) provided with the package. 22f5b1c8a1SJohn Marino * 23f5b1c8a1SJohn Marino * Redistribution and use in source and binary forms, with or without 24f5b1c8a1SJohn Marino * modification, are permitted provided that the following conditions 25f5b1c8a1SJohn Marino * are met: 26f5b1c8a1SJohn Marino * 1. Redistributions of source code must retain the copyright 27f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer. 28f5b1c8a1SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 29f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer in the 30f5b1c8a1SJohn Marino * documentation and/or other materials provided with the distribution. 31f5b1c8a1SJohn Marino * 3. All advertising materials mentioning features or use of this software 32f5b1c8a1SJohn Marino * must display the following acknowledgement: 33f5b1c8a1SJohn Marino * "This product includes cryptographic software written by 34f5b1c8a1SJohn Marino * Eric Young (eay@cryptsoft.com)" 35f5b1c8a1SJohn Marino * The word 'cryptographic' can be left out if the rouines from the library 36f5b1c8a1SJohn Marino * being used are not cryptographic related :-). 37f5b1c8a1SJohn Marino * 4. If you include any Windows specific code (or a derivative thereof) from 38f5b1c8a1SJohn Marino * the apps directory (application code) you must include an acknowledgement: 39f5b1c8a1SJohn Marino * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40f5b1c8a1SJohn Marino * 41f5b1c8a1SJohn Marino * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42f5b1c8a1SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43f5b1c8a1SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44f5b1c8a1SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45f5b1c8a1SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46f5b1c8a1SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47f5b1c8a1SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48f5b1c8a1SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49f5b1c8a1SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50f5b1c8a1SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51f5b1c8a1SJohn Marino * SUCH DAMAGE. 52f5b1c8a1SJohn Marino * 53f5b1c8a1SJohn Marino * The licence and distribution terms for any publically available version or 54f5b1c8a1SJohn Marino * derivative of this code cannot be changed. i.e. this code cannot simply be 55f5b1c8a1SJohn Marino * copied and put under another distribution licence 56f5b1c8a1SJohn Marino * [including the GNU Public Licence.] 57f5b1c8a1SJohn Marino */ 58f5b1c8a1SJohn Marino /* ==================================================================== 59f5b1c8a1SJohn Marino * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. 60f5b1c8a1SJohn Marino * 61f5b1c8a1SJohn Marino * Redistribution and use in source and binary forms, with or without 62f5b1c8a1SJohn Marino * modification, are permitted provided that the following conditions 63f5b1c8a1SJohn Marino * are met: 64f5b1c8a1SJohn Marino * 65f5b1c8a1SJohn Marino * 1. Redistributions of source code must retain the above copyright 66f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer. 67f5b1c8a1SJohn Marino * 68f5b1c8a1SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 69f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer in 70f5b1c8a1SJohn Marino * the documentation and/or other materials provided with the 71f5b1c8a1SJohn Marino * distribution. 72f5b1c8a1SJohn Marino * 73f5b1c8a1SJohn Marino * 3. All advertising materials mentioning features or use of this 74f5b1c8a1SJohn Marino * software must display the following acknowledgment: 75f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project 76f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 77f5b1c8a1SJohn Marino * 78f5b1c8a1SJohn Marino * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 79f5b1c8a1SJohn Marino * endorse or promote products derived from this software without 80f5b1c8a1SJohn Marino * prior written permission. For written permission, please contact 81f5b1c8a1SJohn Marino * openssl-core@openssl.org. 82f5b1c8a1SJohn Marino * 83f5b1c8a1SJohn Marino * 5. Products derived from this software may not be called "OpenSSL" 84f5b1c8a1SJohn Marino * nor may "OpenSSL" appear in their names without prior written 85f5b1c8a1SJohn Marino * permission of the OpenSSL Project. 86f5b1c8a1SJohn Marino * 87f5b1c8a1SJohn Marino * 6. Redistributions of any form whatsoever must retain the following 88f5b1c8a1SJohn Marino * acknowledgment: 89f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project 90f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 91f5b1c8a1SJohn Marino * 92f5b1c8a1SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 93f5b1c8a1SJohn Marino * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 94f5b1c8a1SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 95f5b1c8a1SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 96f5b1c8a1SJohn Marino * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 97f5b1c8a1SJohn Marino * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 98f5b1c8a1SJohn Marino * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 99f5b1c8a1SJohn Marino * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 100f5b1c8a1SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 101f5b1c8a1SJohn Marino * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 102f5b1c8a1SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 103f5b1c8a1SJohn Marino * OF THE POSSIBILITY OF SUCH DAMAGE. 104f5b1c8a1SJohn Marino * ==================================================================== 105f5b1c8a1SJohn Marino * 106f5b1c8a1SJohn Marino * This product includes cryptographic software written by Eric Young 107f5b1c8a1SJohn Marino * (eay@cryptsoft.com). This product includes software written by Tim 108f5b1c8a1SJohn Marino * Hudson (tjh@cryptsoft.com). 109f5b1c8a1SJohn Marino * 110f5b1c8a1SJohn Marino */ 111f5b1c8a1SJohn Marino 112f5b1c8a1SJohn Marino #ifndef HEADER_APPS_H 113f5b1c8a1SJohn Marino #define HEADER_APPS_H 114f5b1c8a1SJohn Marino 115f5b1c8a1SJohn Marino #include <openssl/opensslconf.h> 116f5b1c8a1SJohn Marino 117f5b1c8a1SJohn Marino #include <openssl/bio.h> 118f5b1c8a1SJohn Marino #include <openssl/conf.h> 119f5b1c8a1SJohn Marino #include <openssl/lhash.h> 120f5b1c8a1SJohn Marino #include <openssl/ossl_typ.h> 121f5b1c8a1SJohn Marino #include <openssl/txt_db.h> 122f5b1c8a1SJohn Marino #include <openssl/x509.h> 123f5b1c8a1SJohn Marino #include <openssl/ui.h> 124f5b1c8a1SJohn Marino 125f5b1c8a1SJohn Marino #ifndef OPENSSL_NO_OCSP 126f5b1c8a1SJohn Marino #include <openssl/ocsp.h> 127f5b1c8a1SJohn Marino #endif 128f5b1c8a1SJohn Marino 129f5b1c8a1SJohn Marino #include <unistd.h> 130f5b1c8a1SJohn Marino 131f5b1c8a1SJohn Marino #if !defined(OpenBSD) 132f5b1c8a1SJohn Marino #define pledge(request, paths) 0 133f5b1c8a1SJohn Marino #define unveil(path, permissions) 0 134f5b1c8a1SJohn Marino #endif 135f5b1c8a1SJohn Marino 136f5b1c8a1SJohn Marino extern int single_execution; 137f5b1c8a1SJohn Marino 138f5b1c8a1SJohn Marino extern CONF *config; 139f5b1c8a1SJohn Marino extern char *default_config_file; 140f5b1c8a1SJohn Marino extern BIO *bio_err; 141f5b1c8a1SJohn Marino 142f5b1c8a1SJohn Marino typedef struct args_st { 143f5b1c8a1SJohn Marino char **data; 144f5b1c8a1SJohn Marino int count; 145f5b1c8a1SJohn Marino } ARGS; 146f5b1c8a1SJohn Marino 147f5b1c8a1SJohn Marino #define PW_MIN_LENGTH 4 148f5b1c8a1SJohn Marino typedef struct pw_cb_data { 149f5b1c8a1SJohn Marino const void *password; 150f5b1c8a1SJohn Marino const char *prompt_info; 151f5b1c8a1SJohn Marino } PW_CB_DATA; 152f5b1c8a1SJohn Marino 153f5b1c8a1SJohn Marino int password_callback(char *buf, int bufsiz, int verify, void *cb_data); 154f5b1c8a1SJohn Marino 155f5b1c8a1SJohn Marino int setup_ui(void); 156f5b1c8a1SJohn Marino void destroy_ui(void); 157f5b1c8a1SJohn Marino 158f5b1c8a1SJohn Marino extern UI_METHOD *ui_method; 159f5b1c8a1SJohn Marino int ui_open(UI *ui); 160f5b1c8a1SJohn Marino int ui_read(UI *ui, UI_STRING *uis); 161f5b1c8a1SJohn Marino int ui_write(UI *ui, UI_STRING *uis); 162f5b1c8a1SJohn Marino int ui_close(UI *ui); 163f5b1c8a1SJohn Marino 164f5b1c8a1SJohn Marino int should_retry(int i); 165f5b1c8a1SJohn Marino int args_from_file(char *file, int *argc, char **argv[]); 166f5b1c8a1SJohn Marino int str2fmt(char *s); 167f5b1c8a1SJohn Marino void program_name(char *in, char *out, int size); 168f5b1c8a1SJohn Marino int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]); 169f5b1c8a1SJohn Marino #ifdef HEADER_X509_H 170f5b1c8a1SJohn Marino int dump_cert_text(BIO *out, X509 *x); 171f5b1c8a1SJohn Marino void print_name(BIO *out, const char *title, X509_NAME *nm, 172f5b1c8a1SJohn Marino unsigned long lflags); 173f5b1c8a1SJohn Marino #endif 174f5b1c8a1SJohn Marino int set_cert_ex(unsigned long *flags, const char *arg); 175f5b1c8a1SJohn Marino int set_name_ex(unsigned long *flags, const char *arg); 176f5b1c8a1SJohn Marino int set_ext_copy(int *copy_type, const char *arg); 177f5b1c8a1SJohn Marino int copy_extensions(X509 *x, X509_REQ *req, int copy_type); 178f5b1c8a1SJohn Marino int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2); 179f5b1c8a1SJohn Marino int add_oid_section(BIO *err, CONF *conf); 180f5b1c8a1SJohn Marino X509 *load_cert(BIO *err, const char *file, int format, 181f5b1c8a1SJohn Marino const char *pass, const char *cert_descrip); 182f5b1c8a1SJohn Marino EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, 183f5b1c8a1SJohn Marino const char *pass, const char *key_descrip); 184f5b1c8a1SJohn Marino EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, 185f5b1c8a1SJohn Marino const char *pass, const char *key_descrip); 186f5b1c8a1SJohn Marino STACK_OF(X509) *load_certs(BIO *err, const char *file, int format, 187f5b1c8a1SJohn Marino const char *pass, const char *cert_descrip); 188f5b1c8a1SJohn Marino STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format, 189f5b1c8a1SJohn Marino const char *pass, const char *cert_descrip); 190f5b1c8a1SJohn Marino X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); 191f5b1c8a1SJohn Marino 192f5b1c8a1SJohn Marino #ifndef OPENSSL_NO_OCSP 193f5b1c8a1SJohn Marino OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, 194f5b1c8a1SJohn Marino char *host, char *path, char *port, int use_ssl, 195f5b1c8a1SJohn Marino STACK_OF(CONF_VALUE) *headers, int req_timeout); 196f5b1c8a1SJohn Marino #endif 197f5b1c8a1SJohn Marino 198f5b1c8a1SJohn Marino int load_config(BIO *err, CONF *cnf); 199f5b1c8a1SJohn Marino char *make_config_name(void); 200f5b1c8a1SJohn Marino 201f5b1c8a1SJohn Marino /* Functions defined in ca.c and also used in ocsp.c */ 202f5b1c8a1SJohn Marino int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, 203f5b1c8a1SJohn Marino ASN1_GENERALIZEDTIME **pinvtm, const char *str); 204f5b1c8a1SJohn Marino 205f5b1c8a1SJohn Marino #define DB_type 0 206f5b1c8a1SJohn Marino #define DB_exp_date 1 207f5b1c8a1SJohn Marino #define DB_rev_date 2 208f5b1c8a1SJohn Marino #define DB_serial 3 /* index - unique */ 209f5b1c8a1SJohn Marino #define DB_file 4 210*de0e0e4dSAntonio Huete Jimenez #define DB_name 5 /* index - unique when active and not disabled */ 211f5b1c8a1SJohn Marino #define DB_NUMBER 6 212f5b1c8a1SJohn Marino 213f5b1c8a1SJohn Marino #define DB_TYPE_REV 'R' 214f5b1c8a1SJohn Marino #define DB_TYPE_EXP 'E' 215f5b1c8a1SJohn Marino #define DB_TYPE_VAL 'V' 216f5b1c8a1SJohn Marino #define DB_TYPE_SUSP 'S' 217f5b1c8a1SJohn Marino 218f5b1c8a1SJohn Marino typedef struct db_attr_st { 219f5b1c8a1SJohn Marino int unique_subject; 220f5b1c8a1SJohn Marino } DB_ATTR; 221f5b1c8a1SJohn Marino typedef struct ca_db_st { 222f5b1c8a1SJohn Marino DB_ATTR attributes; 223f5b1c8a1SJohn Marino TXT_DB *db; 224f5b1c8a1SJohn Marino } CA_DB; 225f5b1c8a1SJohn Marino 226f5b1c8a1SJohn Marino BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai); 227f5b1c8a1SJohn Marino int save_serial(char *serialfile, char *suffix, BIGNUM *serial, 228f5b1c8a1SJohn Marino ASN1_INTEGER **retai); 229f5b1c8a1SJohn Marino int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix); 230f5b1c8a1SJohn Marino int rand_serial(BIGNUM *b, ASN1_INTEGER *ai); 231f5b1c8a1SJohn Marino CA_DB *load_index(char *dbfile, DB_ATTR *dbattr); 232f5b1c8a1SJohn Marino int index_index(CA_DB *db); 233f5b1c8a1SJohn Marino int save_index(const char *dbfile, const char *suffix, CA_DB *db); 234f5b1c8a1SJohn Marino int rotate_index(const char *dbfile, const char *new_suffix, 235f5b1c8a1SJohn Marino const char *old_suffix); 236f5b1c8a1SJohn Marino void free_index(CA_DB *db); 237f5b1c8a1SJohn Marino #define index_name_cmp_noconst(a, b) \ 238f5b1c8a1SJohn Marino index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \ 239f5b1c8a1SJohn Marino (const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b)) 240f5b1c8a1SJohn Marino int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b); 241f5b1c8a1SJohn Marino int parse_yesno(const char *str, int def); 242f5b1c8a1SJohn Marino 243f5b1c8a1SJohn Marino X509_NAME *parse_name(char *str, long chtype, int multirdn); 244f5b1c8a1SJohn Marino int args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, 245f5b1c8a1SJohn Marino X509_VERIFY_PARAM **pm); 246f5b1c8a1SJohn Marino void policies_print(BIO *out, X509_STORE_CTX *ctx); 247f5b1c8a1SJohn Marino int bio_to_mem(unsigned char **out, int maxlen, BIO *in); 248f5b1c8a1SJohn Marino int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value); 249f5b1c8a1SJohn Marino int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx, const char *algname, 250f5b1c8a1SJohn Marino int do_param); 251f5b1c8a1SJohn Marino int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md, 252f5b1c8a1SJohn Marino STACK_OF(OPENSSL_STRING) *sigopts); 253f5b1c8a1SJohn Marino int do_X509_REQ_sign(BIO *err, X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md, 254f5b1c8a1SJohn Marino STACK_OF(OPENSSL_STRING) *sigopts); 255f5b1c8a1SJohn Marino int do_X509_CRL_sign(BIO *err, X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md, 256f5b1c8a1SJohn Marino STACK_OF(OPENSSL_STRING) *sigopts); 257f5b1c8a1SJohn Marino 258*de0e0e4dSAntonio Huete Jimenez unsigned char *next_protos_parse(unsigned short *outlen, const char *in); 259f5b1c8a1SJohn Marino 260f5b1c8a1SJohn Marino #define FORMAT_UNDEF 0 261f5b1c8a1SJohn Marino #define FORMAT_ASN1 1 262*de0e0e4dSAntonio Huete Jimenez #define FORMAT_TEXT 2 263*de0e0e4dSAntonio Huete Jimenez #define FORMAT_PEM 3 264f5b1c8a1SJohn Marino 265f5b1c8a1SJohn Marino #define FORMAT_PKCS12 5 266f5b1c8a1SJohn Marino #define FORMAT_SMIME 6 267f5b1c8a1SJohn Marino 268f5b1c8a1SJohn Marino #define FORMAT_PEMRSA 9 /* PEM RSAPublicKey format */ 269f5b1c8a1SJohn Marino #define FORMAT_ASN1RSA 10 /* DER RSAPublicKey format */ 270f5b1c8a1SJohn Marino #define FORMAT_MSBLOB 11 /* MS Key blob format */ 271f5b1c8a1SJohn Marino #define FORMAT_PVK 12 /* MS PVK file format */ 272f5b1c8a1SJohn Marino 273f5b1c8a1SJohn Marino #define EXT_COPY_NONE 0 274f5b1c8a1SJohn Marino #define EXT_COPY_ADD 1 275f5b1c8a1SJohn Marino #define EXT_COPY_ALL 2 276f5b1c8a1SJohn Marino 27772c33676SMaxim Ag #define APP_PASS_LEN 1024 27872c33676SMaxim Ag 27972c33676SMaxim Ag #define SERIAL_RAND_BITS 64 28072c33676SMaxim Ag 281f5b1c8a1SJohn Marino int app_isdir(const char *); 282f5b1c8a1SJohn Marino 283f5b1c8a1SJohn Marino #define TM_RESET 0 284f5b1c8a1SJohn Marino #define TM_GET 1 285f5b1c8a1SJohn Marino double app_timer_real(int); 286f5b1c8a1SJohn Marino double app_timer_user(int); 287f5b1c8a1SJohn Marino 288f5b1c8a1SJohn Marino #define OPENSSL_NO_SSL_INTERN 289f5b1c8a1SJohn Marino 290f5b1c8a1SJohn Marino struct option { 291f5b1c8a1SJohn Marino const char *name; 292f5b1c8a1SJohn Marino const char *argname; 293f5b1c8a1SJohn Marino const char *desc; 294f5b1c8a1SJohn Marino enum { 29572c33676SMaxim Ag OPTION_ARG, 296f5b1c8a1SJohn Marino OPTION_ARGV_FUNC, 297f5b1c8a1SJohn Marino OPTION_ARG_FORMAT, 298f5b1c8a1SJohn Marino OPTION_ARG_FUNC, 299f5b1c8a1SJohn Marino OPTION_ARG_INT, 300f5b1c8a1SJohn Marino OPTION_ARG_LONG, 301f5b1c8a1SJohn Marino OPTION_ARG_TIME, 302f5b1c8a1SJohn Marino OPTION_DISCARD, 3038edacedfSDaniel Fojt OPTION_FUNC, 304*de0e0e4dSAntonio Huete Jimenez OPTION_FLAG, 305f5b1c8a1SJohn Marino OPTION_FLAG_ORD, 306f5b1c8a1SJohn Marino OPTION_VALUE, 307f5b1c8a1SJohn Marino OPTION_VALUE_AND, 308f5b1c8a1SJohn Marino OPTION_VALUE_OR, 309f5b1c8a1SJohn Marino OPTION_UL_VALUE_OR, 310f5b1c8a1SJohn Marino OPTION_ORDER, 311f5b1c8a1SJohn Marino } type; 312f5b1c8a1SJohn Marino union { 313f5b1c8a1SJohn Marino char **arg; 3148edacedfSDaniel Fojt int (*argfunc)(char *arg); 31572c33676SMaxim Ag int (*argvfunc)(int argc, char **argv, int *argsused); 316*de0e0e4dSAntonio Huete Jimenez int *flag; 317f5b1c8a1SJohn Marino int (*func)(void); 318f5b1c8a1SJohn Marino long *lvalue; 3198edacedfSDaniel Fojt int *value; 320*de0e0e4dSAntonio Huete Jimenez unsigned long *ulvalue; 321f5b1c8a1SJohn Marino time_t *tvalue; 322f5b1c8a1SJohn Marino int *order; 323cca6fc52SDaniel Fojt } opt; 324cca6fc52SDaniel Fojt const int value; 325cca6fc52SDaniel Fojt const unsigned long ulvalue; 326f5b1c8a1SJohn Marino int *order; 32772c33676SMaxim Ag }; 32872c33676SMaxim Ag 329*de0e0e4dSAntonio Huete Jimenez void options_usage(const struct option *opts); 330*de0e0e4dSAntonio Huete Jimenez int options_parse(int argc, char **argv, const struct option *opts, 331f5b1c8a1SJohn Marino char **unnamed, int *argsused); 332 333 void show_cipher(const OBJ_NAME *name, void *arg); 334 335 int pkey_check(BIO *out, EVP_PKEY *pkey, int (check_fn)(EVP_PKEY_CTX *), 336 const char *desc); 337 #endif 338