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);
121 typedef struct tracedata_st {
123 unsigned int ingroup:1;
126 static size_t internal_trace_cb(const char *buf, size_t cnt,
127 int category, int cmd, void *vdata)
130 tracedata *trace_data = vdata;
134 case OSSL_TRACE_CTRL_BEGIN:
135 trace_data->ingroup = 1;
138 case OSSL_TRACE_CTRL_DURING:
139 if (!trace_data->ingroup)
142 case OSSL_TRACE_CTRL_END:
143 trace_data->ingroup = 0;
149 CRYPTO_THREAD_ID tid;
155 tid.tid = CRYPTO_THREAD_get_current_id();
157 BIO_snprintf(buffer, sizeof(buffer), "TRACE[%lx]:%s: ", tid.ltid,
158 OSSL_trace_get_category_name(category));
159 BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
160 strlen(buffer), buffer);
162 ret = BIO_write(trace_data->bio, buf, cnt);
164 return ret < 0 ? 0 : ret;
167 DEFINE_STACK_OF(tracedata)
168 static STACK_OF(tracedata) *trace_data_stack;
170 static void tracedata_free(tracedata *data)
172 BIO_free_all(data->bio);
176 static STACK_OF(tracedata) *trace_data_stack;
178 static void cleanup_trace(void)
180 sk_tracedata_pop_free(trace_data_stack, tracedata_free);
183 static void setup_trace(const char *str)
187 trace_data_stack = sk_tracedata_new_null();
188 val = OPENSSL_strdup(str);
194 for (valp = val; (item = strtok(valp, ",")) != NULL; valp = NULL) {
195 int category = OSSL_trace_get_category_num(item);
198 BIO *channel = BIO_push(BIO_new(apps_bf_prefix()),
199 dup_bio_err(FORMAT_TEXT));
200 tracedata *trace_data = OPENSSL_zalloc(sizeof(*trace_data));
202 if (trace_data == NULL
203 || (trace_data->bio = channel) == NULL
204 || OSSL_trace_set_callback(category, internal_trace_cb,
206 || sk_tracedata_push(trace_data_stack, trace_data) == 0) {
207 OSSL_trace_set_callback(category, NULL, NULL);
208 BIO_free_all(channel);
210 "warning: unable to setup trace callback for category '%s'.\n",
215 "warning: unknown trace category: '%s'.\n",
222 atexit(cleanup_trace);
225 int main(int argc, char *argv[])
228 LHASH_OF(FUNCTION) *prog = NULL;
233 int first, n, i, ret = 0;
238 /* Set up some of the environment. */
239 default_config_file = make_config_name();
240 bio_in = dup_bio_in(FORMAT_TEXT);
241 bio_out = dup_bio_out(FORMAT_TEXT);
242 bio_err = dup_bio_err(FORMAT_TEXT);
244 #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
245 argv = copy_argv(&argc, argv);
246 #elif defined(_WIN32)
248 * Replace argv[] with UTF-8 encoded strings.
250 win32_utf8argv(&argc, &argv);
254 * We use the prefix method to get the trace output we want. Since some
255 * trace outputs happen with OPENSSL_cleanup(), which is run automatically
256 * after exit(), we need to destroy the prefix method as late as possible.
258 atexit(destroy_prefix_method);
260 setup_trace(getenv("OPENSSL_TRACE"));
262 p = getenv("OPENSSL_DEBUG_MEMORY");
263 if (p != NULL && strcmp(p, "on") == 0)
264 CRYPTO_set_mem_debug(1);
265 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
267 if (getenv("OPENSSL_FIPS")) {
268 BIO_printf(bio_err, "FIPS mode not supported.\n");
272 if (!apps_startup()) {
274 "FATAL: Startup failure (dev note: apps_startup() failed)\n");
275 ERR_print_errors(bio_err);
281 pname = opt_progname(argv[0]);
283 /* first check the program name */
285 fp = lh_FUNCTION_retrieve(prog, &f);
288 ret = fp->func(argc, argv);
292 /* If there is stuff on the command line, run with that. */
296 ret = do_cmd(prog, argc, argv);
302 /* ok, lets enter interactive mode */
305 /* Read a line, continue reading if line ends with \ */
306 for (p = buf, n = sizeof(buf), i = 0, first = 1; n > 0; first = 0) {
307 prompt = first ? "OpenSSL> " : "> ";
310 fputs(prompt, stdout);
312 if (!fgets(p, n, stdin))
319 if (p[i - 2] != '\\')
326 extern char *readline(const char *);
327 extern void add_history(const char *cp);
330 text = readline(prompt);
336 if (text[i - 1] != '\\') {
337 p += strlen(strcpy(p, text));
344 p += strlen(strcpy(p, text));
351 if (!chopup_args(&arg, buf)) {
352 BIO_printf(bio_err, "Can't parse (no memory?)\n");
356 ret = do_cmd(prog, arg.argc, arg.argv);
357 if (ret == EXIT_THE_PROGRAM) {
362 BIO_printf(bio_err, "error in %s\n", arg.argv[0]);
363 (void)BIO_flush(bio_out);
364 (void)BIO_flush(bio_err);
368 OPENSSL_free(default_config_file);
369 lh_FUNCTION_free(prog);
370 OPENSSL_free(arg.argv);
374 BIO_free_all(bio_out);
376 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
377 if (CRYPTO_mem_leaks(bio_err) <= 0)
384 static void list_cipher_fn(const EVP_CIPHER *c,
385 const char *from, const char *to, void *arg)
388 BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
391 from = "<undefined>";
394 BIO_printf(arg, "%s => %s\n", from, to);
398 static void list_md_fn(const EVP_MD *m,
399 const char *from, const char *to, void *arg)
402 BIO_printf(arg, "%s\n", EVP_MD_name(m));
405 from = "<undefined>";
408 BIO_printf((BIO *)arg, "%s => %s\n", from, to);
412 static void list_mac_fn(const EVP_MAC *m,
413 const char *from, const char *to, void *arg)
416 BIO_printf(arg, "%s\n", EVP_MAC_name(m));
419 from = "<undefined>";
422 BIO_printf(arg, "%s => %s\n", from, to);
426 static void list_missing_help(void)
431 for (fp = functions; fp->name != NULL; fp++) {
432 if ((o = fp->help) != NULL) {
433 /* If there is help, list what flags are not documented. */
434 for ( ; o->name != NULL; o++) {
435 if (o->helpstr == NULL)
436 BIO_printf(bio_out, "%s %s\n", fp->name, o->name);
438 } else if (fp->func != dgst_main) {
439 /* If not aliased to the dgst command, */
440 BIO_printf(bio_out, "%s *\n", fp->name);
445 static void list_objects(void)
447 int max_nid = OBJ_new_nid(0);
449 char *oid_buf = NULL;
452 /* Skip 0, since that's NID_undef */
453 for (i = 1; i < max_nid; i++) {
454 const ASN1_OBJECT *obj = OBJ_nid2obj(i);
455 const char *sn = OBJ_nid2sn(i);
456 const char *ln = OBJ_nid2ln(i);
460 * If one of the retrieved objects somehow generated an error,
461 * we ignore it. The check for NID_undef below will detect the
462 * error and simply skip to the next NID.
466 if (OBJ_obj2nid(obj) == NID_undef)
469 if ((n = OBJ_obj2txt(NULL, 0, obj, 1)) == 0) {
470 BIO_printf(bio_out, "# None-OID object: %s, %s\n", sn, ln);
477 oid_buf = OPENSSL_realloc(oid_buf, n + 1);
478 if (oid_buf == NULL) {
479 BIO_printf(bio_err, "ERROR: Memory allocation\n");
484 if (OBJ_obj2txt(oid_buf, oid_size, obj, 1) < 0)
486 if (ln == NULL || strcmp(sn, ln) == 0)
487 BIO_printf(bio_out, "%s = %s\n", sn, oid_buf);
489 BIO_printf(bio_out, "%s = %s, %s\n", sn, ln, oid_buf);
492 OPENSSL_free(oid_buf);
495 static void list_options_for_command(const char *command)
500 for (fp = functions; fp->name != NULL; fp++)
501 if (strcmp(fp->name, command) == 0)
503 if (fp->name == NULL) {
504 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
509 if ((o = fp->help) == NULL)
512 for ( ; o->name != NULL; o++) {
513 if (o->name == OPT_HELP_STR
514 || o->name == OPT_MORE_STR
515 || o->name[0] == '\0')
517 BIO_printf(bio_out, "%s %c\n", o->name, o->valtype);
522 /* Unified enum for help and list commands. */
523 typedef enum HELPLIST_CHOICE {
524 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE,
525 OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS,
526 OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
527 OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_ENGINES, OPT_DISABLED,
528 OPT_MISSING_HELP, OPT_OBJECTS
531 const OPTIONS list_options[] = {
532 {"help", OPT_HELP, '-', "Display this summary"},
533 {"1", OPT_ONE, '-', "List in one column"},
534 {"commands", OPT_COMMANDS, '-', "List of standard commands"},
535 {"digest-commands", OPT_DIGEST_COMMANDS, '-',
536 "List of message digest commands"},
537 {"digest-algorithms", OPT_DIGEST_ALGORITHMS, '-',
538 "List of message digest algorithms"},
539 {"mac-algorithms", OPT_MAC_ALGORITHMS, '-',
540 "List of message authentication code algorithms"},
541 {"cipher-commands", OPT_CIPHER_COMMANDS, '-', "List of cipher commands"},
542 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS, '-',
543 "List of cipher algorithms"},
544 {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
545 "List of public key algorithms"},
546 {"public-key-methods", OPT_PK_METHOD, '-',
547 "List of public key methods"},
548 {"engines", OPT_ENGINES, '-',
549 "List of loaded engines"},
550 {"disabled", OPT_DISABLED, '-',
551 "List of disabled features"},
552 {"missing-help", OPT_MISSING_HELP, '-',
553 "List missing detailed help strings"},
554 {"options", OPT_OPTIONS, 's',
555 "List options for specified command"},
556 {"objects", OPT_OBJECTS, '-',
557 "List built in objects (OID<->name mappings)"},
561 int list_main(int argc, char **argv)
565 int one = 0, done = 0;
567 prog = opt_init(argc, argv, list_options);
568 while ((o = opt_next()) != OPT_EOF) {
570 case OPT_EOF: /* Never hit, but suppresses warning */
573 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
576 opt_help(list_options);
582 list_type(FT_general, one);
584 case OPT_DIGEST_COMMANDS:
585 list_type(FT_md, one);
587 case OPT_DIGEST_ALGORITHMS:
588 EVP_MD_do_all_sorted(list_md_fn, bio_out);
590 case OPT_MAC_ALGORITHMS:
591 EVP_MAC_do_all_sorted(list_mac_fn, bio_out);
593 case OPT_CIPHER_COMMANDS:
594 list_type(FT_cipher, one);
596 case OPT_CIPHER_ALGORITHMS:
597 EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
599 case OPT_PK_ALGORITHMS:
611 case OPT_MISSING_HELP:
618 list_options_for_command(opt_arg());
623 if (opt_num_rest() != 0) {
624 BIO_printf(bio_err, "Extra arguments given.\n");
634 typedef enum HELP_CHOICE {
635 OPT_hERR = -1, OPT_hEOF = 0, OPT_hHELP
638 const OPTIONS help_options[] = {
639 {OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
640 {OPT_HELP_STR, 1, '-', " help [command]\n"},
641 {"help", OPT_hHELP, '-', "Display this summary"},
646 int help_main(int argc, char **argv)
655 prog = opt_init(argc, argv, help_options);
656 while ((o = opt_next()) != OPT_hEOF) {
660 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
663 opt_help(help_options);
668 if (opt_num_rest() == 1) {
671 new_argv[0] = opt_rest()[0];
672 new_argv[1] = "--help";
674 return do_cmd(prog_init(), 2, new_argv);
676 if (opt_num_rest() != 0) {
677 BIO_printf(bio_err, "Usage: %s\n", prog);
681 calculate_columns(&dc);
682 BIO_printf(bio_err, "Standard commands");
685 for (fp = functions; fp->name != NULL; fp++) {
687 if (i++ % dc.columns == 0) {
688 BIO_printf(bio_err, "\n");
691 if (fp->type != tp) {
694 BIO_printf(bio_err, "\n");
698 "\nMessage Digest commands (see the `dgst' command for more details)\n");
699 } else if (tp == FT_cipher) {
702 "\nCipher commands (see the `enc' command for more details)\n");
705 BIO_printf(bio_err, "%-*s", dc.width, fp->name);
707 BIO_printf(bio_err, "\n\n");
711 static void list_type(FUNC_TYPE ft, int one)
715 DISPLAY_COLUMNS dc = {0};
718 calculate_columns(&dc);
720 for (fp = functions; fp->name != NULL; fp++) {
724 BIO_printf(bio_out, "%s\n", fp->name);
726 if (i % dc.columns == 0 && i > 0)
727 BIO_printf(bio_out, "\n");
728 BIO_printf(bio_out, "%-*s", dc.width, fp->name);
733 BIO_printf(bio_out, "\n\n");
736 static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
740 if (argc <= 0 || argv[0] == NULL)
743 fp = lh_FUNCTION_retrieve(prog, &f);
745 if (EVP_get_digestbyname(argv[0])) {
749 } else if (EVP_get_cipherbyname(argv[0])) {
756 return fp->func(argc, argv);
758 if ((strncmp(argv[0], "no-", 3)) == 0) {
760 * User is asking if foo is unsupported, by trying to "run" the
761 * no-foo command. Strange.
763 f.name = argv[0] + 3;
764 if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
765 BIO_printf(bio_out, "%s\n", argv[0]);
768 BIO_printf(bio_out, "%s\n", argv[0] + 3);
771 if (strcmp(argv[0], "quit") == 0 || strcmp(argv[0], "q") == 0 ||
772 strcmp(argv[0], "exit") == 0 || strcmp(argv[0], "bye") == 0)
773 /* Special value to mean "exit the program. */
774 return EXIT_THE_PROGRAM;
776 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
781 static void list_pkey(void)
785 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
786 const EVP_PKEY_ASN1_METHOD *ameth;
787 int pkey_id, pkey_base_id, pkey_flags;
788 const char *pinfo, *pem_str;
789 ameth = EVP_PKEY_asn1_get0(i);
790 EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
791 &pinfo, &pem_str, ameth);
792 if (pkey_flags & ASN1_PKEY_ALIAS) {
793 BIO_printf(bio_out, "Name: %s\n", OBJ_nid2ln(pkey_id));
794 BIO_printf(bio_out, "\tAlias for: %s\n",
795 OBJ_nid2ln(pkey_base_id));
797 BIO_printf(bio_out, "Name: %s\n", pinfo);
798 BIO_printf(bio_out, "\tType: %s Algorithm\n",
799 pkey_flags & ASN1_PKEY_DYNAMIC ?
800 "External" : "Builtin");
801 BIO_printf(bio_out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
804 BIO_printf(bio_out, "\tPEM string: %s\n", pem_str);
810 static void list_pkey_meth(void)
813 size_t meth_count = EVP_PKEY_meth_get_count();
815 for (i = 0; i < meth_count; i++) {
816 const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
817 int pkey_id, pkey_flags;
819 EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
820 BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
821 BIO_printf(bio_out, "\tType: %s Algorithm\n",
822 pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin");
826 static int function_cmp(const FUNCTION * a, const FUNCTION * b)
828 return strncmp(a->name, b->name, 8);
831 static unsigned long function_hash(const FUNCTION * a)
833 return OPENSSL_LH_strhash(a->name);
836 static int SortFnByName(const void *_f1, const void *_f2)
838 const FUNCTION *f1 = _f1;
839 const FUNCTION *f2 = _f2;
841 if (f1->type != f2->type)
842 return f1->type - f2->type;
843 return strcmp(f1->name, f2->name);
846 static void list_engines(void)
848 #ifndef OPENSSL_NO_ENGINE
851 BIO_puts(bio_out, "Engines:\n");
852 e = ENGINE_get_first();
854 BIO_printf(bio_out, "%s\n", ENGINE_get_id(e));
855 e = ENGINE_get_next(e);
858 BIO_puts(bio_out, "Engine support is disabled.\n");
862 static void list_disabled(void)
864 BIO_puts(bio_out, "Disabled algorithms:\n");
865 #ifdef OPENSSL_NO_ARIA
866 BIO_puts(bio_out, "ARIA\n");
869 BIO_puts(bio_out, "BF\n");
871 #ifdef OPENSSL_NO_BLAKE2
872 BIO_puts(bio_out, "BLAKE2\n");
874 #ifdef OPENSSL_NO_CAMELLIA
875 BIO_puts(bio_out, "CAMELLIA\n");
877 #ifdef OPENSSL_NO_CAST
878 BIO_puts(bio_out, "CAST\n");
880 #ifdef OPENSSL_NO_CMAC
881 BIO_puts(bio_out, "CMAC\n");
883 #ifdef OPENSSL_NO_CMS
884 BIO_puts(bio_out, "CMS\n");
886 #ifdef OPENSSL_NO_COMP
887 BIO_puts(bio_out, "COMP\n");
889 #ifdef OPENSSL_NO_DES
890 BIO_puts(bio_out, "DES\n");
892 #ifdef OPENSSL_NO_DGRAM
893 BIO_puts(bio_out, "DGRAM\n");
896 BIO_puts(bio_out, "DH\n");
898 #ifdef OPENSSL_NO_DSA
899 BIO_puts(bio_out, "DSA\n");
901 #if defined(OPENSSL_NO_DTLS)
902 BIO_puts(bio_out, "DTLS\n");
904 #if defined(OPENSSL_NO_DTLS1)
905 BIO_puts(bio_out, "DTLS1\n");
907 #if defined(OPENSSL_NO_DTLS1_2)
908 BIO_puts(bio_out, "DTLS1_2\n");
911 BIO_puts(bio_out, "EC\n");
913 #ifdef OPENSSL_NO_EC2M
914 BIO_puts(bio_out, "EC2M\n");
916 #ifdef OPENSSL_NO_ENGINE
917 BIO_puts(bio_out, "ENGINE\n");
919 #ifdef OPENSSL_NO_GOST
920 BIO_puts(bio_out, "GOST\n");
922 #ifdef OPENSSL_NO_HEARTBEATS
923 BIO_puts(bio_out, "HEARTBEATS\n");
925 #ifdef OPENSSL_NO_IDEA
926 BIO_puts(bio_out, "IDEA\n");
928 #ifdef OPENSSL_NO_MD2
929 BIO_puts(bio_out, "MD2\n");
931 #ifdef OPENSSL_NO_MD4
932 BIO_puts(bio_out, "MD4\n");
934 #ifdef OPENSSL_NO_MD5
935 BIO_puts(bio_out, "MD5\n");
937 #ifdef OPENSSL_NO_MDC2
938 BIO_puts(bio_out, "MDC2\n");
940 #ifdef OPENSSL_NO_OCB
941 BIO_puts(bio_out, "OCB\n");
943 #ifdef OPENSSL_NO_OCSP
944 BIO_puts(bio_out, "OCSP\n");
946 #ifdef OPENSSL_NO_PSK
947 BIO_puts(bio_out, "PSK\n");
949 #ifdef OPENSSL_NO_RC2
950 BIO_puts(bio_out, "RC2\n");
952 #ifdef OPENSSL_NO_RC4
953 BIO_puts(bio_out, "RC4\n");
955 #ifdef OPENSSL_NO_RC5
956 BIO_puts(bio_out, "RC5\n");
958 #ifdef OPENSSL_NO_RMD160
959 BIO_puts(bio_out, "RMD160\n");
961 #ifdef OPENSSL_NO_RSA
962 BIO_puts(bio_out, "RSA\n");
964 #ifdef OPENSSL_NO_SCRYPT
965 BIO_puts(bio_out, "SCRYPT\n");
967 #ifdef OPENSSL_NO_SCTP
968 BIO_puts(bio_out, "SCTP\n");
970 #ifdef OPENSSL_NO_SEED
971 BIO_puts(bio_out, "SEED\n");
973 #ifdef OPENSSL_NO_SM2
974 BIO_puts(bio_out, "SM2\n");
976 #ifdef OPENSSL_NO_SM3
977 BIO_puts(bio_out, "SM3\n");
979 #ifdef OPENSSL_NO_SM4
980 BIO_puts(bio_out, "SM4\n");
982 #ifdef OPENSSL_NO_SOCK
983 BIO_puts(bio_out, "SOCK\n");
985 #ifdef OPENSSL_NO_SRP
986 BIO_puts(bio_out, "SRP\n");
988 #ifdef OPENSSL_NO_SRTP
989 BIO_puts(bio_out, "SRTP\n");
991 #ifdef OPENSSL_NO_SSL3
992 BIO_puts(bio_out, "SSL3\n");
994 #ifdef OPENSSL_NO_TLS1
995 BIO_puts(bio_out, "TLS1\n");
997 #ifdef OPENSSL_NO_TLS1_1
998 BIO_puts(bio_out, "TLS1_1\n");
1000 #ifdef OPENSSL_NO_TLS1_2
1001 BIO_puts(bio_out, "TLS1_2\n");
1003 #ifdef OPENSSL_NO_WHIRLPOOL
1004 BIO_puts(bio_out, "WHIRLPOOL\n");
1007 BIO_puts(bio_out, "ZLIB\n");
1011 static LHASH_OF(FUNCTION) *prog_init(void)
1013 static LHASH_OF(FUNCTION) *ret = NULL;
1014 static int prog_inited = 0;
1023 /* Sort alphabetically within category. For nicer help displays. */
1024 for (i = 0, f = functions; f->name != NULL; ++f, ++i)
1026 qsort(functions, i, sizeof(*functions), SortFnByName);
1028 if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
1031 for (f = functions; f->name != NULL; f++)
1032 (void)lh_FUNCTION_insert(ret, f);