xref: /src/crypto/openssl/apps/include/opt.h (revision f25b8c9fb4f58cf61adb47d7570abe7caa6d385d)
1 /*
2  * Copyright 2018-2025 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (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
8  */
9 #ifndef OSSL_APPS_OPT_H
10 #define OSSL_APPS_OPT_H
11 
12 #include <sys/types.h>
13 #include <openssl/e_os2.h>
14 #include <openssl/types.h>
15 #include <stdarg.h>
16 
17 #define OPT_COMMON OPT_ERR = -1, OPT_EOF = 0, OPT_HELP
18 
19 /*
20  * Common verification options.
21  */
22 #define OPT_V_ENUM                                                      \
23     OPT_V__FIRST = 2000,                                                \
24     OPT_V_POLICY, OPT_V_PURPOSE, OPT_V_VERIFY_NAME, OPT_V_VERIFY_DEPTH, \
25     OPT_V_ATTIME, OPT_V_VERIFY_HOSTNAME, OPT_V_VERIFY_EMAIL,            \
26     OPT_V_VERIFY_IP, OPT_V_IGNORE_CRITICAL, OPT_V_ISSUER_CHECKS,        \
27     OPT_V_CRL_CHECK, OPT_V_CRL_CHECK_ALL, OPT_V_POLICY_CHECK,           \
28     OPT_V_EXPLICIT_POLICY, OPT_V_INHIBIT_ANY, OPT_V_INHIBIT_MAP,        \
29     OPT_V_X509_STRICT, OPT_V_EXTENDED_CRL, OPT_V_USE_DELTAS,            \
30     OPT_V_POLICY_PRINT, OPT_V_CHECK_SS_SIG, OPT_V_TRUSTED_FIRST,        \
31     OPT_V_SUITEB_128_ONLY, OPT_V_SUITEB_128, OPT_V_SUITEB_192,          \
32     OPT_V_PARTIAL_CHAIN, OPT_V_NO_ALT_CHAINS, OPT_V_NO_CHECK_TIME,      \
33     OPT_V_VERIFY_AUTH_LEVEL, OPT_V_ALLOW_PROXY_CERTS,                   \
34     OPT_V__LAST
35 
36 #define OPT_V_OPTIONS                                                                      \
37     OPT_SECTION("Validation"),                                                             \
38         { "policy", OPT_V_POLICY, 's', "adds policy to the acceptable policy set" },       \
39         { "purpose", OPT_V_PURPOSE, 's',                                                   \
40             "certificate chain purpose" },                                                 \
41         { "verify_name", OPT_V_VERIFY_NAME, 's', "verification policy name" },             \
42         { "verify_depth", OPT_V_VERIFY_DEPTH, 'n',                                         \
43             "chain depth limit" },                                                         \
44         { "auth_level", OPT_V_VERIFY_AUTH_LEVEL, 'n',                                      \
45             "chain authentication security level" },                                       \
46         { "attime", OPT_V_ATTIME, 'M', "verification epoch time" },                        \
47         { "verify_hostname", OPT_V_VERIFY_HOSTNAME, 's',                                   \
48             "expected peer hostname" },                                                    \
49         { "verify_email", OPT_V_VERIFY_EMAIL, 's',                                         \
50             "expected peer email" },                                                       \
51         { "verify_ip", OPT_V_VERIFY_IP, 's',                                               \
52             "expected peer IP address" },                                                  \
53         { "ignore_critical", OPT_V_IGNORE_CRITICAL, '-',                                   \
54             "permit unhandled critical extensions" },                                      \
55         { "issuer_checks", OPT_V_ISSUER_CHECKS, '-', "(deprecated)" },                     \
56         { "crl_check", OPT_V_CRL_CHECK, '-', "check leaf certificate revocation" },        \
57         { "crl_check_all", OPT_V_CRL_CHECK_ALL, '-', "check full chain revocation" },      \
58         { "policy_check", OPT_V_POLICY_CHECK, '-', "perform rfc5280 policy checks" },      \
59         { "explicit_policy", OPT_V_EXPLICIT_POLICY, '-',                                   \
60             "set policy variable require-explicit-policy" },                               \
61         { "inhibit_any", OPT_V_INHIBIT_ANY, '-',                                           \
62             "set policy variable inhibit-any-policy" },                                    \
63         { "inhibit_map", OPT_V_INHIBIT_MAP, '-',                                           \
64             "set policy variable inhibit-policy-mapping" },                                \
65         { "x509_strict", OPT_V_X509_STRICT, '-',                                           \
66             "disable certificate compatibility work-arounds" },                            \
67         { "extended_crl", OPT_V_EXTENDED_CRL, '-',                                         \
68             "enable extended CRL features" },                                              \
69         { "use_deltas", OPT_V_USE_DELTAS, '-',                                             \
70             "use delta CRLs" },                                                            \
71         { "policy_print", OPT_V_POLICY_PRINT, '-',                                         \
72             "print policy processing diagnostics" },                                       \
73         { "check_ss_sig", OPT_V_CHECK_SS_SIG, '-',                                         \
74             "check root CA self-signatures" },                                             \
75         { "trusted_first", OPT_V_TRUSTED_FIRST, '-',                                       \
76             "search trust store first (default)" },                                        \
77         { "suiteB_128_only", OPT_V_SUITEB_128_ONLY, '-', "Suite B 128-bit-only mode" },    \
78         { "suiteB_128", OPT_V_SUITEB_128, '-',                                             \
79             "Suite B 128-bit mode allowing 192-bit algorithms" },                          \
80         { "suiteB_192", OPT_V_SUITEB_192, '-', "Suite B 192-bit-only mode" },              \
81         { "partial_chain", OPT_V_PARTIAL_CHAIN, '-',                                       \
82             "accept chains anchored by intermediate trust-store CAs" },                    \
83         { "no_alt_chains", OPT_V_NO_ALT_CHAINS, '-', "(deprecated)" },                     \
84         { "no_check_time", OPT_V_NO_CHECK_TIME, '-', "ignore certificate validity time" }, \
85         { "allow_proxy_certs", OPT_V_ALLOW_PROXY_CERTS, '-', "allow the use of proxy certificates" }
86 
87 #define OPT_V_CASES               \
88     OPT_V__FIRST:                 \
89     case OPT_V__LAST:             \
90     break;                        \
91     case OPT_V_POLICY:            \
92     case OPT_V_PURPOSE:           \
93     case OPT_V_VERIFY_NAME:       \
94     case OPT_V_VERIFY_DEPTH:      \
95     case OPT_V_VERIFY_AUTH_LEVEL: \
96     case OPT_V_ATTIME:            \
97     case OPT_V_VERIFY_HOSTNAME:   \
98     case OPT_V_VERIFY_EMAIL:      \
99     case OPT_V_VERIFY_IP:         \
100     case OPT_V_IGNORE_CRITICAL:   \
101     case OPT_V_ISSUER_CHECKS:     \
102     case OPT_V_CRL_CHECK:         \
103     case OPT_V_CRL_CHECK_ALL:     \
104     case OPT_V_POLICY_CHECK:      \
105     case OPT_V_EXPLICIT_POLICY:   \
106     case OPT_V_INHIBIT_ANY:       \
107     case OPT_V_INHIBIT_MAP:       \
108     case OPT_V_X509_STRICT:       \
109     case OPT_V_EXTENDED_CRL:      \
110     case OPT_V_USE_DELTAS:        \
111     case OPT_V_POLICY_PRINT:      \
112     case OPT_V_CHECK_SS_SIG:      \
113     case OPT_V_TRUSTED_FIRST:     \
114     case OPT_V_SUITEB_128_ONLY:   \
115     case OPT_V_SUITEB_128:        \
116     case OPT_V_SUITEB_192:        \
117     case OPT_V_PARTIAL_CHAIN:     \
118     case OPT_V_NO_ALT_CHAINS:     \
119     case OPT_V_NO_CHECK_TIME:     \
120     case OPT_V_ALLOW_PROXY_CERTS
121 
122 /*
123  * Common "extended validation" options.
124  */
125 #define OPT_X_ENUM                                         \
126     OPT_X__FIRST = 1000,                                   \
127     OPT_X_KEY, OPT_X_CERT, OPT_X_CHAIN, OPT_X_CHAIN_BUILD, \
128     OPT_X_CERTFORM, OPT_X_KEYFORM,                         \
129     OPT_X__LAST
130 
131 #define OPT_X_OPTIONS                                                        \
132     OPT_SECTION("Extended certificate"),                                     \
133         { "xkey", OPT_X_KEY, '<', "key for Extended certificates" },         \
134         { "xcert", OPT_X_CERT, '<', "cert for Extended certificates" },      \
135         { "xchain", OPT_X_CHAIN, '<', "chain for Extended certificates" },   \
136         { "xchain_build", OPT_X_CHAIN_BUILD, '-',                            \
137             "build certificate chain for the extended certificates" },       \
138         { "xcertform", OPT_X_CERTFORM, 'F',                                  \
139             "format of Extended certificate (PEM/DER/P12); has no effect" }, \
140         { "xkeyform", OPT_X_KEYFORM, 'F',                                    \
141             "format of Extended certificate's key (DER/PEM/P12); has no effect" }
142 
143 #define OPT_X_CASES         \
144     OPT_X__FIRST:           \
145     case OPT_X__LAST:       \
146     break;                  \
147     case OPT_X_KEY:         \
148     case OPT_X_CERT:        \
149     case OPT_X_CHAIN:       \
150     case OPT_X_CHAIN_BUILD: \
151     case OPT_X_CERTFORM:    \
152     case OPT_X_KEYFORM
153 
154 /*
155  * Common SSL options.
156  * Any changes here must be coordinated with ../ssl/ssl_conf.c
157  */
158 #define OPT_S_ENUM                                                    \
159     OPT_S__FIRST = 3000,                                              \
160     OPT_S_NOSSL3, OPT_S_NOTLS1, OPT_S_NOTLS1_1, OPT_S_NOTLS1_2,       \
161     OPT_S_NOTLS1_3, OPT_S_BUGS, OPT_S_NO_COMP, OPT_S_NOTICKET,        \
162     OPT_S_SERVERPREF, OPT_S_LEGACYRENEG, OPT_S_CLIENTRENEG,           \
163     OPT_S_LEGACYCONN,                                                 \
164     OPT_S_ONRESUMP, OPT_S_NOLEGACYCONN,                               \
165     OPT_S_ALLOW_NO_DHE_KEX, OPT_S_PREFER_NO_DHE_KEX,                  \
166     OPT_S_PRIORITIZE_CHACHA,                                          \
167     OPT_S_STRICT, OPT_S_SIGALGS, OPT_S_CLIENTSIGALGS, OPT_S_GROUPS,   \
168     OPT_S_CURVES, OPT_S_NAMEDCURVE, OPT_S_CIPHER, OPT_S_CIPHERSUITES, \
169     OPT_S_RECORD_PADDING, OPT_S_DEBUGBROKE, OPT_S_COMP,               \
170     OPT_S_MINPROTO, OPT_S_MAXPROTO,                                   \
171     OPT_S_NO_RENEGOTIATION, OPT_S_NO_MIDDLEBOX, OPT_S_NO_ETM,         \
172     OPT_S_NO_EMS,                                                     \
173     OPT_S_NO_TX_CERT_COMP,                                            \
174     OPT_S_NO_RX_CERT_COMP,                                            \
175     OPT_S__LAST
176 
177 #define OPT_S_OPTIONS                                                                                           \
178     OPT_SECTION("TLS/SSL"),                                                                                     \
179         { "no_ssl3", OPT_S_NOSSL3, '-', "Just disable SSLv3" },                                                 \
180         { "no_tls1", OPT_S_NOTLS1, '-', "Just disable TLSv1" },                                                 \
181         { "no_tls1_1", OPT_S_NOTLS1_1, '-', "Just disable TLSv1.1" },                                           \
182         { "no_tls1_2", OPT_S_NOTLS1_2, '-', "Just disable TLSv1.2" },                                           \
183         { "no_tls1_3", OPT_S_NOTLS1_3, '-', "Just disable TLSv1.3" },                                           \
184         { "bugs", OPT_S_BUGS, '-', "Turn on SSL bug compatibility" },                                           \
185         { "no_comp", OPT_S_NO_COMP, '-', "Disable SSL/TLS compression (default)" },                             \
186         { "comp", OPT_S_COMP, '-', "Use SSL/TLS-level compression" },                                           \
187         { "no_tx_cert_comp", OPT_S_NO_TX_CERT_COMP, '-', "Disable sending TLSv1.3 compressed certificates" },   \
188         { "no_rx_cert_comp", OPT_S_NO_RX_CERT_COMP, '-', "Disable receiving TLSv1.3 compressed certificates" }, \
189         { "no_ticket", OPT_S_NOTICKET, '-',                                                                     \
190             "Disable use of TLS session tickets" },                                                             \
191         { "serverpref", OPT_S_SERVERPREF, '-', "Use server's cipher preferences" },                             \
192         { "legacy_renegotiation", OPT_S_LEGACYRENEG, '-',                                                       \
193             "Enable use of legacy renegotiation (dangerous)" },                                                 \
194         { "client_renegotiation", OPT_S_CLIENTRENEG, '-',                                                       \
195             "Allow client-initiated renegotiation" },                                                           \
196         { "no_renegotiation", OPT_S_NO_RENEGOTIATION, '-',                                                      \
197             "Disable all renegotiation." },                                                                     \
198         { "legacy_server_connect", OPT_S_LEGACYCONN, '-',                                                       \
199             "Allow initial connection to servers that don't support RI" },                                      \
200         { "no_resumption_on_reneg", OPT_S_ONRESUMP, '-',                                                        \
201             "Disallow session resumption on renegotiation" },                                                   \
202         { "no_legacy_server_connect", OPT_S_NOLEGACYCONN, '-',                                                  \
203             "Disallow initial connection to servers that don't support RI" },                                   \
204         { "allow_no_dhe_kex", OPT_S_ALLOW_NO_DHE_KEX, '-',                                                      \
205             "In TLSv1.3 allow non-(ec)dhe based key exchange on resumption" },                                  \
206         { "prefer_no_dhe_kex", OPT_S_PREFER_NO_DHE_KEX, '-',                                                    \
207             "In TLSv1.3 prefer non-(ec)dhe over (ec)dhe-based key exchange on resumption" },                    \
208         { "prioritize_chacha", OPT_S_PRIORITIZE_CHACHA, '-',                                                    \
209             "Prioritize ChaCha ciphers when preferred by clients" },                                            \
210         { "strict", OPT_S_STRICT, '-',                                                                          \
211             "Enforce strict certificate checks as per TLS standard" },                                          \
212         { "sigalgs", OPT_S_SIGALGS, 's',                                                                        \
213             "Signature algorithms to support (colon-separated list)" },                                         \
214         { "client_sigalgs", OPT_S_CLIENTSIGALGS, 's',                                                           \
215             "Signature algorithms to support for client certificate"                                            \
216             " authentication (colon-separated list)" },                                                         \
217         { "groups", OPT_S_GROUPS, 's',                                                                          \
218             "Groups to advertise (colon-separated list)" },                                                     \
219         { "curves", OPT_S_CURVES, 's',                                                                          \
220             "Groups to advertise (colon-separated list)" },                                                     \
221         { "named_curve", OPT_S_NAMEDCURVE, 's',                                                                 \
222             "Elliptic curve used for ECDHE (server-side only)" },                                               \
223         { "cipher", OPT_S_CIPHER, 's', "Specify TLSv1.2 and below cipher list to be used" },                    \
224         { "ciphersuites", OPT_S_CIPHERSUITES, 's', "Specify TLSv1.3 ciphersuites to be used" },                 \
225         { "min_protocol", OPT_S_MINPROTO, 's', "Specify the minimum protocol version to be used" },             \
226         { "max_protocol", OPT_S_MAXPROTO, 's', "Specify the maximum protocol version to be used" },             \
227         { "record_padding", OPT_S_RECORD_PADDING, 's',                                                          \
228             "Block size to pad TLS 1.3 records to." },                                                          \
229         { "debug_broken_protocol", OPT_S_DEBUGBROKE, '-',                                                       \
230             "Perform all sorts of protocol violations for testing purposes" },                                  \
231         { "no_middlebox", OPT_S_NO_MIDDLEBOX, '-',                                                              \
232             "Disable TLSv1.3 middlebox compat mode" },                                                          \
233         { "no_etm", OPT_S_NO_ETM, '-',                                                                          \
234             "Disable Encrypt-then-Mac extension" },                                                             \
235         { "no_ems", OPT_S_NO_EMS, '-',                                                                          \
236             "Disable Extended master secret extension" }
237 
238 #define OPT_S_CASES               \
239     OPT_S__FIRST:                 \
240     case OPT_S__LAST:             \
241     break;                        \
242     case OPT_S_NOSSL3:            \
243     case OPT_S_NOTLS1:            \
244     case OPT_S_NOTLS1_1:          \
245     case OPT_S_NOTLS1_2:          \
246     case OPT_S_NOTLS1_3:          \
247     case OPT_S_BUGS:              \
248     case OPT_S_NO_COMP:           \
249     case OPT_S_COMP:              \
250     case OPT_S_NO_TX_CERT_COMP:   \
251     case OPT_S_NO_RX_CERT_COMP:   \
252     case OPT_S_NOTICKET:          \
253     case OPT_S_SERVERPREF:        \
254     case OPT_S_LEGACYRENEG:       \
255     case OPT_S_CLIENTRENEG:       \
256     case OPT_S_LEGACYCONN:        \
257     case OPT_S_ONRESUMP:          \
258     case OPT_S_NOLEGACYCONN:      \
259     case OPT_S_ALLOW_NO_DHE_KEX:  \
260     case OPT_S_PREFER_NO_DHE_KEX: \
261     case OPT_S_PRIORITIZE_CHACHA: \
262     case OPT_S_STRICT:            \
263     case OPT_S_SIGALGS:           \
264     case OPT_S_CLIENTSIGALGS:     \
265     case OPT_S_GROUPS:            \
266     case OPT_S_CURVES:            \
267     case OPT_S_NAMEDCURVE:        \
268     case OPT_S_CIPHER:            \
269     case OPT_S_CIPHERSUITES:      \
270     case OPT_S_RECORD_PADDING:    \
271     case OPT_S_NO_RENEGOTIATION:  \
272     case OPT_S_MINPROTO:          \
273     case OPT_S_MAXPROTO:          \
274     case OPT_S_DEBUGBROKE:        \
275     case OPT_S_NO_MIDDLEBOX:      \
276     case OPT_S_NO_ETM:            \
277     case OPT_S_NO_EMS
278 
279 #define IS_NO_PROT_FLAG(o)                                         \
280     (o == OPT_S_NOSSL3 || o == OPT_S_NOTLS1 || o == OPT_S_NOTLS1_1 \
281         || o == OPT_S_NOTLS1_2 || o == OPT_S_NOTLS1_3)
282 
283 /*
284  * Random state options.
285  */
286 #define OPT_R_ENUM \
287     OPT_R__FIRST = 1500, OPT_R_RAND, OPT_R_WRITERAND, OPT_R__LAST
288 
289 #define OPT_R_OPTIONS                                                                           \
290     OPT_SECTION("Random state"),                                                                \
291         { "rand", OPT_R_RAND, 's', "Load the given file(s) into the random number generator" }, \
292         { "writerand", OPT_R_WRITERAND, '>', "Write random data to the specified file" }
293 
294 #define OPT_R_CASES   \
295     OPT_R__FIRST:     \
296     case OPT_R__LAST: \
297     break;            \
298     case OPT_R_RAND:  \
299     case OPT_R_WRITERAND
300 
301 /*
302  * Provider options.
303  */
304 #define OPT_PROV_ENUM                                              \
305     OPT_PROV__FIRST = 1600,                                        \
306     OPT_PROV_PROVIDER, OPT_PROV_PROVIDER_PATH, OPT_PROV_PROPQUERY, \
307     OPT_PROV_PARAM,                                                \
308     OPT_PROV__LAST
309 
310 #define OPT_CONFIG_OPTION \
311     { "config", OPT_CONFIG, '<', "Load a configuration file (this may load modules)" }
312 
313 #define OPT_PROV_OPTIONS                                                                                                         \
314     OPT_SECTION("Provider"),                                                                                                     \
315         { "provider-path", OPT_PROV_PROVIDER_PATH, 's', "Provider load path (must be before 'provider' argument if required)" }, \
316         { "provider", OPT_PROV_PROVIDER, 's', "Provider to load (can be specified multiple times)" },                            \
317         { "provparam", OPT_PROV_PARAM, 's', "Set a provider key-value parameter" },                                              \
318         { "propquery", OPT_PROV_PROPQUERY, 's', "Property query used when fetching algorithms" }
319 
320 #define OPT_PROV_CASES           \
321     OPT_PROV__FIRST:             \
322     case OPT_PROV__LAST:         \
323     break;                       \
324     case OPT_PROV_PROVIDER:      \
325     case OPT_PROV_PROVIDER_PATH: \
326     case OPT_PROV_PARAM:         \
327     case OPT_PROV_PROPQUERY
328 
329 /*
330  * Option parsing.
331  */
332 extern const char OPT_HELP_STR[];
333 extern const char OPT_MORE_STR[];
334 extern const char OPT_SECTION_STR[];
335 extern const char OPT_PARAM_STR[];
336 
337 typedef struct options_st {
338     const char *name;
339     int retval;
340     /*-
341      * value type:
342      *
343      *   '-' no value (also the value zero)
344      *   'n' number (type 'int')
345      *   'p' positive number (type 'int')
346      *   'u' unsigned number (type 'unsigned long')
347      *   'l' number (type 'unsigned long')
348      *   'M' number (type 'intmax_t')
349      *   'U' unsigned number (type 'uintmax_t')
350      *   's' string
351      *   '<' input file
352      *   '>' output file
353      *   '/' directory
354      *   'f' any format                    [OPT_FMT_ANY]
355      *   'F' der/pem format                [OPT_FMT_PEMDER]
356      *   'A' any ASN1, der/pem/b64 format  [OPT_FMT_ASN1]
357      *   'E' der/pem/engine format         [OPT_FMT_PDE]
358      *   'c' pem/der/smime format          [OPT_FMT_PDS]
359      *
360      * The 'l', 'n' and 'u' value types include the values zero,
361      * the 'p' value type does not.
362      */
363     int valtype;
364     const char *helpstr;
365 } OPTIONS;
366 /* Special retval values: */
367 #define OPT_PARAM 0 /* same as OPT_EOF usually defined in apps */
368 #define OPT_DUP -2 /* marks duplicate occurrence of option in help output */
369 
370 /*
371  * A string/int pairing; widely use for option value lookup, hence the
372  * name OPT_PAIR. But that name is misleading in s_cb.c, so we also use
373  * the "generic" name STRINT_PAIR.
374  */
375 typedef struct string_int_pair_st {
376     const char *name;
377     int retval;
378 } OPT_PAIR, STRINT_PAIR;
379 
380 /* Flags to pass into opt_format; see FORMAT_xxx, below. */
381 #define OPT_FMT_PEM (1L << 1)
382 #define OPT_FMT_DER (1L << 2)
383 #define OPT_FMT_B64 (1L << 3)
384 #define OPT_FMT_PKCS12 (1L << 4)
385 #define OPT_FMT_SMIME (1L << 5)
386 #define OPT_FMT_ENGINE (1L << 6)
387 #define OPT_FMT_MSBLOB (1L << 7)
388 #define OPT_FMT_NSS (1L << 8)
389 #define OPT_FMT_TEXT (1L << 9)
390 #define OPT_FMT_HTTP (1L << 10)
391 #define OPT_FMT_PVK (1L << 11)
392 
393 #define OPT_FMT_PEMDER (OPT_FMT_PEM | OPT_FMT_DER)
394 #define OPT_FMT_ASN1 (OPT_FMT_PEM | OPT_FMT_DER | OPT_FMT_B64)
395 #define OPT_FMT_PDE (OPT_FMT_PEMDER | OPT_FMT_ENGINE)
396 #define OPT_FMT_PDS (OPT_FMT_PEMDER | OPT_FMT_SMIME)
397 #define OPT_FMT_ANY ( \
398     OPT_FMT_PEM | OPT_FMT_DER | OPT_FMT_B64 | OPT_FMT_PKCS12 | OPT_FMT_SMIME | OPT_FMT_ENGINE | OPT_FMT_MSBLOB | OPT_FMT_NSS | OPT_FMT_TEXT | OPT_FMT_HTTP | OPT_FMT_PVK)
399 
400 /* Divide options into sections when displaying usage */
401 #define OPT_SECTION(sec) { OPT_SECTION_STR, 1, '-', sec " options:\n" }
402 #define OPT_PARAMETERS() { OPT_PARAM_STR, 1, '-', "Parameters:\n" }
403 
404 const char *opt_path_end(const char *filename);
405 char *opt_init(int ac, char **av, const OPTIONS *o);
406 char *opt_progname(const char *argv0);
407 char *opt_appname(const char *argv0);
408 char *opt_getprog(void);
409 void opt_help(const OPTIONS *list);
410 
411 void opt_begin(void);
412 int opt_next(void);
413 char *opt_flag(void);
414 char *opt_arg(void);
415 char *opt_unknown(void);
416 void reset_unknown(void);
417 int opt_cipher(const char *name, EVP_CIPHER **cipherp);
418 int opt_cipher_any(const char *name, EVP_CIPHER **cipherp);
419 int opt_cipher_silent(const char *name, EVP_CIPHER **cipherp);
420 int opt_check_md(const char *name);
421 int opt_md(const char *name, EVP_MD **mdp);
422 int opt_md_silent(const char *name, EVP_MD **mdp);
423 
424 int opt_int(const char *arg, int *result);
425 void opt_set_unknown_name(const char *name);
426 int opt_int_arg(void);
427 int opt_long(const char *arg, long *result);
428 int opt_ulong(const char *arg, unsigned long *result);
429 int opt_intmax(const char *arg, ossl_intmax_t *result);
430 int opt_uintmax(const char *arg, ossl_uintmax_t *result);
431 
432 int opt_isdir(const char *name);
433 int opt_format(const char *s, unsigned long flags, int *result);
434 void print_format_error(int format, unsigned long flags);
435 int opt_printf_stderr(const char *fmt, ...);
436 int opt_string(const char *name, const char **options);
437 int opt_pair(const char *arg, const OPT_PAIR *pairs, int *result);
438 
439 int opt_verify(int i, X509_VERIFY_PARAM *vpm);
440 int opt_rand(int i);
441 int opt_provider(int i);
442 int opt_provider_option_given(void);
443 
444 char **opt_rest(void);
445 int opt_num_rest(void);
446 int opt_check_rest_arg(const char *expected);
447 
448 /* Returns non-zero if legacy paths are still available */
449 int opt_legacy_okay(void);
450 
451 #endif /* OSSL_APPS_OPT_H */
452