2 * Copyright 1995-2018 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
10 #include <internal/cryptlib.h>
14 #include <openssl/bio.h>
15 #include <openssl/crypto.h>
16 #include <openssl/trace.h>
17 #include <openssl/lhash.h>
18 #include <openssl/conf.h>
19 #include <openssl/x509.h>
20 #include <openssl/pem.h>
21 #include <openssl/ssl.h>
22 #ifndef OPENSSL_NO_ENGINE
23 # include <openssl/engine.h>
25 #include <openssl/err.h>
27 /* Needed to get the other O_xxx flags. */
28 #ifdef OPENSSL_SYS_VMS
32 #define INCLUDE_FUNCTION_TABLE
35 /* Structure to hold the number of columns to be displayed and the
36 * field width used to display them.
43 /* Special sentinel to exit the program. */
44 #define EXIT_THE_PROGRAM (-1)
47 * The LHASH callbacks ("hash" & "cmp") have been replaced by functions with
48 * the base prototypes (we cast each variable inside the function to the
49 * required type of "FUNCTION*"). This removes the necessity for
50 * macro-generated wrapper functions.
52 static LHASH_OF(FUNCTION) *prog_init(void);
53 static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]);
54 static void list_pkey(void);
55 static void list_pkey_meth(void);
56 static void list_type(FUNC_TYPE ft, int one);
57 static void list_engines(void);
58 static void list_disabled(void);
59 char *default_config_file = NULL;
65 static void calculate_columns(DISPLAY_COLUMNS *dc)
70 for (f = functions; f->name != NULL; ++f)
71 if (f->type == FT_general || f->type == FT_md || f->type == FT_cipher)
72 if ((len = strlen(f->name)) > maxlen)
75 dc->width = maxlen + 2;
76 dc->columns = (80 - 1) / dc->width;
79 static int apps_startup(void)
82 signal(SIGPIPE, SIG_IGN);
85 /* Set non-default library initialisation settings */
86 if (!OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN
87 | OPENSSL_INIT_LOAD_CONFIG, NULL))
95 static void apps_shutdown(void)
100 static char *make_config_name(void)
106 if ((t = getenv("OPENSSL_CONF")) != NULL)
107 return OPENSSL_strdup(t);
109 t = X509_get_default_cert_area();
110 len = strlen(t) + 1 + strlen(OPENSSL_CONF) + 1;
111 p = app_malloc(len, "config filename buffer");
113 #ifndef OPENSSL_SYS_VMS
116 strcat(p, OPENSSL_CONF);
122 #ifndef OPENSSL_NO_TRACE
123 typedef struct tracedata_st {
125 unsigned int ingroup:1;
128 static size_t internal_trace_cb(const char *buf, size_t cnt,
129 int category, int cmd, void *vdata)
132 tracedata *trace_data = vdata;
134 CRYPTO_THREAD_ID tid;
140 case OSSL_TRACE_CTRL_BEGIN:
141 if (!ossl_assert(!trace_data->ingroup))
143 trace_data->ingroup = 1;
146 tid.tid = CRYPTO_THREAD_get_current_id();
148 BIO_snprintf(buffer, sizeof(buffer), "TRACE[%lx]:%s: ", tid.ltid,
149 OSSL_trace_get_category_name(category));
150 BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
151 strlen(buffer), buffer);
153 case OSSL_TRACE_CTRL_WRITE:
154 if (!ossl_assert(trace_data->ingroup))
157 ret = BIO_write(trace_data->bio, buf, cnt);
159 case OSSL_TRACE_CTRL_END:
160 if (!ossl_assert(trace_data->ingroup))
162 trace_data->ingroup = 0;
164 BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX, 0, NULL);
169 return ret < 0 ? 0 : ret;
172 DEFINE_STACK_OF(tracedata)
173 static STACK_OF(tracedata) *trace_data_stack;
175 static void tracedata_free(tracedata *data)
177 BIO_free_all(data->bio);
181 static STACK_OF(tracedata) *trace_data_stack;
183 static void cleanup_trace(void)
185 sk_tracedata_pop_free(trace_data_stack, tracedata_free);
188 static void setup_trace_category(int category)
191 tracedata *trace_data;
193 if (OSSL_trace_enabled(category))
196 channel = BIO_push(BIO_new(apps_bf_prefix()),
197 dup_bio_err(FORMAT_TEXT));
198 trace_data = OPENSSL_zalloc(sizeof(*trace_data));
200 if (trace_data == NULL
201 || (trace_data->bio = channel) == NULL
202 || OSSL_trace_set_callback(category, internal_trace_cb,
204 || sk_tracedata_push(trace_data_stack, trace_data) == 0) {
207 "warning: unable to setup trace callback for category '%s'.\n",
208 OSSL_trace_get_category_name(category));
210 OSSL_trace_set_callback(category, NULL, NULL);
211 BIO_free_all(channel);
215 static void setup_trace(const char *str)
220 * We add this handler as early as possible to ensure it's executed
221 * as late as possible, i.e. after the TRACE code has done its cleanup
222 * (which happens last in OPENSSL_cleanup).
224 atexit(cleanup_trace);
226 trace_data_stack = sk_tracedata_new_null();
227 val = OPENSSL_strdup(str);
233 for (valp = val; (item = strtok(valp, ",")) != NULL; valp = NULL) {
234 int category = OSSL_trace_get_category_num(item);
236 if (category == OSSL_TRACE_CATEGORY_ALL) {
237 while (++category < OSSL_TRACE_CATEGORY_NUM)
238 setup_trace_category(category);
240 } else if (category > 0) {
241 setup_trace_category(category);
244 "warning: unknown trace category: '%s'.\n", item);
251 #endif /* OPENSSL_NO_TRACE */
253 int main(int argc, char *argv[])
256 LHASH_OF(FUNCTION) *prog = NULL;
261 int first, n, i, ret = 0;
266 /* Set up some of the environment. */
267 default_config_file = make_config_name();
268 bio_in = dup_bio_in(FORMAT_TEXT);
269 bio_out = dup_bio_out(FORMAT_TEXT);
270 bio_err = dup_bio_err(FORMAT_TEXT);
272 #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
273 argv = copy_argv(&argc, argv);
274 #elif defined(_WIN32)
276 * Replace argv[] with UTF-8 encoded strings.
278 win32_utf8argv(&argc, &argv);
282 * We use the prefix method to get the trace output we want. Since some
283 * trace outputs happen with OPENSSL_cleanup(), which is run automatically
284 * after exit(), we need to destroy the prefix method as late as possible.
286 atexit(destroy_prefix_method);
288 #ifndef OPENSSL_NO_TRACE
289 setup_trace(getenv("OPENSSL_TRACE"));
292 p = getenv("OPENSSL_DEBUG_MEMORY");
293 if (p != NULL && strcmp(p, "on") == 0)
294 CRYPTO_set_mem_debug(1);
295 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
297 if (getenv("OPENSSL_FIPS")) {
298 BIO_printf(bio_err, "FIPS mode not supported.\n");
302 if (!apps_startup()) {
304 "FATAL: Startup failure (dev note: apps_startup() failed)\n");
305 ERR_print_errors(bio_err);
311 pname = opt_progname(argv[0]);
313 /* first check the program name */
315 fp = lh_FUNCTION_retrieve(prog, &f);
318 ret = fp->func(argc, argv);
322 /* If there is stuff on the command line, run with that. */
326 ret = do_cmd(prog, argc, argv);
332 /* ok, lets enter interactive mode */
335 /* Read a line, continue reading if line ends with \ */
336 for (p = buf, n = sizeof(buf), i = 0, first = 1; n > 0; first = 0) {
337 prompt = first ? "OpenSSL> " : "> ";
340 fputs(prompt, stdout);
342 if (!fgets(p, n, stdin))
349 if (p[i - 2] != '\\')
356 extern char *readline(const char *);
357 extern void add_history(const char *cp);
360 text = readline(prompt);
366 if (text[i - 1] != '\\') {
367 p += strlen(strcpy(p, text));
374 p += strlen(strcpy(p, text));
381 if (!chopup_args(&arg, buf)) {
382 BIO_printf(bio_err, "Can't parse (no memory?)\n");
386 ret = do_cmd(prog, arg.argc, arg.argv);
387 if (ret == EXIT_THE_PROGRAM) {
392 BIO_printf(bio_err, "error in %s\n", arg.argv[0]);
393 (void)BIO_flush(bio_out);
394 (void)BIO_flush(bio_err);
398 OPENSSL_free(default_config_file);
399 lh_FUNCTION_free(prog);
400 OPENSSL_free(arg.argv);
404 BIO_free_all(bio_out);
406 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
407 if (CRYPTO_mem_leaks(bio_err) <= 0)
414 static void list_cipher_fn(const EVP_CIPHER *c,
415 const char *from, const char *to, void *arg)
418 BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
421 from = "<undefined>";
424 BIO_printf(arg, "%s => %s\n", from, to);
428 static void list_md_fn(const EVP_MD *m,
429 const char *from, const char *to, void *arg)
432 BIO_printf(arg, "%s\n", EVP_MD_name(m));
435 from = "<undefined>";
438 BIO_printf((BIO *)arg, "%s => %s\n", from, to);
442 static void list_mac_fn(const EVP_MAC *m,
443 const char *from, const char *to, void *arg)
446 BIO_printf(arg, "%s\n", EVP_MAC_name(m));
449 from = "<undefined>";
452 BIO_printf(arg, "%s => %s\n", from, to);
456 static void list_missing_help(void)
461 for (fp = functions; fp->name != NULL; fp++) {
462 if ((o = fp->help) != NULL) {
463 /* If there is help, list what flags are not documented. */
464 for ( ; o->name != NULL; o++) {
465 if (o->helpstr == NULL)
466 BIO_printf(bio_out, "%s %s\n", fp->name, o->name);
468 } else if (fp->func != dgst_main) {
469 /* If not aliased to the dgst command, */
470 BIO_printf(bio_out, "%s *\n", fp->name);
475 static void list_objects(void)
477 int max_nid = OBJ_new_nid(0);
479 char *oid_buf = NULL;
482 /* Skip 0, since that's NID_undef */
483 for (i = 1; i < max_nid; i++) {
484 const ASN1_OBJECT *obj = OBJ_nid2obj(i);
485 const char *sn = OBJ_nid2sn(i);
486 const char *ln = OBJ_nid2ln(i);
490 * If one of the retrieved objects somehow generated an error,
491 * we ignore it. The check for NID_undef below will detect the
492 * error and simply skip to the next NID.
496 if (OBJ_obj2nid(obj) == NID_undef)
499 if ((n = OBJ_obj2txt(NULL, 0, obj, 1)) == 0) {
500 BIO_printf(bio_out, "# None-OID object: %s, %s\n", sn, ln);
507 oid_buf = OPENSSL_realloc(oid_buf, n + 1);
508 if (oid_buf == NULL) {
509 BIO_printf(bio_err, "ERROR: Memory allocation\n");
514 if (OBJ_obj2txt(oid_buf, oid_size, obj, 1) < 0)
516 if (ln == NULL || strcmp(sn, ln) == 0)
517 BIO_printf(bio_out, "%s = %s\n", sn, oid_buf);
519 BIO_printf(bio_out, "%s = %s, %s\n", sn, ln, oid_buf);
522 OPENSSL_free(oid_buf);
525 static void list_options_for_command(const char *command)
530 for (fp = functions; fp->name != NULL; fp++)
531 if (strcmp(fp->name, command) == 0)
533 if (fp->name == NULL) {
534 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
539 if ((o = fp->help) == NULL)
542 for ( ; o->name != NULL; o++) {
543 if (o->name == OPT_HELP_STR
544 || o->name == OPT_MORE_STR
545 || o->name[0] == '\0')
547 BIO_printf(bio_out, "%s %c\n", o->name, o->valtype);
552 /* Unified enum for help and list commands. */
553 typedef enum HELPLIST_CHOICE {
554 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE,
555 OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS,
556 OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
557 OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_ENGINES, OPT_DISABLED,
558 OPT_MISSING_HELP, OPT_OBJECTS
561 const OPTIONS list_options[] = {
562 {"help", OPT_HELP, '-', "Display this summary"},
563 {"1", OPT_ONE, '-', "List in one column"},
564 {"commands", OPT_COMMANDS, '-', "List of standard commands"},
565 {"digest-commands", OPT_DIGEST_COMMANDS, '-',
566 "List of message digest commands"},
567 {"digest-algorithms", OPT_DIGEST_ALGORITHMS, '-',
568 "List of message digest algorithms"},
569 {"mac-algorithms", OPT_MAC_ALGORITHMS, '-',
570 "List of message authentication code algorithms"},
571 {"cipher-commands", OPT_CIPHER_COMMANDS, '-', "List of cipher commands"},
572 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS, '-',
573 "List of cipher algorithms"},
574 {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
575 "List of public key algorithms"},
576 {"public-key-methods", OPT_PK_METHOD, '-',
577 "List of public key methods"},
578 {"engines", OPT_ENGINES, '-',
579 "List of loaded engines"},
580 {"disabled", OPT_DISABLED, '-',
581 "List of disabled features"},
582 {"missing-help", OPT_MISSING_HELP, '-',
583 "List missing detailed help strings"},
584 {"options", OPT_OPTIONS, 's',
585 "List options for specified command"},
586 {"objects", OPT_OBJECTS, '-',
587 "List built in objects (OID<->name mappings)"},
591 int list_main(int argc, char **argv)
595 int one = 0, done = 0;
597 prog = opt_init(argc, argv, list_options);
598 while ((o = opt_next()) != OPT_EOF) {
600 case OPT_EOF: /* Never hit, but suppresses warning */
603 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
606 opt_help(list_options);
612 list_type(FT_general, one);
614 case OPT_DIGEST_COMMANDS:
615 list_type(FT_md, one);
617 case OPT_DIGEST_ALGORITHMS:
618 EVP_MD_do_all_sorted(list_md_fn, bio_out);
620 case OPT_MAC_ALGORITHMS:
621 EVP_MAC_do_all_sorted(list_mac_fn, bio_out);
623 case OPT_CIPHER_COMMANDS:
624 list_type(FT_cipher, one);
626 case OPT_CIPHER_ALGORITHMS:
627 EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
629 case OPT_PK_ALGORITHMS:
641 case OPT_MISSING_HELP:
648 list_options_for_command(opt_arg());
653 if (opt_num_rest() != 0) {
654 BIO_printf(bio_err, "Extra arguments given.\n");
664 typedef enum HELP_CHOICE {
665 OPT_hERR = -1, OPT_hEOF = 0, OPT_hHELP
668 const OPTIONS help_options[] = {
669 {OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
670 {OPT_HELP_STR, 1, '-', " help [command]\n"},
671 {"help", OPT_hHELP, '-', "Display this summary"},
676 int help_main(int argc, char **argv)
685 prog = opt_init(argc, argv, help_options);
686 while ((o = opt_next()) != OPT_hEOF) {
690 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
693 opt_help(help_options);
698 if (opt_num_rest() == 1) {
701 new_argv[0] = opt_rest()[0];
702 new_argv[1] = "--help";
704 return do_cmd(prog_init(), 2, new_argv);
706 if (opt_num_rest() != 0) {
707 BIO_printf(bio_err, "Usage: %s\n", prog);
711 calculate_columns(&dc);
712 BIO_printf(bio_err, "Standard commands");
715 for (fp = functions; fp->name != NULL; fp++) {
717 if (i++ % dc.columns == 0) {
718 BIO_printf(bio_err, "\n");
721 if (fp->type != tp) {
724 BIO_printf(bio_err, "\n");
728 "\nMessage Digest commands (see the `dgst' command for more details)\n");
729 } else if (tp == FT_cipher) {
732 "\nCipher commands (see the `enc' command for more details)\n");
735 BIO_printf(bio_err, "%-*s", dc.width, fp->name);
737 BIO_printf(bio_err, "\n\n");
741 static void list_type(FUNC_TYPE ft, int one)
747 memset(&dc, 0, sizeof(dc));
749 calculate_columns(&dc);
751 for (fp = functions; fp->name != NULL; fp++) {
755 BIO_printf(bio_out, "%s\n", fp->name);
757 if (i % dc.columns == 0 && i > 0)
758 BIO_printf(bio_out, "\n");
759 BIO_printf(bio_out, "%-*s", dc.width, fp->name);
764 BIO_printf(bio_out, "\n\n");
767 static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
771 if (argc <= 0 || argv[0] == NULL)
774 fp = lh_FUNCTION_retrieve(prog, &f);
776 if (EVP_get_digestbyname(argv[0])) {
780 } else if (EVP_get_cipherbyname(argv[0])) {
787 return fp->func(argc, argv);
789 if ((strncmp(argv[0], "no-", 3)) == 0) {
791 * User is asking if foo is unsupported, by trying to "run" the
792 * no-foo command. Strange.
794 f.name = argv[0] + 3;
795 if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
796 BIO_printf(bio_out, "%s\n", argv[0]);
799 BIO_printf(bio_out, "%s\n", argv[0] + 3);
802 if (strcmp(argv[0], "quit") == 0 || strcmp(argv[0], "q") == 0 ||
803 strcmp(argv[0], "exit") == 0 || strcmp(argv[0], "bye") == 0)
804 /* Special value to mean "exit the program. */
805 return EXIT_THE_PROGRAM;
807 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
812 static void list_pkey(void)
816 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
817 const EVP_PKEY_ASN1_METHOD *ameth;
818 int pkey_id, pkey_base_id, pkey_flags;
819 const char *pinfo, *pem_str;
820 ameth = EVP_PKEY_asn1_get0(i);
821 EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
822 &pinfo, &pem_str, ameth);
823 if (pkey_flags & ASN1_PKEY_ALIAS) {
824 BIO_printf(bio_out, "Name: %s\n", OBJ_nid2ln(pkey_id));
825 BIO_printf(bio_out, "\tAlias for: %s\n",
826 OBJ_nid2ln(pkey_base_id));
828 BIO_printf(bio_out, "Name: %s\n", pinfo);
829 BIO_printf(bio_out, "\tType: %s Algorithm\n",
830 pkey_flags & ASN1_PKEY_DYNAMIC ?
831 "External" : "Builtin");
832 BIO_printf(bio_out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
835 BIO_printf(bio_out, "\tPEM string: %s\n", pem_str);
841 static void list_pkey_meth(void)
844 size_t meth_count = EVP_PKEY_meth_get_count();
846 for (i = 0; i < meth_count; i++) {
847 const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
848 int pkey_id, pkey_flags;
850 EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
851 BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
852 BIO_printf(bio_out, "\tType: %s Algorithm\n",
853 pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin");
857 static int function_cmp(const FUNCTION * a, const FUNCTION * b)
859 return strncmp(a->name, b->name, 8);
862 static unsigned long function_hash(const FUNCTION * a)
864 return OPENSSL_LH_strhash(a->name);
867 static int SortFnByName(const void *_f1, const void *_f2)
869 const FUNCTION *f1 = _f1;
870 const FUNCTION *f2 = _f2;
872 if (f1->type != f2->type)
873 return f1->type - f2->type;
874 return strcmp(f1->name, f2->name);
877 static void list_engines(void)
879 #ifndef OPENSSL_NO_ENGINE
882 BIO_puts(bio_out, "Engines:\n");
883 e = ENGINE_get_first();
885 BIO_printf(bio_out, "%s\n", ENGINE_get_id(e));
886 e = ENGINE_get_next(e);
889 BIO_puts(bio_out, "Engine support is disabled.\n");
893 static void list_disabled(void)
895 BIO_puts(bio_out, "Disabled algorithms:\n");
896 #ifdef OPENSSL_NO_ARIA
897 BIO_puts(bio_out, "ARIA\n");
900 BIO_puts(bio_out, "BF\n");
902 #ifdef OPENSSL_NO_BLAKE2
903 BIO_puts(bio_out, "BLAKE2\n");
905 #ifdef OPENSSL_NO_CAMELLIA
906 BIO_puts(bio_out, "CAMELLIA\n");
908 #ifdef OPENSSL_NO_CAST
909 BIO_puts(bio_out, "CAST\n");
911 #ifdef OPENSSL_NO_CMAC
912 BIO_puts(bio_out, "CMAC\n");
914 #ifdef OPENSSL_NO_CMS
915 BIO_puts(bio_out, "CMS\n");
917 #ifdef OPENSSL_NO_COMP
918 BIO_puts(bio_out, "COMP\n");
920 #ifdef OPENSSL_NO_DES
921 BIO_puts(bio_out, "DES\n");
923 #ifdef OPENSSL_NO_DGRAM
924 BIO_puts(bio_out, "DGRAM\n");
927 BIO_puts(bio_out, "DH\n");
929 #ifdef OPENSSL_NO_DSA
930 BIO_puts(bio_out, "DSA\n");
932 #if defined(OPENSSL_NO_DTLS)
933 BIO_puts(bio_out, "DTLS\n");
935 #if defined(OPENSSL_NO_DTLS1)
936 BIO_puts(bio_out, "DTLS1\n");
938 #if defined(OPENSSL_NO_DTLS1_2)
939 BIO_puts(bio_out, "DTLS1_2\n");
942 BIO_puts(bio_out, "EC\n");
944 #ifdef OPENSSL_NO_EC2M
945 BIO_puts(bio_out, "EC2M\n");
947 #ifdef OPENSSL_NO_ENGINE
948 BIO_puts(bio_out, "ENGINE\n");
950 #ifdef OPENSSL_NO_GOST
951 BIO_puts(bio_out, "GOST\n");
953 #ifdef OPENSSL_NO_IDEA
954 BIO_puts(bio_out, "IDEA\n");
956 #ifdef OPENSSL_NO_MD2
957 BIO_puts(bio_out, "MD2\n");
959 #ifdef OPENSSL_NO_MD4
960 BIO_puts(bio_out, "MD4\n");
962 #ifdef OPENSSL_NO_MD5
963 BIO_puts(bio_out, "MD5\n");
965 #ifdef OPENSSL_NO_MDC2
966 BIO_puts(bio_out, "MDC2\n");
968 #ifdef OPENSSL_NO_OCB
969 BIO_puts(bio_out, "OCB\n");
971 #ifdef OPENSSL_NO_OCSP
972 BIO_puts(bio_out, "OCSP\n");
974 #ifdef OPENSSL_NO_PSK
975 BIO_puts(bio_out, "PSK\n");
977 #ifdef OPENSSL_NO_RC2
978 BIO_puts(bio_out, "RC2\n");
980 #ifdef OPENSSL_NO_RC4
981 BIO_puts(bio_out, "RC4\n");
983 #ifdef OPENSSL_NO_RC5
984 BIO_puts(bio_out, "RC5\n");
986 #ifdef OPENSSL_NO_RMD160
987 BIO_puts(bio_out, "RMD160\n");
989 #ifdef OPENSSL_NO_RSA
990 BIO_puts(bio_out, "RSA\n");
992 #ifdef OPENSSL_NO_SCRYPT
993 BIO_puts(bio_out, "SCRYPT\n");
995 #ifdef OPENSSL_NO_SCTP
996 BIO_puts(bio_out, "SCTP\n");
998 #ifdef OPENSSL_NO_SEED
999 BIO_puts(bio_out, "SEED\n");
1001 #ifdef OPENSSL_NO_SM2
1002 BIO_puts(bio_out, "SM2\n");
1004 #ifdef OPENSSL_NO_SM3
1005 BIO_puts(bio_out, "SM3\n");
1007 #ifdef OPENSSL_NO_SM4
1008 BIO_puts(bio_out, "SM4\n");
1010 #ifdef OPENSSL_NO_SOCK
1011 BIO_puts(bio_out, "SOCK\n");
1013 #ifdef OPENSSL_NO_SRP
1014 BIO_puts(bio_out, "SRP\n");
1016 #ifdef OPENSSL_NO_SRTP
1017 BIO_puts(bio_out, "SRTP\n");
1019 #ifdef OPENSSL_NO_SSL3
1020 BIO_puts(bio_out, "SSL3\n");
1022 #ifdef OPENSSL_NO_TLS1
1023 BIO_puts(bio_out, "TLS1\n");
1025 #ifdef OPENSSL_NO_TLS1_1
1026 BIO_puts(bio_out, "TLS1_1\n");
1028 #ifdef OPENSSL_NO_TLS1_2
1029 BIO_puts(bio_out, "TLS1_2\n");
1031 #ifdef OPENSSL_NO_WHIRLPOOL
1032 BIO_puts(bio_out, "WHIRLPOOL\n");
1035 BIO_puts(bio_out, "ZLIB\n");
1039 static LHASH_OF(FUNCTION) *prog_init(void)
1041 static LHASH_OF(FUNCTION) *ret = NULL;
1042 static int prog_inited = 0;
1051 /* Sort alphabetically within category. For nicer help displays. */
1052 for (i = 0, f = functions; f->name != NULL; ++f, ++i)
1054 qsort(functions, i, sizeof(*functions), SortFnByName);
1056 if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
1059 for (f = functions; f->name != NULL; f++)
1060 (void)lh_FUNCTION_insert(ret, f);