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_disabled(void);
58 char *default_config_file = NULL;
64 static void calculate_columns(DISPLAY_COLUMNS *dc)
69 for (f = functions; f->name != NULL; ++f)
70 if (f->type == FT_general || f->type == FT_md || f->type == FT_cipher)
71 if ((len = strlen(f->name)) > maxlen)
74 dc->width = maxlen + 2;
75 dc->columns = (80 - 1) / dc->width;
78 static int apps_startup(void)
81 signal(SIGPIPE, SIG_IGN);
84 /* Set non-default library initialisation settings */
85 if (!OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN
86 | OPENSSL_INIT_LOAD_CONFIG, NULL))
94 static void apps_shutdown(void)
99 static char *make_config_name(void)
105 if ((t = getenv("OPENSSL_CONF")) != NULL)
106 return OPENSSL_strdup(t);
108 t = X509_get_default_cert_area();
109 len = strlen(t) + 1 + strlen(OPENSSL_CONF) + 1;
110 p = app_malloc(len, "config filename buffer");
112 #ifndef OPENSSL_SYS_VMS
115 strcat(p, OPENSSL_CONF);
120 typedef struct tracedata_st {
122 unsigned int ingroup:1;
125 static size_t internal_trace_cb(const char *buf, size_t cnt,
126 int category, int cmd, void *vdata)
129 tracedata *trace_data = vdata;
133 case OSSL_TRACE_CTRL_BEGIN:
134 trace_data->ingroup = 1;
137 case OSSL_TRACE_CTRL_DURING:
138 if (!trace_data->ingroup)
141 case OSSL_TRACE_CTRL_END:
142 trace_data->ingroup = 0;
148 CRYPTO_THREAD_ID tid;
154 tid.tid = CRYPTO_THREAD_get_current_id();
156 BIO_snprintf(buffer, sizeof(buffer), "TRACE[%lx]:%s: ", tid.ltid,
157 OSSL_trace_get_category_name(category));
158 BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
159 strlen(buffer), buffer);
161 ret = BIO_write(trace_data->bio, buf, cnt);
163 return ret < 0 ? 0 : ret;
166 DEFINE_STACK_OF(tracedata)
167 static STACK_OF(tracedata) *trace_data_stack;
169 static void tracedata_free(tracedata *data)
171 BIO_free_all(data->bio);
175 static STACK_OF(tracedata) *trace_data_stack;
177 static void cleanup_trace(void)
179 sk_tracedata_pop_free(trace_data_stack, tracedata_free);
182 static void setup_trace(const char *str)
186 trace_data_stack = sk_tracedata_new_null();
187 val = OPENSSL_strdup(str);
193 for (valp = val; (item = strtok(valp, ",")) != NULL; valp = NULL) {
194 int category = OSSL_trace_get_category_num(item);
197 BIO *channel = BIO_push(BIO_new(apps_bf_prefix()),
198 dup_bio_err(FORMAT_TEXT));
199 tracedata *trace_data = OPENSSL_zalloc(sizeof(*trace_data));
201 if (trace_data == NULL
202 || (trace_data->bio = channel) == NULL
203 || OSSL_trace_set_callback(category, internal_trace_cb,
205 || sk_tracedata_push(trace_data_stack, trace_data) == 0) {
206 OSSL_trace_set_callback(category, NULL, NULL);
207 BIO_free_all(channel);
209 "warning: unable to setup trace callback for category '%s'.\n",
214 "warning: unknown trace category: '%s'.\n",
221 atexit(cleanup_trace);
224 int main(int argc, char *argv[])
227 LHASH_OF(FUNCTION) *prog = NULL;
232 int first, n, i, ret = 0;
237 /* Set up some of the environment. */
238 default_config_file = make_config_name();
239 bio_in = dup_bio_in(FORMAT_TEXT);
240 bio_out = dup_bio_out(FORMAT_TEXT);
241 bio_err = dup_bio_err(FORMAT_TEXT);
243 #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
244 argv = copy_argv(&argc, argv);
245 #elif defined(_WIN32)
247 * Replace argv[] with UTF-8 encoded strings.
249 win32_utf8argv(&argc, &argv);
253 * We use the prefix method to get the trace output we want. Since some
254 * trace outputs happen with OPENSSL_cleanup(), which is run automatically
255 * after exit(), we need to destroy the prefix method as late as possible.
257 atexit(destroy_prefix_method);
259 setup_trace(getenv("OPENSSL_TRACE"));
261 p = getenv("OPENSSL_DEBUG_MEMORY");
262 if (p != NULL && strcmp(p, "on") == 0)
263 CRYPTO_set_mem_debug(1);
264 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
266 if (getenv("OPENSSL_FIPS")) {
267 BIO_printf(bio_err, "FIPS mode not supported.\n");
271 if (!apps_startup()) {
273 "FATAL: Startup failure (dev note: apps_startup() failed)\n");
274 ERR_print_errors(bio_err);
280 pname = opt_progname(argv[0]);
282 /* first check the program name */
284 fp = lh_FUNCTION_retrieve(prog, &f);
287 ret = fp->func(argc, argv);
291 /* If there is stuff on the command line, run with that. */
295 ret = do_cmd(prog, argc, argv);
301 /* ok, lets enter interactive mode */
304 /* Read a line, continue reading if line ends with \ */
305 for (p = buf, n = sizeof(buf), i = 0, first = 1; n > 0; first = 0) {
306 prompt = first ? "OpenSSL> " : "> ";
309 fputs(prompt, stdout);
311 if (!fgets(p, n, stdin))
318 if (p[i - 2] != '\\')
325 extern char *readline(const char *);
326 extern void add_history(const char *cp);
329 text = readline(prompt);
335 if (text[i - 1] != '\\') {
336 p += strlen(strcpy(p, text));
343 p += strlen(strcpy(p, text));
350 if (!chopup_args(&arg, buf)) {
351 BIO_printf(bio_err, "Can't parse (no memory?)\n");
355 ret = do_cmd(prog, arg.argc, arg.argv);
356 if (ret == EXIT_THE_PROGRAM) {
361 BIO_printf(bio_err, "error in %s\n", arg.argv[0]);
362 (void)BIO_flush(bio_out);
363 (void)BIO_flush(bio_err);
367 OPENSSL_free(default_config_file);
368 lh_FUNCTION_free(prog);
369 OPENSSL_free(arg.argv);
373 BIO_free_all(bio_out);
375 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
376 if (CRYPTO_mem_leaks(bio_err) <= 0)
383 static void list_cipher_fn(const EVP_CIPHER *c,
384 const char *from, const char *to, void *arg)
387 BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
390 from = "<undefined>";
393 BIO_printf(arg, "%s => %s\n", from, to);
397 static void list_md_fn(const EVP_MD *m,
398 const char *from, const char *to, void *arg)
401 BIO_printf(arg, "%s\n", EVP_MD_name(m));
404 from = "<undefined>";
407 BIO_printf((BIO *)arg, "%s => %s\n", from, to);
411 static void list_mac_fn(const EVP_MAC *m,
412 const char *from, const char *to, void *arg)
415 BIO_printf(arg, "%s\n", EVP_MAC_name(m));
418 from = "<undefined>";
421 BIO_printf(arg, "%s => %s\n", from, to);
425 static void list_missing_help(void)
430 for (fp = functions; fp->name != NULL; fp++) {
431 if ((o = fp->help) != NULL) {
432 /* If there is help, list what flags are not documented. */
433 for ( ; o->name != NULL; o++) {
434 if (o->helpstr == NULL)
435 BIO_printf(bio_out, "%s %s\n", fp->name, o->name);
437 } else if (fp->func != dgst_main) {
438 /* If not aliased to the dgst command, */
439 BIO_printf(bio_out, "%s *\n", fp->name);
444 static void list_objects(void)
446 int max_nid = OBJ_new_nid(0);
448 char *oid_buf = NULL;
451 /* Skip 0, since that's NID_undef */
452 for (i = 1; i < max_nid; i++) {
453 const ASN1_OBJECT *obj = OBJ_nid2obj(i);
454 const char *sn = OBJ_nid2sn(i);
455 const char *ln = OBJ_nid2ln(i);
459 * If one of the retrieved objects somehow generated an error,
460 * we ignore it. The check for NID_undef below will detect the
461 * error and simply skip to the next NID.
465 if (OBJ_obj2nid(obj) == NID_undef)
468 if ((n = OBJ_obj2txt(NULL, 0, obj, 1)) == 0) {
469 BIO_printf(bio_out, "# None-OID object: %s, %s\n", sn, ln);
476 oid_buf = OPENSSL_realloc(oid_buf, n + 1);
477 if (oid_buf == NULL) {
478 BIO_printf(bio_err, "ERROR: Memory allocation\n");
483 if (OBJ_obj2txt(oid_buf, oid_size, obj, 1) < 0)
485 if (ln == NULL || strcmp(sn, ln) == 0)
486 BIO_printf(bio_out, "%s = %s\n", sn, oid_buf);
488 BIO_printf(bio_out, "%s = %s, %s\n", sn, ln, oid_buf);
491 OPENSSL_free(oid_buf);
494 static void list_options_for_command(const char *command)
499 for (fp = functions; fp->name != NULL; fp++)
500 if (strcmp(fp->name, command) == 0)
502 if (fp->name == NULL) {
503 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
508 if ((o = fp->help) == NULL)
511 for ( ; o->name != NULL; o++) {
512 if (o->name == OPT_HELP_STR
513 || o->name == OPT_MORE_STR
514 || o->name[0] == '\0')
516 BIO_printf(bio_out, "%s %c\n", o->name, o->valtype);
521 /* Unified enum for help and list commands. */
522 typedef enum HELPLIST_CHOICE {
523 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE,
524 OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS,
525 OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
526 OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_DISABLED, OPT_MISSING_HELP,
530 const OPTIONS list_options[] = {
531 {"help", OPT_HELP, '-', "Display this summary"},
532 {"1", OPT_ONE, '-', "List in one column"},
533 {"commands", OPT_COMMANDS, '-', "List of standard commands"},
534 {"digest-commands", OPT_DIGEST_COMMANDS, '-',
535 "List of message digest commands"},
536 {"digest-algorithms", OPT_DIGEST_ALGORITHMS, '-',
537 "List of message digest algorithms"},
538 {"mac-algorithms", OPT_MAC_ALGORITHMS, '-',
539 "List of message authentication code algorithms"},
540 {"cipher-commands", OPT_CIPHER_COMMANDS, '-', "List of cipher commands"},
541 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS, '-',
542 "List of cipher algorithms"},
543 {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
544 "List of public key algorithms"},
545 {"public-key-methods", OPT_PK_METHOD, '-',
546 "List of public key methods"},
547 {"disabled", OPT_DISABLED, '-',
548 "List of disabled features"},
549 {"missing-help", OPT_MISSING_HELP, '-',
550 "List missing detailed help strings"},
551 {"options", OPT_OPTIONS, 's',
552 "List options for specified command"},
553 {"objects", OPT_OBJECTS, '-',
554 "List built in objects (OID<->name mappings)"},
558 int list_main(int argc, char **argv)
562 int one = 0, done = 0;
564 prog = opt_init(argc, argv, list_options);
565 while ((o = opt_next()) != OPT_EOF) {
567 case OPT_EOF: /* Never hit, but suppresses warning */
570 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
573 opt_help(list_options);
579 list_type(FT_general, one);
581 case OPT_DIGEST_COMMANDS:
582 list_type(FT_md, one);
584 case OPT_DIGEST_ALGORITHMS:
585 EVP_MD_do_all_sorted(list_md_fn, bio_out);
587 case OPT_MAC_ALGORITHMS:
588 EVP_MAC_do_all_sorted(list_mac_fn, bio_out);
590 case OPT_CIPHER_COMMANDS:
591 list_type(FT_cipher, one);
593 case OPT_CIPHER_ALGORITHMS:
594 EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
596 case OPT_PK_ALGORITHMS:
605 case OPT_MISSING_HELP:
612 list_options_for_command(opt_arg());
617 if (opt_num_rest() != 0) {
618 BIO_printf(bio_err, "Extra arguments given.\n");
628 typedef enum HELP_CHOICE {
629 OPT_hERR = -1, OPT_hEOF = 0, OPT_hHELP
632 const OPTIONS help_options[] = {
633 {OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
634 {OPT_HELP_STR, 1, '-', " help [command]\n"},
635 {"help", OPT_hHELP, '-', "Display this summary"},
640 int help_main(int argc, char **argv)
649 prog = opt_init(argc, argv, help_options);
650 while ((o = opt_next()) != OPT_hEOF) {
654 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
657 opt_help(help_options);
662 if (opt_num_rest() == 1) {
665 new_argv[0] = opt_rest()[0];
666 new_argv[1] = "--help";
668 return do_cmd(prog_init(), 2, new_argv);
670 if (opt_num_rest() != 0) {
671 BIO_printf(bio_err, "Usage: %s\n", prog);
675 calculate_columns(&dc);
676 BIO_printf(bio_err, "Standard commands");
679 for (fp = functions; fp->name != NULL; fp++) {
681 if (i++ % dc.columns == 0) {
682 BIO_printf(bio_err, "\n");
685 if (fp->type != tp) {
688 BIO_printf(bio_err, "\n");
692 "\nMessage Digest commands (see the `dgst' command for more details)\n");
693 } else if (tp == FT_cipher) {
696 "\nCipher commands (see the `enc' command for more details)\n");
699 BIO_printf(bio_err, "%-*s", dc.width, fp->name);
701 BIO_printf(bio_err, "\n\n");
705 static void list_type(FUNC_TYPE ft, int one)
709 DISPLAY_COLUMNS dc = {0};
712 calculate_columns(&dc);
714 for (fp = functions; fp->name != NULL; fp++) {
718 BIO_printf(bio_out, "%s\n", fp->name);
720 if (i % dc.columns == 0 && i > 0)
721 BIO_printf(bio_out, "\n");
722 BIO_printf(bio_out, "%-*s", dc.width, fp->name);
727 BIO_printf(bio_out, "\n\n");
730 static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
734 if (argc <= 0 || argv[0] == NULL)
737 fp = lh_FUNCTION_retrieve(prog, &f);
739 if (EVP_get_digestbyname(argv[0])) {
743 } else if (EVP_get_cipherbyname(argv[0])) {
750 return fp->func(argc, argv);
752 if ((strncmp(argv[0], "no-", 3)) == 0) {
754 * User is asking if foo is unsupported, by trying to "run" the
755 * no-foo command. Strange.
757 f.name = argv[0] + 3;
758 if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
759 BIO_printf(bio_out, "%s\n", argv[0]);
762 BIO_printf(bio_out, "%s\n", argv[0] + 3);
765 if (strcmp(argv[0], "quit") == 0 || strcmp(argv[0], "q") == 0 ||
766 strcmp(argv[0], "exit") == 0 || strcmp(argv[0], "bye") == 0)
767 /* Special value to mean "exit the program. */
768 return EXIT_THE_PROGRAM;
770 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
775 static void list_pkey(void)
779 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
780 const EVP_PKEY_ASN1_METHOD *ameth;
781 int pkey_id, pkey_base_id, pkey_flags;
782 const char *pinfo, *pem_str;
783 ameth = EVP_PKEY_asn1_get0(i);
784 EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
785 &pinfo, &pem_str, ameth);
786 if (pkey_flags & ASN1_PKEY_ALIAS) {
787 BIO_printf(bio_out, "Name: %s\n", OBJ_nid2ln(pkey_id));
788 BIO_printf(bio_out, "\tAlias for: %s\n",
789 OBJ_nid2ln(pkey_base_id));
791 BIO_printf(bio_out, "Name: %s\n", pinfo);
792 BIO_printf(bio_out, "\tType: %s Algorithm\n",
793 pkey_flags & ASN1_PKEY_DYNAMIC ?
794 "External" : "Builtin");
795 BIO_printf(bio_out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
798 BIO_printf(bio_out, "\tPEM string: %s\n", pem_str);
804 static void list_pkey_meth(void)
807 size_t meth_count = EVP_PKEY_meth_get_count();
809 for (i = 0; i < meth_count; i++) {
810 const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
811 int pkey_id, pkey_flags;
813 EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
814 BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
815 BIO_printf(bio_out, "\tType: %s Algorithm\n",
816 pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin");
820 static int function_cmp(const FUNCTION * a, const FUNCTION * b)
822 return strncmp(a->name, b->name, 8);
825 static unsigned long function_hash(const FUNCTION * a)
827 return OPENSSL_LH_strhash(a->name);
830 static int SortFnByName(const void *_f1, const void *_f2)
832 const FUNCTION *f1 = _f1;
833 const FUNCTION *f2 = _f2;
835 if (f1->type != f2->type)
836 return f1->type - f2->type;
837 return strcmp(f1->name, f2->name);
840 static void list_disabled(void)
842 BIO_puts(bio_out, "Disabled algorithms:\n");
843 #ifdef OPENSSL_NO_ARIA
844 BIO_puts(bio_out, "ARIA\n");
847 BIO_puts(bio_out, "BF\n");
849 #ifdef OPENSSL_NO_BLAKE2
850 BIO_puts(bio_out, "BLAKE2\n");
852 #ifdef OPENSSL_NO_CAMELLIA
853 BIO_puts(bio_out, "CAMELLIA\n");
855 #ifdef OPENSSL_NO_CAST
856 BIO_puts(bio_out, "CAST\n");
858 #ifdef OPENSSL_NO_CMAC
859 BIO_puts(bio_out, "CMAC\n");
861 #ifdef OPENSSL_NO_CMS
862 BIO_puts(bio_out, "CMS\n");
864 #ifdef OPENSSL_NO_COMP
865 BIO_puts(bio_out, "COMP\n");
867 #ifdef OPENSSL_NO_DES
868 BIO_puts(bio_out, "DES\n");
870 #ifdef OPENSSL_NO_DGRAM
871 BIO_puts(bio_out, "DGRAM\n");
874 BIO_puts(bio_out, "DH\n");
876 #ifdef OPENSSL_NO_DSA
877 BIO_puts(bio_out, "DSA\n");
879 #if defined(OPENSSL_NO_DTLS)
880 BIO_puts(bio_out, "DTLS\n");
882 #if defined(OPENSSL_NO_DTLS1)
883 BIO_puts(bio_out, "DTLS1\n");
885 #if defined(OPENSSL_NO_DTLS1_2)
886 BIO_puts(bio_out, "DTLS1_2\n");
889 BIO_puts(bio_out, "EC\n");
891 #ifdef OPENSSL_NO_EC2M
892 BIO_puts(bio_out, "EC2M\n");
894 #ifdef OPENSSL_NO_ENGINE
895 BIO_puts(bio_out, "ENGINE\n");
897 #ifdef OPENSSL_NO_GOST
898 BIO_puts(bio_out, "GOST\n");
900 #ifdef OPENSSL_NO_HEARTBEATS
901 BIO_puts(bio_out, "HEARTBEATS\n");
903 #ifdef OPENSSL_NO_IDEA
904 BIO_puts(bio_out, "IDEA\n");
906 #ifdef OPENSSL_NO_MD2
907 BIO_puts(bio_out, "MD2\n");
909 #ifdef OPENSSL_NO_MD4
910 BIO_puts(bio_out, "MD4\n");
912 #ifdef OPENSSL_NO_MD5
913 BIO_puts(bio_out, "MD5\n");
915 #ifdef OPENSSL_NO_MDC2
916 BIO_puts(bio_out, "MDC2\n");
918 #ifdef OPENSSL_NO_OCB
919 BIO_puts(bio_out, "OCB\n");
921 #ifdef OPENSSL_NO_OCSP
922 BIO_puts(bio_out, "OCSP\n");
924 #ifdef OPENSSL_NO_PSK
925 BIO_puts(bio_out, "PSK\n");
927 #ifdef OPENSSL_NO_RC2
928 BIO_puts(bio_out, "RC2\n");
930 #ifdef OPENSSL_NO_RC4
931 BIO_puts(bio_out, "RC4\n");
933 #ifdef OPENSSL_NO_RC5
934 BIO_puts(bio_out, "RC5\n");
936 #ifdef OPENSSL_NO_RMD160
937 BIO_puts(bio_out, "RMD160\n");
939 #ifdef OPENSSL_NO_RSA
940 BIO_puts(bio_out, "RSA\n");
942 #ifdef OPENSSL_NO_SCRYPT
943 BIO_puts(bio_out, "SCRYPT\n");
945 #ifdef OPENSSL_NO_SCTP
946 BIO_puts(bio_out, "SCTP\n");
948 #ifdef OPENSSL_NO_SEED
949 BIO_puts(bio_out, "SEED\n");
951 #ifdef OPENSSL_NO_SM2
952 BIO_puts(bio_out, "SM2\n");
954 #ifdef OPENSSL_NO_SM3
955 BIO_puts(bio_out, "SM3\n");
957 #ifdef OPENSSL_NO_SM4
958 BIO_puts(bio_out, "SM4\n");
960 #ifdef OPENSSL_NO_SOCK
961 BIO_puts(bio_out, "SOCK\n");
963 #ifdef OPENSSL_NO_SRP
964 BIO_puts(bio_out, "SRP\n");
966 #ifdef OPENSSL_NO_SRTP
967 BIO_puts(bio_out, "SRTP\n");
969 #ifdef OPENSSL_NO_SSL3
970 BIO_puts(bio_out, "SSL3\n");
972 #ifdef OPENSSL_NO_TLS1
973 BIO_puts(bio_out, "TLS1\n");
975 #ifdef OPENSSL_NO_TLS1_1
976 BIO_puts(bio_out, "TLS1_1\n");
978 #ifdef OPENSSL_NO_TLS1_2
979 BIO_puts(bio_out, "TLS1_2\n");
981 #ifdef OPENSSL_NO_WHIRLPOOL
982 BIO_puts(bio_out, "WHIRLPOOL\n");
985 BIO_puts(bio_out, "ZLIB\n");
989 static LHASH_OF(FUNCTION) *prog_init(void)
991 static LHASH_OF(FUNCTION) *ret = NULL;
992 static int prog_inited = 0;
1001 /* Sort alphabetically within category. For nicer help displays. */
1002 for (i = 0, f = functions; f->name != NULL; ++f, ++i)
1004 qsort(functions, i, sizeof(*functions), SortFnByName);
1006 if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
1009 for (f = functions; f->name != NULL; f++)
1010 (void)lh_FUNCTION_insert(ret, f);