opt.h 18 KB

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