2 * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
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
11 #include <openssl/evp.h>
12 #include <openssl/err.h>
13 #include <openssl/provider.h>
14 #include <openssl/safestack.h>
15 #include <openssl/kdf.h>
17 #include "app_params.h"
22 DEFINE_STACK_OF_CSTRING()
24 static int verbose = 0;
26 static void legacy_cipher_fn(const EVP_CIPHER *c,
27 const char *from, const char *to, void *arg)
30 BIO_printf(arg, " %s\n", EVP_CIPHER_name(c));
36 BIO_printf(arg, " %s => %s\n", from, to);
40 DEFINE_STACK_OF(EVP_CIPHER)
41 static int cipher_cmp(const EVP_CIPHER * const *a,
42 const EVP_CIPHER * const *b)
44 int ret = EVP_CIPHER_number(*a) - EVP_CIPHER_number(*b);
47 ret = strcmp(OSSL_PROVIDER_name(EVP_CIPHER_provider(*a)),
48 OSSL_PROVIDER_name(EVP_CIPHER_provider(*b)));
53 static void collect_ciphers(EVP_CIPHER *cipher, void *stack)
55 STACK_OF(EVP_CIPHER) *cipher_stack = stack;
57 if (sk_EVP_CIPHER_push(cipher_stack, cipher) > 0)
58 EVP_CIPHER_up_ref(cipher);
61 static void list_ciphers(void)
63 STACK_OF(EVP_CIPHER) *ciphers = sk_EVP_CIPHER_new(cipher_cmp);
66 if (ciphers == NULL) {
67 BIO_printf(bio_err, "ERROR: Memory allocation\n");
70 BIO_printf(bio_out, "Legacy:\n");
71 EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out);
73 BIO_printf(bio_out, "Provided:\n");
74 EVP_CIPHER_do_all_provided(NULL, collect_ciphers, ciphers);
75 sk_EVP_CIPHER_sort(ciphers);
76 for (i = 0; i < sk_EVP_CIPHER_num(ciphers); i++) {
77 const EVP_CIPHER *c = sk_EVP_CIPHER_value(ciphers, i);
78 STACK_OF(OPENSSL_CSTRING) *names =
79 sk_OPENSSL_CSTRING_new(name_cmp);
81 EVP_CIPHER_names_do_all(c, collect_names, names);
83 BIO_printf(bio_out, " ");
84 print_names(bio_out, names);
85 BIO_printf(bio_out, " @ %s\n",
86 OSSL_PROVIDER_name(EVP_CIPHER_provider(c)));
88 sk_OPENSSL_CSTRING_free(names);
91 print_param_types("retrievable algorithm parameters",
92 EVP_CIPHER_gettable_params(c), 4);
93 print_param_types("retrievable operation parameters",
94 EVP_CIPHER_gettable_ctx_params(c), 4);
95 print_param_types("settable operation parameters",
96 EVP_CIPHER_settable_ctx_params(c), 4);
99 sk_EVP_CIPHER_pop_free(ciphers, EVP_CIPHER_free);
102 static void list_md_fn(const EVP_MD *m,
103 const char *from, const char *to, void *arg)
106 BIO_printf(arg, " %s\n", EVP_MD_name(m));
109 from = "<undefined>";
112 BIO_printf((BIO *)arg, " %s => %s\n", from, to);
116 DEFINE_STACK_OF(EVP_MD)
117 static int md_cmp(const EVP_MD * const *a, const EVP_MD * const *b)
119 int ret = EVP_MD_number(*a) - EVP_MD_number(*b);
122 ret = strcmp(OSSL_PROVIDER_name(EVP_MD_provider(*a)),
123 OSSL_PROVIDER_name(EVP_MD_provider(*b)));
128 static void collect_digests(EVP_MD *md, void *stack)
130 STACK_OF(EVP_MD) *digest_stack = stack;
132 if (sk_EVP_MD_push(digest_stack, md) > 0)
136 static void list_digests(void)
138 STACK_OF(EVP_MD) *digests = sk_EVP_MD_new(md_cmp);
141 if (digests == NULL) {
142 BIO_printf(bio_err, "ERROR: Memory allocation\n");
145 BIO_printf(bio_out, "Legacy:\n");
146 EVP_MD_do_all_sorted(list_md_fn, bio_out);
148 BIO_printf(bio_out, "Provided:\n");
149 EVP_MD_do_all_provided(NULL, collect_digests, digests);
150 sk_EVP_MD_sort(digests);
151 for (i = 0; i < sk_EVP_MD_num(digests); i++) {
152 const EVP_MD *m = sk_EVP_MD_value(digests, i);
153 STACK_OF(OPENSSL_CSTRING) *names =
154 sk_OPENSSL_CSTRING_new(name_cmp);
156 EVP_MD_names_do_all(m, collect_names, names);
158 BIO_printf(bio_out, " ");
159 print_names(bio_out, names);
160 BIO_printf(bio_out, " @ %s\n",
161 OSSL_PROVIDER_name(EVP_MD_provider(m)));
163 sk_OPENSSL_CSTRING_free(names);
166 print_param_types("retrievable algorithm parameters",
167 EVP_MD_gettable_params(m), 4);
168 print_param_types("retrievable operation parameters",
169 EVP_MD_gettable_ctx_params(m), 4);
170 print_param_types("settable operation parameters",
171 EVP_MD_settable_ctx_params(m), 4);
174 sk_EVP_MD_pop_free(digests, EVP_MD_free);
177 DEFINE_STACK_OF(EVP_MAC)
178 static int mac_cmp(const EVP_MAC * const *a, const EVP_MAC * const *b)
180 int ret = EVP_MAC_number(*a) - EVP_MAC_number(*b);
183 ret = strcmp(OSSL_PROVIDER_name(EVP_MAC_provider(*a)),
184 OSSL_PROVIDER_name(EVP_MAC_provider(*b)));
189 static void collect_macs(EVP_MAC *mac, void *stack)
191 STACK_OF(EVP_MAC) *mac_stack = stack;
193 if (sk_EVP_MAC_push(mac_stack, mac) > 0)
197 static void list_macs(void)
199 STACK_OF(EVP_MAC) *macs = sk_EVP_MAC_new(mac_cmp);
203 BIO_printf(bio_err, "ERROR: Memory allocation\n");
206 BIO_printf(bio_out, "Provided MACs:\n");
207 EVP_MAC_do_all_provided(NULL, collect_macs, macs);
208 sk_EVP_MAC_sort(macs);
209 for (i = 0; i < sk_EVP_MAC_num(macs); i++) {
210 const EVP_MAC *m = sk_EVP_MAC_value(macs, i);
211 STACK_OF(OPENSSL_CSTRING) *names =
212 sk_OPENSSL_CSTRING_new(name_cmp);
214 EVP_MAC_names_do_all(m, collect_names, names);
216 BIO_printf(bio_out, " ");
217 print_names(bio_out, names);
218 BIO_printf(bio_out, " @ %s\n",
219 OSSL_PROVIDER_name(EVP_MAC_provider(m)));
221 sk_OPENSSL_CSTRING_free(names);
224 print_param_types("retrievable algorithm parameters",
225 EVP_MAC_gettable_params(m), 4);
226 print_param_types("retrievable operation parameters",
227 EVP_MAC_gettable_ctx_params(m), 4);
228 print_param_types("settable operation parameters",
229 EVP_MAC_settable_ctx_params(m), 4);
232 sk_EVP_MAC_pop_free(macs, EVP_MAC_free);
238 DEFINE_STACK_OF(EVP_KDF)
239 static int kdf_cmp(const EVP_KDF * const *a, const EVP_KDF * const *b)
241 int ret = EVP_KDF_number(*a) - EVP_KDF_number(*b);
244 ret = strcmp(OSSL_PROVIDER_name(EVP_KDF_provider(*a)),
245 OSSL_PROVIDER_name(EVP_KDF_provider(*b)));
250 static void collect_kdfs(EVP_KDF *kdf, void *stack)
252 STACK_OF(EVP_KDF) *kdf_stack = stack;
254 sk_EVP_KDF_push(kdf_stack, kdf);
258 static void list_kdfs(void)
260 STACK_OF(EVP_KDF) *kdfs = sk_EVP_KDF_new(kdf_cmp);
264 BIO_printf(bio_err, "ERROR: Memory allocation\n");
267 BIO_printf(bio_out, "Provided KDFs and PDFs:\n");
268 EVP_KDF_do_all_provided(NULL, collect_kdfs, kdfs);
269 sk_EVP_KDF_sort(kdfs);
270 for (i = 0; i < sk_EVP_KDF_num(kdfs); i++) {
271 const EVP_KDF *k = sk_EVP_KDF_value(kdfs, i);
272 STACK_OF(OPENSSL_CSTRING) *names =
273 sk_OPENSSL_CSTRING_new(name_cmp);
275 EVP_KDF_names_do_all(k, collect_names, names);
277 BIO_printf(bio_out, " ");
278 print_names(bio_out, names);
279 BIO_printf(bio_out, " @ %s\n",
280 OSSL_PROVIDER_name(EVP_KDF_provider(k)));
282 sk_OPENSSL_CSTRING_free(names);
285 print_param_types("retrievable algorithm parameters",
286 EVP_KDF_gettable_params(k), 4);
287 print_param_types("retrievable operation parameters",
288 EVP_KDF_gettable_ctx_params(k), 4);
289 print_param_types("settable operation parameters",
290 EVP_KDF_settable_ctx_params(k), 4);
293 sk_EVP_KDF_pop_free(kdfs, EVP_KDF_free);
299 DEFINE_STACK_OF(EVP_RAND)
301 static int rand_cmp(const EVP_RAND * const *a, const EVP_RAND * const *b)
303 int ret = strcasecmp(EVP_RAND_name(*a), EVP_RAND_name(*b));
306 ret = strcmp(OSSL_PROVIDER_name(EVP_RAND_provider(*a)),
307 OSSL_PROVIDER_name(EVP_RAND_provider(*b)));
312 static void collect_rands(EVP_RAND *rand, void *stack)
314 STACK_OF(EVP_RAND) *rand_stack = stack;
316 sk_EVP_RAND_push(rand_stack, rand);
317 EVP_RAND_up_ref(rand);
320 static void list_random_generators(void)
322 STACK_OF(EVP_RAND) *rands = sk_EVP_RAND_new(rand_cmp);
326 BIO_printf(bio_err, "ERROR: Memory allocation\n");
329 BIO_printf(bio_out, "Provided RNGs and seed sources:\n");
330 EVP_RAND_do_all_provided(NULL, collect_rands, rands);
331 sk_EVP_RAND_sort(rands);
332 for (i = 0; i < sk_EVP_RAND_num(rands); i++) {
333 const EVP_RAND *m = sk_EVP_RAND_value(rands, i);
335 BIO_printf(bio_out, " %s", EVP_RAND_name(m));
336 BIO_printf(bio_out, " @ %s\n",
337 OSSL_PROVIDER_name(EVP_RAND_provider(m)));
340 print_param_types("retrievable algorithm parameters",
341 EVP_RAND_gettable_params(m), 4);
342 print_param_types("retrievable operation parameters",
343 EVP_RAND_gettable_ctx_params(m), 4);
344 print_param_types("settable operation parameters",
345 EVP_RAND_settable_ctx_params(m), 4);
348 sk_EVP_RAND_pop_free(rands, EVP_RAND_free);
351 static void list_missing_help(void)
356 for (fp = functions; fp->name != NULL; fp++) {
357 if ((o = fp->help) != NULL) {
358 /* If there is help, list what flags are not documented. */
359 for ( ; o->name != NULL; o++) {
360 if (o->helpstr == NULL)
361 BIO_printf(bio_out, "%s %s\n", fp->name, o->name);
363 } else if (fp->func != dgst_main) {
364 /* If not aliased to the dgst command, */
365 BIO_printf(bio_out, "%s *\n", fp->name);
370 static void list_objects(void)
372 int max_nid = OBJ_new_nid(0);
374 char *oid_buf = NULL;
377 /* Skip 0, since that's NID_undef */
378 for (i = 1; i < max_nid; i++) {
379 const ASN1_OBJECT *obj = OBJ_nid2obj(i);
380 const char *sn = OBJ_nid2sn(i);
381 const char *ln = OBJ_nid2ln(i);
385 * If one of the retrieved objects somehow generated an error,
386 * we ignore it. The check for NID_undef below will detect the
387 * error and simply skip to the next NID.
391 if (OBJ_obj2nid(obj) == NID_undef)
394 if ((n = OBJ_obj2txt(NULL, 0, obj, 1)) == 0) {
395 BIO_printf(bio_out, "# None-OID object: %s, %s\n", sn, ln);
402 oid_buf = OPENSSL_realloc(oid_buf, n + 1);
403 if (oid_buf == NULL) {
404 BIO_printf(bio_err, "ERROR: Memory allocation\n");
409 if (OBJ_obj2txt(oid_buf, oid_size, obj, 1) < 0)
411 if (ln == NULL || strcmp(sn, ln) == 0)
412 BIO_printf(bio_out, "%s = %s\n", sn, oid_buf);
414 BIO_printf(bio_out, "%s = %s, %s\n", sn, ln, oid_buf);
417 OPENSSL_free(oid_buf);
420 static void list_options_for_command(const char *command)
425 for (fp = functions; fp->name != NULL; fp++)
426 if (strcmp(fp->name, command) == 0)
428 if (fp->name == NULL) {
429 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
434 if ((o = fp->help) == NULL)
437 for ( ; o->name != NULL; o++) {
440 if (o->name == OPT_PARAM_STR)
443 if (o->name == OPT_HELP_STR
444 || o->name == OPT_MORE_STR
445 || o->name == OPT_SECTION_STR
446 || o->name[0] == '\0')
448 BIO_printf(bio_out, "%s %c\n", o->name, c == '\0' ? '-' : c);
450 /* Always output the -- marker since it is sometimes documented. */
451 BIO_printf(bio_out, "- -\n");
454 static void list_type(FUNC_TYPE ft, int one)
460 memset(&dc, 0, sizeof(dc));
462 calculate_columns(functions, &dc);
464 for (fp = functions; fp->name != NULL; fp++) {
468 BIO_printf(bio_out, "%s\n", fp->name);
470 if (i % dc.columns == 0 && i > 0)
471 BIO_printf(bio_out, "\n");
472 BIO_printf(bio_out, "%-*s", dc.width, fp->name);
477 BIO_printf(bio_out, "\n\n");
480 static void list_pkey(void)
484 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
485 const EVP_PKEY_ASN1_METHOD *ameth;
486 int pkey_id, pkey_base_id, pkey_flags;
487 const char *pinfo, *pem_str;
488 ameth = EVP_PKEY_asn1_get0(i);
489 EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
490 &pinfo, &pem_str, ameth);
491 if (pkey_flags & ASN1_PKEY_ALIAS) {
492 BIO_printf(bio_out, "Name: %s\n", OBJ_nid2ln(pkey_id));
493 BIO_printf(bio_out, "\tAlias for: %s\n",
494 OBJ_nid2ln(pkey_base_id));
496 BIO_printf(bio_out, "Name: %s\n", pinfo);
497 BIO_printf(bio_out, "\tType: %s Algorithm\n",
498 pkey_flags & ASN1_PKEY_DYNAMIC ?
499 "External" : "Builtin");
500 BIO_printf(bio_out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
503 BIO_printf(bio_out, "\tPEM string: %s\n", pem_str);
509 static void list_pkey_meth(void)
512 size_t meth_count = EVP_PKEY_meth_get_count();
514 for (i = 0; i < meth_count; i++) {
515 const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
516 int pkey_id, pkey_flags;
518 EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
519 BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
520 BIO_printf(bio_out, "\tType: %s Algorithm\n",
521 pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin");
525 static void list_engines(void)
527 #ifndef OPENSSL_NO_ENGINE
530 BIO_puts(bio_out, "Engines:\n");
531 e = ENGINE_get_first();
533 BIO_printf(bio_out, "%s\n", ENGINE_get_id(e));
534 e = ENGINE_get_next(e);
537 BIO_puts(bio_out, "Engine support is disabled.\n");
541 static void list_disabled(void)
543 BIO_puts(bio_out, "Disabled algorithms:\n");
544 #ifdef OPENSSL_NO_ARIA
545 BIO_puts(bio_out, "ARIA\n");
548 BIO_puts(bio_out, "BF\n");
550 #ifdef OPENSSL_NO_BLAKE2
551 BIO_puts(bio_out, "BLAKE2\n");
553 #ifdef OPENSSL_NO_CAMELLIA
554 BIO_puts(bio_out, "CAMELLIA\n");
556 #ifdef OPENSSL_NO_CAST
557 BIO_puts(bio_out, "CAST\n");
559 #ifdef OPENSSL_NO_CMAC
560 BIO_puts(bio_out, "CMAC\n");
562 #ifdef OPENSSL_NO_CMS
563 BIO_puts(bio_out, "CMS\n");
565 #ifdef OPENSSL_NO_COMP
566 BIO_puts(bio_out, "COMP\n");
568 #ifdef OPENSSL_NO_DES
569 BIO_puts(bio_out, "DES\n");
571 #ifdef OPENSSL_NO_DGRAM
572 BIO_puts(bio_out, "DGRAM\n");
575 BIO_puts(bio_out, "DH\n");
577 #ifdef OPENSSL_NO_DSA
578 BIO_puts(bio_out, "DSA\n");
580 #if defined(OPENSSL_NO_DTLS)
581 BIO_puts(bio_out, "DTLS\n");
583 #if defined(OPENSSL_NO_DTLS1)
584 BIO_puts(bio_out, "DTLS1\n");
586 #if defined(OPENSSL_NO_DTLS1_2)
587 BIO_puts(bio_out, "DTLS1_2\n");
590 BIO_puts(bio_out, "EC\n");
592 #ifdef OPENSSL_NO_EC2M
593 BIO_puts(bio_out, "EC2M\n");
595 #ifdef OPENSSL_NO_ENGINE
596 BIO_puts(bio_out, "ENGINE\n");
598 #ifdef OPENSSL_NO_GOST
599 BIO_puts(bio_out, "GOST\n");
601 #ifdef OPENSSL_NO_IDEA
602 BIO_puts(bio_out, "IDEA\n");
604 #ifdef OPENSSL_NO_MD2
605 BIO_puts(bio_out, "MD2\n");
607 #ifdef OPENSSL_NO_MD4
608 BIO_puts(bio_out, "MD4\n");
610 #ifdef OPENSSL_NO_MD5
611 BIO_puts(bio_out, "MD5\n");
613 #ifdef OPENSSL_NO_MDC2
614 BIO_puts(bio_out, "MDC2\n");
616 #ifdef OPENSSL_NO_OCB
617 BIO_puts(bio_out, "OCB\n");
619 #ifdef OPENSSL_NO_OCSP
620 BIO_puts(bio_out, "OCSP\n");
622 #ifdef OPENSSL_NO_PSK
623 BIO_puts(bio_out, "PSK\n");
625 #ifdef OPENSSL_NO_RC2
626 BIO_puts(bio_out, "RC2\n");
628 #ifdef OPENSSL_NO_RC4
629 BIO_puts(bio_out, "RC4\n");
631 #ifdef OPENSSL_NO_RC5
632 BIO_puts(bio_out, "RC5\n");
634 #ifdef OPENSSL_NO_RMD160
635 BIO_puts(bio_out, "RMD160\n");
637 #ifdef OPENSSL_NO_RSA
638 BIO_puts(bio_out, "RSA\n");
640 #ifdef OPENSSL_NO_SCRYPT
641 BIO_puts(bio_out, "SCRYPT\n");
643 #ifdef OPENSSL_NO_SCTP
644 BIO_puts(bio_out, "SCTP\n");
646 #ifdef OPENSSL_NO_SEED
647 BIO_puts(bio_out, "SEED\n");
649 #ifdef OPENSSL_NO_SM2
650 BIO_puts(bio_out, "SM2\n");
652 #ifdef OPENSSL_NO_SM3
653 BIO_puts(bio_out, "SM3\n");
655 #ifdef OPENSSL_NO_SM4
656 BIO_puts(bio_out, "SM4\n");
658 #ifdef OPENSSL_NO_SOCK
659 BIO_puts(bio_out, "SOCK\n");
661 #ifdef OPENSSL_NO_SRP
662 BIO_puts(bio_out, "SRP\n");
664 #ifdef OPENSSL_NO_SRTP
665 BIO_puts(bio_out, "SRTP\n");
667 #ifdef OPENSSL_NO_SSL3
668 BIO_puts(bio_out, "SSL3\n");
670 #ifdef OPENSSL_NO_TLS1
671 BIO_puts(bio_out, "TLS1\n");
673 #ifdef OPENSSL_NO_TLS1_1
674 BIO_puts(bio_out, "TLS1_1\n");
676 #ifdef OPENSSL_NO_TLS1_2
677 BIO_puts(bio_out, "TLS1_2\n");
679 #ifdef OPENSSL_NO_WHIRLPOOL
680 BIO_puts(bio_out, "WHIRLPOOL\n");
683 BIO_puts(bio_out, "ZLIB\n");
687 /* Unified enum for help and list commands. */
688 typedef enum HELPLIST_CHOICE {
689 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE, OPT_VERBOSE,
690 OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS,
691 OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
692 OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_ENGINES, OPT_DISABLED,
693 OPT_KDF_ALGORITHMS, OPT_RANDOM_GENERATORS, OPT_MISSING_HELP, OPT_OBJECTS,
697 const OPTIONS list_options[] = {
699 OPT_SECTION("General"),
700 {"help", OPT_HELP, '-', "Display this summary"},
702 OPT_SECTION("Output"),
703 {"1", OPT_ONE, '-', "List in one column"},
704 {"verbose", OPT_VERBOSE, '-', "Verbose listing"},
705 {"commands", OPT_COMMANDS, '-', "List of standard commands"},
706 {"standard-commands", OPT_COMMANDS, '-', "List of standard commands"},
707 {"digest-commands", OPT_DIGEST_COMMANDS, '-',
708 "List of message digest commands"},
709 {"digest-algorithms", OPT_DIGEST_ALGORITHMS, '-',
710 "List of message digest algorithms"},
711 {"kdf-algorithms", OPT_KDF_ALGORITHMS, '-',
712 "List of key derivation and pseudo random function algorithms"},
713 {"random-generators", OPT_RANDOM_GENERATORS, '-',
714 "List of random number generators"},
715 {"mac-algorithms", OPT_MAC_ALGORITHMS, '-',
716 "List of message authentication code algorithms"},
717 {"cipher-commands", OPT_CIPHER_COMMANDS, '-', "List of cipher commands"},
718 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS, '-',
719 "List of cipher algorithms"},
720 {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
721 "List of public key algorithms"},
722 {"public-key-methods", OPT_PK_METHOD, '-',
723 "List of public key methods"},
724 {"engines", OPT_ENGINES, '-',
725 "List of loaded engines"},
726 {"disabled", OPT_DISABLED, '-',
727 "List of disabled features"},
728 {"missing-help", OPT_MISSING_HELP, '-',
729 "List missing detailed help strings"},
730 {"options", OPT_OPTIONS, 's',
731 "List options for specified command"},
732 {"objects", OPT_OBJECTS, '-',
733 "List built in objects (OID<->name mappings)"},
739 int list_main(int argc, char **argv)
743 int one = 0, done = 0;
745 unsigned int commands:1;
746 unsigned int random_generators:1;
747 unsigned int digest_commands:1;
748 unsigned int digest_algorithms:1;
749 unsigned int kdf_algorithms:1;
750 unsigned int mac_algorithms:1;
751 unsigned int cipher_commands:1;
752 unsigned int cipher_algorithms:1;
753 unsigned int pk_algorithms:1;
754 unsigned int pk_method:1;
755 unsigned int engines:1;
756 unsigned int disabled:1;
757 unsigned int missing_help:1;
758 unsigned int objects:1;
759 unsigned int options:1;
762 verbose = 0; /* Clear a possible previous call */
764 prog = opt_init(argc, argv, list_options);
765 while ((o = opt_next()) != OPT_EOF) {
767 case OPT_EOF: /* Never hit, but suppresses warning */
770 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
773 opt_help(list_options);
781 case OPT_DIGEST_COMMANDS:
782 todo.digest_commands = 1;
784 case OPT_DIGEST_ALGORITHMS:
785 todo.digest_algorithms = 1;
787 case OPT_KDF_ALGORITHMS:
788 todo.kdf_algorithms = 1;
790 case OPT_RANDOM_GENERATORS:
791 todo.random_generators = 1;
793 case OPT_MAC_ALGORITHMS:
794 todo.mac_algorithms = 1;
796 case OPT_CIPHER_COMMANDS:
797 todo.cipher_commands = 1;
799 case OPT_CIPHER_ALGORITHMS:
800 todo.cipher_algorithms = 1;
802 case OPT_PK_ALGORITHMS:
803 todo.pk_algorithms = 1;
814 case OPT_MISSING_HELP:
815 todo.missing_help = 1;
821 list_options_for_command(opt_arg());
827 if (!opt_provider(o))
833 if (opt_num_rest() != 0) {
834 BIO_printf(bio_err, "Extra arguments given.\n");
839 list_type(FT_general, one);
840 if (todo.random_generators)
841 list_random_generators();
842 if (todo.digest_commands)
843 list_type(FT_md, one);
844 if (todo.digest_algorithms)
846 if (todo.kdf_algorithms)
848 if (todo.mac_algorithms)
850 if (todo.cipher_commands)
851 list_type(FT_cipher, one);
852 if (todo.cipher_algorithms)
854 if (todo.pk_algorithms)
862 if (todo.missing_help)