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(const char *str)
192 trace_data_stack = sk_tracedata_new_null();
193 val = OPENSSL_strdup(str);
199 for (valp = val; (item = strtok(valp, ",")) != NULL; valp = NULL) {
200 int category = OSSL_trace_get_category_num(item);
203 BIO *channel = BIO_push(BIO_new(apps_bf_prefix()),
204 dup_bio_err(FORMAT_TEXT));
205 tracedata *trace_data = OPENSSL_zalloc(sizeof(*trace_data));
207 if (trace_data == NULL
208 || (trace_data->bio = channel) == NULL
209 || OSSL_trace_set_callback(category, internal_trace_cb,
211 || sk_tracedata_push(trace_data_stack, trace_data) == 0) {
212 OSSL_trace_set_callback(category, NULL, NULL);
213 BIO_free_all(channel);
215 "warning: unable to setup trace callback for category '%s'.\n",
220 "warning: unknown trace category: '%s'.\n",
227 atexit(cleanup_trace);
229 #endif /* OPENSSL_NO_TRACE */
231 int main(int argc, char *argv[])
234 LHASH_OF(FUNCTION) *prog = NULL;
239 int first, n, i, ret = 0;
244 /* Set up some of the environment. */
245 default_config_file = make_config_name();
246 bio_in = dup_bio_in(FORMAT_TEXT);
247 bio_out = dup_bio_out(FORMAT_TEXT);
248 bio_err = dup_bio_err(FORMAT_TEXT);
250 #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
251 argv = copy_argv(&argc, argv);
252 #elif defined(_WIN32)
254 * Replace argv[] with UTF-8 encoded strings.
256 win32_utf8argv(&argc, &argv);
260 * We use the prefix method to get the trace output we want. Since some
261 * trace outputs happen with OPENSSL_cleanup(), which is run automatically
262 * after exit(), we need to destroy the prefix method as late as possible.
264 atexit(destroy_prefix_method);
266 #ifndef OPENSSL_NO_TRACE
267 setup_trace(getenv("OPENSSL_TRACE"));
270 p = getenv("OPENSSL_DEBUG_MEMORY");
271 if (p != NULL && strcmp(p, "on") == 0)
272 CRYPTO_set_mem_debug(1);
273 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
275 if (getenv("OPENSSL_FIPS")) {
276 BIO_printf(bio_err, "FIPS mode not supported.\n");
280 if (!apps_startup()) {
282 "FATAL: Startup failure (dev note: apps_startup() failed)\n");
283 ERR_print_errors(bio_err);
289 pname = opt_progname(argv[0]);
291 /* first check the program name */
293 fp = lh_FUNCTION_retrieve(prog, &f);
296 ret = fp->func(argc, argv);
300 /* If there is stuff on the command line, run with that. */
304 ret = do_cmd(prog, argc, argv);
310 /* ok, lets enter interactive mode */
313 /* Read a line, continue reading if line ends with \ */
314 for (p = buf, n = sizeof(buf), i = 0, first = 1; n > 0; first = 0) {
315 prompt = first ? "OpenSSL> " : "> ";
318 fputs(prompt, stdout);
320 if (!fgets(p, n, stdin))
327 if (p[i - 2] != '\\')
334 extern char *readline(const char *);
335 extern void add_history(const char *cp);
338 text = readline(prompt);
344 if (text[i - 1] != '\\') {
345 p += strlen(strcpy(p, text));
352 p += strlen(strcpy(p, text));
359 if (!chopup_args(&arg, buf)) {
360 BIO_printf(bio_err, "Can't parse (no memory?)\n");
364 ret = do_cmd(prog, arg.argc, arg.argv);
365 if (ret == EXIT_THE_PROGRAM) {
370 BIO_printf(bio_err, "error in %s\n", arg.argv[0]);
371 (void)BIO_flush(bio_out);
372 (void)BIO_flush(bio_err);
376 OPENSSL_free(default_config_file);
377 lh_FUNCTION_free(prog);
378 OPENSSL_free(arg.argv);
382 BIO_free_all(bio_out);
384 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
385 if (CRYPTO_mem_leaks(bio_err) <= 0)
392 static void list_cipher_fn(const EVP_CIPHER *c,
393 const char *from, const char *to, void *arg)
396 BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
399 from = "<undefined>";
402 BIO_printf(arg, "%s => %s\n", from, to);
406 static void list_md_fn(const EVP_MD *m,
407 const char *from, const char *to, void *arg)
410 BIO_printf(arg, "%s\n", EVP_MD_name(m));
413 from = "<undefined>";
416 BIO_printf((BIO *)arg, "%s => %s\n", from, to);
420 static void list_mac_fn(const EVP_MAC *m,
421 const char *from, const char *to, void *arg)
424 BIO_printf(arg, "%s\n", EVP_MAC_name(m));
427 from = "<undefined>";
430 BIO_printf(arg, "%s => %s\n", from, to);
434 static void list_missing_help(void)
439 for (fp = functions; fp->name != NULL; fp++) {
440 if ((o = fp->help) != NULL) {
441 /* If there is help, list what flags are not documented. */
442 for ( ; o->name != NULL; o++) {
443 if (o->helpstr == NULL)
444 BIO_printf(bio_out, "%s %s\n", fp->name, o->name);
446 } else if (fp->func != dgst_main) {
447 /* If not aliased to the dgst command, */
448 BIO_printf(bio_out, "%s *\n", fp->name);
453 static void list_objects(void)
455 int max_nid = OBJ_new_nid(0);
457 char *oid_buf = NULL;
460 /* Skip 0, since that's NID_undef */
461 for (i = 1; i < max_nid; i++) {
462 const ASN1_OBJECT *obj = OBJ_nid2obj(i);
463 const char *sn = OBJ_nid2sn(i);
464 const char *ln = OBJ_nid2ln(i);
468 * If one of the retrieved objects somehow generated an error,
469 * we ignore it. The check for NID_undef below will detect the
470 * error and simply skip to the next NID.
474 if (OBJ_obj2nid(obj) == NID_undef)
477 if ((n = OBJ_obj2txt(NULL, 0, obj, 1)) == 0) {
478 BIO_printf(bio_out, "# None-OID object: %s, %s\n", sn, ln);
485 oid_buf = OPENSSL_realloc(oid_buf, n + 1);
486 if (oid_buf == NULL) {
487 BIO_printf(bio_err, "ERROR: Memory allocation\n");
492 if (OBJ_obj2txt(oid_buf, oid_size, obj, 1) < 0)
494 if (ln == NULL || strcmp(sn, ln) == 0)
495 BIO_printf(bio_out, "%s = %s\n", sn, oid_buf);
497 BIO_printf(bio_out, "%s = %s, %s\n", sn, ln, oid_buf);
500 OPENSSL_free(oid_buf);
503 static void list_options_for_command(const char *command)
508 for (fp = functions; fp->name != NULL; fp++)
509 if (strcmp(fp->name, command) == 0)
511 if (fp->name == NULL) {
512 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
517 if ((o = fp->help) == NULL)
520 for ( ; o->name != NULL; o++) {
521 if (o->name == OPT_HELP_STR
522 || o->name == OPT_MORE_STR
523 || o->name[0] == '\0')
525 BIO_printf(bio_out, "%s %c\n", o->name, o->valtype);
530 /* Unified enum for help and list commands. */
531 typedef enum HELPLIST_CHOICE {
532 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE,
533 OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS,
534 OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
535 OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_ENGINES, OPT_DISABLED,
536 OPT_MISSING_HELP, OPT_OBJECTS
539 const OPTIONS list_options[] = {
540 {"help", OPT_HELP, '-', "Display this summary"},
541 {"1", OPT_ONE, '-', "List in one column"},
542 {"commands", OPT_COMMANDS, '-', "List of standard commands"},
543 {"digest-commands", OPT_DIGEST_COMMANDS, '-',
544 "List of message digest commands"},
545 {"digest-algorithms", OPT_DIGEST_ALGORITHMS, '-',
546 "List of message digest algorithms"},
547 {"mac-algorithms", OPT_MAC_ALGORITHMS, '-',
548 "List of message authentication code algorithms"},
549 {"cipher-commands", OPT_CIPHER_COMMANDS, '-', "List of cipher commands"},
550 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS, '-',
551 "List of cipher algorithms"},
552 {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
553 "List of public key algorithms"},
554 {"public-key-methods", OPT_PK_METHOD, '-',
555 "List of public key methods"},
556 {"engines", OPT_ENGINES, '-',
557 "List of loaded engines"},
558 {"disabled", OPT_DISABLED, '-',
559 "List of disabled features"},
560 {"missing-help", OPT_MISSING_HELP, '-',
561 "List missing detailed help strings"},
562 {"options", OPT_OPTIONS, 's',
563 "List options for specified command"},
564 {"objects", OPT_OBJECTS, '-',
565 "List built in objects (OID<->name mappings)"},
569 int list_main(int argc, char **argv)
573 int one = 0, done = 0;
575 prog = opt_init(argc, argv, list_options);
576 while ((o = opt_next()) != OPT_EOF) {
578 case OPT_EOF: /* Never hit, but suppresses warning */
581 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
584 opt_help(list_options);
590 list_type(FT_general, one);
592 case OPT_DIGEST_COMMANDS:
593 list_type(FT_md, one);
595 case OPT_DIGEST_ALGORITHMS:
596 EVP_MD_do_all_sorted(list_md_fn, bio_out);
598 case OPT_MAC_ALGORITHMS:
599 EVP_MAC_do_all_sorted(list_mac_fn, bio_out);
601 case OPT_CIPHER_COMMANDS:
602 list_type(FT_cipher, one);
604 case OPT_CIPHER_ALGORITHMS:
605 EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
607 case OPT_PK_ALGORITHMS:
619 case OPT_MISSING_HELP:
626 list_options_for_command(opt_arg());
631 if (opt_num_rest() != 0) {
632 BIO_printf(bio_err, "Extra arguments given.\n");
642 typedef enum HELP_CHOICE {
643 OPT_hERR = -1, OPT_hEOF = 0, OPT_hHELP
646 const OPTIONS help_options[] = {
647 {OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
648 {OPT_HELP_STR, 1, '-', " help [command]\n"},
649 {"help", OPT_hHELP, '-', "Display this summary"},
654 int help_main(int argc, char **argv)
663 prog = opt_init(argc, argv, help_options);
664 while ((o = opt_next()) != OPT_hEOF) {
668 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
671 opt_help(help_options);
676 if (opt_num_rest() == 1) {
679 new_argv[0] = opt_rest()[0];
680 new_argv[1] = "--help";
682 return do_cmd(prog_init(), 2, new_argv);
684 if (opt_num_rest() != 0) {
685 BIO_printf(bio_err, "Usage: %s\n", prog);
689 calculate_columns(&dc);
690 BIO_printf(bio_err, "Standard commands");
693 for (fp = functions; fp->name != NULL; fp++) {
695 if (i++ % dc.columns == 0) {
696 BIO_printf(bio_err, "\n");
699 if (fp->type != tp) {
702 BIO_printf(bio_err, "\n");
706 "\nMessage Digest commands (see the `dgst' command for more details)\n");
707 } else if (tp == FT_cipher) {
710 "\nCipher commands (see the `enc' command for more details)\n");
713 BIO_printf(bio_err, "%-*s", dc.width, fp->name);
715 BIO_printf(bio_err, "\n\n");
719 static void list_type(FUNC_TYPE ft, int one)
725 memset(&dc, 0, sizeof(dc));
727 calculate_columns(&dc);
729 for (fp = functions; fp->name != NULL; fp++) {
733 BIO_printf(bio_out, "%s\n", fp->name);
735 if (i % dc.columns == 0 && i > 0)
736 BIO_printf(bio_out, "\n");
737 BIO_printf(bio_out, "%-*s", dc.width, fp->name);
742 BIO_printf(bio_out, "\n\n");
745 static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
749 if (argc <= 0 || argv[0] == NULL)
752 fp = lh_FUNCTION_retrieve(prog, &f);
754 if (EVP_get_digestbyname(argv[0])) {
758 } else if (EVP_get_cipherbyname(argv[0])) {
765 return fp->func(argc, argv);
767 if ((strncmp(argv[0], "no-", 3)) == 0) {
769 * User is asking if foo is unsupported, by trying to "run" the
770 * no-foo command. Strange.
772 f.name = argv[0] + 3;
773 if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
774 BIO_printf(bio_out, "%s\n", argv[0]);
777 BIO_printf(bio_out, "%s\n", argv[0] + 3);
780 if (strcmp(argv[0], "quit") == 0 || strcmp(argv[0], "q") == 0 ||
781 strcmp(argv[0], "exit") == 0 || strcmp(argv[0], "bye") == 0)
782 /* Special value to mean "exit the program. */
783 return EXIT_THE_PROGRAM;
785 BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
790 static void list_pkey(void)
794 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
795 const EVP_PKEY_ASN1_METHOD *ameth;
796 int pkey_id, pkey_base_id, pkey_flags;
797 const char *pinfo, *pem_str;
798 ameth = EVP_PKEY_asn1_get0(i);
799 EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
800 &pinfo, &pem_str, ameth);
801 if (pkey_flags & ASN1_PKEY_ALIAS) {
802 BIO_printf(bio_out, "Name: %s\n", OBJ_nid2ln(pkey_id));
803 BIO_printf(bio_out, "\tAlias for: %s\n",
804 OBJ_nid2ln(pkey_base_id));
806 BIO_printf(bio_out, "Name: %s\n", pinfo);
807 BIO_printf(bio_out, "\tType: %s Algorithm\n",
808 pkey_flags & ASN1_PKEY_DYNAMIC ?
809 "External" : "Builtin");
810 BIO_printf(bio_out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
813 BIO_printf(bio_out, "\tPEM string: %s\n", pem_str);
819 static void list_pkey_meth(void)
822 size_t meth_count = EVP_PKEY_meth_get_count();
824 for (i = 0; i < meth_count; i++) {
825 const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
826 int pkey_id, pkey_flags;
828 EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
829 BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
830 BIO_printf(bio_out, "\tType: %s Algorithm\n",
831 pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin");
835 static int function_cmp(const FUNCTION * a, const FUNCTION * b)
837 return strncmp(a->name, b->name, 8);
840 static unsigned long function_hash(const FUNCTION * a)
842 return OPENSSL_LH_strhash(a->name);
845 static int SortFnByName(const void *_f1, const void *_f2)
847 const FUNCTION *f1 = _f1;
848 const FUNCTION *f2 = _f2;
850 if (f1->type != f2->type)
851 return f1->type - f2->type;
852 return strcmp(f1->name, f2->name);
855 static void list_engines(void)
857 #ifndef OPENSSL_NO_ENGINE
860 BIO_puts(bio_out, "Engines:\n");
861 e = ENGINE_get_first();
863 BIO_printf(bio_out, "%s\n", ENGINE_get_id(e));
864 e = ENGINE_get_next(e);
867 BIO_puts(bio_out, "Engine support is disabled.\n");
871 static void list_disabled(void)
873 BIO_puts(bio_out, "Disabled algorithms:\n");
874 #ifdef OPENSSL_NO_ARIA
875 BIO_puts(bio_out, "ARIA\n");
878 BIO_puts(bio_out, "BF\n");
880 #ifdef OPENSSL_NO_BLAKE2
881 BIO_puts(bio_out, "BLAKE2\n");
883 #ifdef OPENSSL_NO_CAMELLIA
884 BIO_puts(bio_out, "CAMELLIA\n");
886 #ifdef OPENSSL_NO_CAST
887 BIO_puts(bio_out, "CAST\n");
889 #ifdef OPENSSL_NO_CMAC
890 BIO_puts(bio_out, "CMAC\n");
892 #ifdef OPENSSL_NO_CMS
893 BIO_puts(bio_out, "CMS\n");
895 #ifdef OPENSSL_NO_COMP
896 BIO_puts(bio_out, "COMP\n");
898 #ifdef OPENSSL_NO_DES
899 BIO_puts(bio_out, "DES\n");
901 #ifdef OPENSSL_NO_DGRAM
902 BIO_puts(bio_out, "DGRAM\n");
905 BIO_puts(bio_out, "DH\n");
907 #ifdef OPENSSL_NO_DSA
908 BIO_puts(bio_out, "DSA\n");
910 #if defined(OPENSSL_NO_DTLS)
911 BIO_puts(bio_out, "DTLS\n");
913 #if defined(OPENSSL_NO_DTLS1)
914 BIO_puts(bio_out, "DTLS1\n");
916 #if defined(OPENSSL_NO_DTLS1_2)
917 BIO_puts(bio_out, "DTLS1_2\n");
920 BIO_puts(bio_out, "EC\n");
922 #ifdef OPENSSL_NO_EC2M
923 BIO_puts(bio_out, "EC2M\n");
925 #ifdef OPENSSL_NO_ENGINE
926 BIO_puts(bio_out, "ENGINE\n");
928 #ifdef OPENSSL_NO_GOST
929 BIO_puts(bio_out, "GOST\n");
931 #ifdef OPENSSL_NO_IDEA
932 BIO_puts(bio_out, "IDEA\n");
934 #ifdef OPENSSL_NO_MD2
935 BIO_puts(bio_out, "MD2\n");
937 #ifdef OPENSSL_NO_MD4
938 BIO_puts(bio_out, "MD4\n");
940 #ifdef OPENSSL_NO_MD5
941 BIO_puts(bio_out, "MD5\n");
943 #ifdef OPENSSL_NO_MDC2
944 BIO_puts(bio_out, "MDC2\n");
946 #ifdef OPENSSL_NO_OCB
947 BIO_puts(bio_out, "OCB\n");
949 #ifdef OPENSSL_NO_OCSP
950 BIO_puts(bio_out, "OCSP\n");
952 #ifdef OPENSSL_NO_PSK
953 BIO_puts(bio_out, "PSK\n");
955 #ifdef OPENSSL_NO_RC2
956 BIO_puts(bio_out, "RC2\n");
958 #ifdef OPENSSL_NO_RC4
959 BIO_puts(bio_out, "RC4\n");
961 #ifdef OPENSSL_NO_RC5
962 BIO_puts(bio_out, "RC5\n");
964 #ifdef OPENSSL_NO_RMD160
965 BIO_puts(bio_out, "RMD160\n");
967 #ifdef OPENSSL_NO_RSA
968 BIO_puts(bio_out, "RSA\n");
970 #ifdef OPENSSL_NO_SCRYPT
971 BIO_puts(bio_out, "SCRYPT\n");
973 #ifdef OPENSSL_NO_SCTP
974 BIO_puts(bio_out, "SCTP\n");
976 #ifdef OPENSSL_NO_SEED
977 BIO_puts(bio_out, "SEED\n");
979 #ifdef OPENSSL_NO_SM2
980 BIO_puts(bio_out, "SM2\n");
982 #ifdef OPENSSL_NO_SM3
983 BIO_puts(bio_out, "SM3\n");
985 #ifdef OPENSSL_NO_SM4
986 BIO_puts(bio_out, "SM4\n");
988 #ifdef OPENSSL_NO_SOCK
989 BIO_puts(bio_out, "SOCK\n");
991 #ifdef OPENSSL_NO_SRP
992 BIO_puts(bio_out, "SRP\n");
994 #ifdef OPENSSL_NO_SRTP
995 BIO_puts(bio_out, "SRTP\n");
997 #ifdef OPENSSL_NO_SSL3
998 BIO_puts(bio_out, "SSL3\n");
1000 #ifdef OPENSSL_NO_TLS1
1001 BIO_puts(bio_out, "TLS1\n");
1003 #ifdef OPENSSL_NO_TLS1_1
1004 BIO_puts(bio_out, "TLS1_1\n");
1006 #ifdef OPENSSL_NO_TLS1_2
1007 BIO_puts(bio_out, "TLS1_2\n");
1009 #ifdef OPENSSL_NO_WHIRLPOOL
1010 BIO_puts(bio_out, "WHIRLPOOL\n");
1013 BIO_puts(bio_out, "ZLIB\n");
1017 static LHASH_OF(FUNCTION) *prog_init(void)
1019 static LHASH_OF(FUNCTION) *ret = NULL;
1020 static int prog_inited = 0;
1029 /* Sort alphabetically within category. For nicer help displays. */
1030 for (i = 0, f = functions; f->name != NULL; ++f, ++i)
1032 qsort(functions, i, sizeof(*functions), SortFnByName);
1034 if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
1037 for (f = functions; f->name != NULL; f++)
1038 (void)lh_FUNCTION_insert(ret, f);