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
;
132 CRYPTO_THREAD_ID tid
;
138 case OSSL_TRACE_CTRL_BEGIN
:
139 if (!ossl_assert(!trace_data
->ingroup
))
141 trace_data
->ingroup
= 1;
144 tid
.tid
= CRYPTO_THREAD_get_current_id();
146 BIO_snprintf(buffer
, sizeof(buffer
), "TRACE[%lx]:%s: ", tid
.ltid
,
147 OSSL_trace_get_category_name(category
));
148 BIO_ctrl(trace_data
->bio
, PREFIX_CTRL_SET_PREFIX
,
149 strlen(buffer
), buffer
);
151 case OSSL_TRACE_CTRL_WRITE
:
152 if (!ossl_assert(trace_data
->ingroup
))
155 ret
= BIO_write(trace_data
->bio
, buf
, cnt
);
157 case OSSL_TRACE_CTRL_END
:
158 if (!ossl_assert(trace_data
->ingroup
))
160 trace_data
->ingroup
= 0;
162 BIO_ctrl(trace_data
->bio
, PREFIX_CTRL_SET_PREFIX
, 0, NULL
);
167 return ret
< 0 ? 0 : ret
;
170 DEFINE_STACK_OF(tracedata
)
171 static STACK_OF(tracedata
) *trace_data_stack
;
173 static void tracedata_free(tracedata
*data
)
175 BIO_free_all(data
->bio
);
179 static STACK_OF(tracedata
) *trace_data_stack
;
181 static void cleanup_trace(void)
183 sk_tracedata_pop_free(trace_data_stack
, tracedata_free
);
186 static void setup_trace(const char *str
)
190 trace_data_stack
= sk_tracedata_new_null();
191 val
= OPENSSL_strdup(str
);
197 for (valp
= val
; (item
= strtok(valp
, ",")) != NULL
; valp
= NULL
) {
198 int category
= OSSL_trace_get_category_num(item
);
201 BIO
*channel
= BIO_push(BIO_new(apps_bf_prefix()),
202 dup_bio_err(FORMAT_TEXT
));
203 tracedata
*trace_data
= OPENSSL_zalloc(sizeof(*trace_data
));
205 if (trace_data
== NULL
206 || (trace_data
->bio
= channel
) == NULL
207 || OSSL_trace_set_callback(category
, internal_trace_cb
,
209 || sk_tracedata_push(trace_data_stack
, trace_data
) == 0) {
210 OSSL_trace_set_callback(category
, NULL
, NULL
);
211 BIO_free_all(channel
);
213 "warning: unable to setup trace callback for category '%s'.\n",
218 "warning: unknown trace category: '%s'.\n",
225 atexit(cleanup_trace
);
228 int main(int argc
, char *argv
[])
231 LHASH_OF(FUNCTION
) *prog
= NULL
;
236 int first
, n
, i
, ret
= 0;
241 /* Set up some of the environment. */
242 default_config_file
= make_config_name();
243 bio_in
= dup_bio_in(FORMAT_TEXT
);
244 bio_out
= dup_bio_out(FORMAT_TEXT
);
245 bio_err
= dup_bio_err(FORMAT_TEXT
);
247 #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
248 argv
= copy_argv(&argc
, argv
);
249 #elif defined(_WIN32)
251 * Replace argv[] with UTF-8 encoded strings.
253 win32_utf8argv(&argc
, &argv
);
257 * We use the prefix method to get the trace output we want. Since some
258 * trace outputs happen with OPENSSL_cleanup(), which is run automatically
259 * after exit(), we need to destroy the prefix method as late as possible.
261 atexit(destroy_prefix_method
);
263 setup_trace(getenv("OPENSSL_TRACE"));
265 p
= getenv("OPENSSL_DEBUG_MEMORY");
266 if (p
!= NULL
&& strcmp(p
, "on") == 0)
267 CRYPTO_set_mem_debug(1);
268 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON
);
270 if (getenv("OPENSSL_FIPS")) {
271 BIO_printf(bio_err
, "FIPS mode not supported.\n");
275 if (!apps_startup()) {
277 "FATAL: Startup failure (dev note: apps_startup() failed)\n");
278 ERR_print_errors(bio_err
);
284 pname
= opt_progname(argv
[0]);
286 /* first check the program name */
288 fp
= lh_FUNCTION_retrieve(prog
, &f
);
291 ret
= fp
->func(argc
, argv
);
295 /* If there is stuff on the command line, run with that. */
299 ret
= do_cmd(prog
, argc
, argv
);
305 /* ok, lets enter interactive mode */
308 /* Read a line, continue reading if line ends with \ */
309 for (p
= buf
, n
= sizeof(buf
), i
= 0, first
= 1; n
> 0; first
= 0) {
310 prompt
= first
? "OpenSSL> " : "> ";
313 fputs(prompt
, stdout
);
315 if (!fgets(p
, n
, stdin
))
322 if (p
[i
- 2] != '\\')
329 extern char *readline(const char *);
330 extern void add_history(const char *cp
);
333 text
= readline(prompt
);
339 if (text
[i
- 1] != '\\') {
340 p
+= strlen(strcpy(p
, text
));
347 p
+= strlen(strcpy(p
, text
));
354 if (!chopup_args(&arg
, buf
)) {
355 BIO_printf(bio_err
, "Can't parse (no memory?)\n");
359 ret
= do_cmd(prog
, arg
.argc
, arg
.argv
);
360 if (ret
== EXIT_THE_PROGRAM
) {
365 BIO_printf(bio_err
, "error in %s\n", arg
.argv
[0]);
366 (void)BIO_flush(bio_out
);
367 (void)BIO_flush(bio_err
);
371 OPENSSL_free(default_config_file
);
372 lh_FUNCTION_free(prog
);
373 OPENSSL_free(arg
.argv
);
377 BIO_free_all(bio_out
);
379 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
380 if (CRYPTO_mem_leaks(bio_err
) <= 0)
387 static void list_cipher_fn(const EVP_CIPHER
*c
,
388 const char *from
, const char *to
, void *arg
)
391 BIO_printf(arg
, "%s\n", EVP_CIPHER_name(c
));
394 from
= "<undefined>";
397 BIO_printf(arg
, "%s => %s\n", from
, to
);
401 static void list_md_fn(const EVP_MD
*m
,
402 const char *from
, const char *to
, void *arg
)
405 BIO_printf(arg
, "%s\n", EVP_MD_name(m
));
408 from
= "<undefined>";
411 BIO_printf((BIO
*)arg
, "%s => %s\n", from
, to
);
415 static void list_mac_fn(const EVP_MAC
*m
,
416 const char *from
, const char *to
, void *arg
)
419 BIO_printf(arg
, "%s\n", EVP_MAC_name(m
));
422 from
= "<undefined>";
425 BIO_printf(arg
, "%s => %s\n", from
, to
);
429 static void list_missing_help(void)
434 for (fp
= functions
; fp
->name
!= NULL
; fp
++) {
435 if ((o
= fp
->help
) != NULL
) {
436 /* If there is help, list what flags are not documented. */
437 for ( ; o
->name
!= NULL
; o
++) {
438 if (o
->helpstr
== NULL
)
439 BIO_printf(bio_out
, "%s %s\n", fp
->name
, o
->name
);
441 } else if (fp
->func
!= dgst_main
) {
442 /* If not aliased to the dgst command, */
443 BIO_printf(bio_out
, "%s *\n", fp
->name
);
448 static void list_objects(void)
450 int max_nid
= OBJ_new_nid(0);
452 char *oid_buf
= NULL
;
455 /* Skip 0, since that's NID_undef */
456 for (i
= 1; i
< max_nid
; i
++) {
457 const ASN1_OBJECT
*obj
= OBJ_nid2obj(i
);
458 const char *sn
= OBJ_nid2sn(i
);
459 const char *ln
= OBJ_nid2ln(i
);
463 * If one of the retrieved objects somehow generated an error,
464 * we ignore it. The check for NID_undef below will detect the
465 * error and simply skip to the next NID.
469 if (OBJ_obj2nid(obj
) == NID_undef
)
472 if ((n
= OBJ_obj2txt(NULL
, 0, obj
, 1)) == 0) {
473 BIO_printf(bio_out
, "# None-OID object: %s, %s\n", sn
, ln
);
480 oid_buf
= OPENSSL_realloc(oid_buf
, n
+ 1);
481 if (oid_buf
== NULL
) {
482 BIO_printf(bio_err
, "ERROR: Memory allocation\n");
487 if (OBJ_obj2txt(oid_buf
, oid_size
, obj
, 1) < 0)
489 if (ln
== NULL
|| strcmp(sn
, ln
) == 0)
490 BIO_printf(bio_out
, "%s = %s\n", sn
, oid_buf
);
492 BIO_printf(bio_out
, "%s = %s, %s\n", sn
, ln
, oid_buf
);
495 OPENSSL_free(oid_buf
);
498 static void list_options_for_command(const char *command
)
503 for (fp
= functions
; fp
->name
!= NULL
; fp
++)
504 if (strcmp(fp
->name
, command
) == 0)
506 if (fp
->name
== NULL
) {
507 BIO_printf(bio_err
, "Invalid command '%s'; type \"help\" for a list.\n",
512 if ((o
= fp
->help
) == NULL
)
515 for ( ; o
->name
!= NULL
; o
++) {
516 if (o
->name
== OPT_HELP_STR
517 || o
->name
== OPT_MORE_STR
518 || o
->name
[0] == '\0')
520 BIO_printf(bio_out
, "%s %c\n", o
->name
, o
->valtype
);
525 /* Unified enum for help and list commands. */
526 typedef enum HELPLIST_CHOICE
{
527 OPT_ERR
= -1, OPT_EOF
= 0, OPT_HELP
, OPT_ONE
,
528 OPT_COMMANDS
, OPT_DIGEST_COMMANDS
, OPT_MAC_ALGORITHMS
, OPT_OPTIONS
,
529 OPT_DIGEST_ALGORITHMS
, OPT_CIPHER_COMMANDS
, OPT_CIPHER_ALGORITHMS
,
530 OPT_PK_ALGORITHMS
, OPT_PK_METHOD
, OPT_ENGINES
, OPT_DISABLED
,
531 OPT_MISSING_HELP
, OPT_OBJECTS
534 const OPTIONS list_options
[] = {
535 {"help", OPT_HELP
, '-', "Display this summary"},
536 {"1", OPT_ONE
, '-', "List in one column"},
537 {"commands", OPT_COMMANDS
, '-', "List of standard commands"},
538 {"digest-commands", OPT_DIGEST_COMMANDS
, '-',
539 "List of message digest commands"},
540 {"digest-algorithms", OPT_DIGEST_ALGORITHMS
, '-',
541 "List of message digest algorithms"},
542 {"mac-algorithms", OPT_MAC_ALGORITHMS
, '-',
543 "List of message authentication code algorithms"},
544 {"cipher-commands", OPT_CIPHER_COMMANDS
, '-', "List of cipher commands"},
545 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS
, '-',
546 "List of cipher algorithms"},
547 {"public-key-algorithms", OPT_PK_ALGORITHMS
, '-',
548 "List of public key algorithms"},
549 {"public-key-methods", OPT_PK_METHOD
, '-',
550 "List of public key methods"},
551 {"engines", OPT_ENGINES
, '-',
552 "List of loaded engines"},
553 {"disabled", OPT_DISABLED
, '-',
554 "List of disabled features"},
555 {"missing-help", OPT_MISSING_HELP
, '-',
556 "List missing detailed help strings"},
557 {"options", OPT_OPTIONS
, 's',
558 "List options for specified command"},
559 {"objects", OPT_OBJECTS
, '-',
560 "List built in objects (OID<->name mappings)"},
564 int list_main(int argc
, char **argv
)
568 int one
= 0, done
= 0;
570 prog
= opt_init(argc
, argv
, list_options
);
571 while ((o
= opt_next()) != OPT_EOF
) {
573 case OPT_EOF
: /* Never hit, but suppresses warning */
576 BIO_printf(bio_err
, "%s: Use -help for summary.\n", prog
);
579 opt_help(list_options
);
585 list_type(FT_general
, one
);
587 case OPT_DIGEST_COMMANDS
:
588 list_type(FT_md
, one
);
590 case OPT_DIGEST_ALGORITHMS
:
591 EVP_MD_do_all_sorted(list_md_fn
, bio_out
);
593 case OPT_MAC_ALGORITHMS
:
594 EVP_MAC_do_all_sorted(list_mac_fn
, bio_out
);
596 case OPT_CIPHER_COMMANDS
:
597 list_type(FT_cipher
, one
);
599 case OPT_CIPHER_ALGORITHMS
:
600 EVP_CIPHER_do_all_sorted(list_cipher_fn
, bio_out
);
602 case OPT_PK_ALGORITHMS
:
614 case OPT_MISSING_HELP
:
621 list_options_for_command(opt_arg());
626 if (opt_num_rest() != 0) {
627 BIO_printf(bio_err
, "Extra arguments given.\n");
637 typedef enum HELP_CHOICE
{
638 OPT_hERR
= -1, OPT_hEOF
= 0, OPT_hHELP
641 const OPTIONS help_options
[] = {
642 {OPT_HELP_STR
, 1, '-', "Usage: help [options]\n"},
643 {OPT_HELP_STR
, 1, '-', " help [command]\n"},
644 {"help", OPT_hHELP
, '-', "Display this summary"},
649 int help_main(int argc
, char **argv
)
658 prog
= opt_init(argc
, argv
, help_options
);
659 while ((o
= opt_next()) != OPT_hEOF
) {
663 BIO_printf(bio_err
, "%s: Use -help for summary.\n", prog
);
666 opt_help(help_options
);
671 if (opt_num_rest() == 1) {
674 new_argv
[0] = opt_rest()[0];
675 new_argv
[1] = "--help";
677 return do_cmd(prog_init(), 2, new_argv
);
679 if (opt_num_rest() != 0) {
680 BIO_printf(bio_err
, "Usage: %s\n", prog
);
684 calculate_columns(&dc
);
685 BIO_printf(bio_err
, "Standard commands");
688 for (fp
= functions
; fp
->name
!= NULL
; fp
++) {
690 if (i
++ % dc
.columns
== 0) {
691 BIO_printf(bio_err
, "\n");
694 if (fp
->type
!= tp
) {
697 BIO_printf(bio_err
, "\n");
701 "\nMessage Digest commands (see the `dgst' command for more details)\n");
702 } else if (tp
== FT_cipher
) {
705 "\nCipher commands (see the `enc' command for more details)\n");
708 BIO_printf(bio_err
, "%-*s", dc
.width
, fp
->name
);
710 BIO_printf(bio_err
, "\n\n");
714 static void list_type(FUNC_TYPE ft
, int one
)
720 memset(&dc
, 0, sizeof(dc
));
722 calculate_columns(&dc
);
724 for (fp
= functions
; fp
->name
!= NULL
; fp
++) {
728 BIO_printf(bio_out
, "%s\n", fp
->name
);
730 if (i
% dc
.columns
== 0 && i
> 0)
731 BIO_printf(bio_out
, "\n");
732 BIO_printf(bio_out
, "%-*s", dc
.width
, fp
->name
);
737 BIO_printf(bio_out
, "\n\n");
740 static int do_cmd(LHASH_OF(FUNCTION
) *prog
, int argc
, char *argv
[])
744 if (argc
<= 0 || argv
[0] == NULL
)
747 fp
= lh_FUNCTION_retrieve(prog
, &f
);
749 if (EVP_get_digestbyname(argv
[0])) {
753 } else if (EVP_get_cipherbyname(argv
[0])) {
760 return fp
->func(argc
, argv
);
762 if ((strncmp(argv
[0], "no-", 3)) == 0) {
764 * User is asking if foo is unsupported, by trying to "run" the
765 * no-foo command. Strange.
767 f
.name
= argv
[0] + 3;
768 if (lh_FUNCTION_retrieve(prog
, &f
) == NULL
) {
769 BIO_printf(bio_out
, "%s\n", argv
[0]);
772 BIO_printf(bio_out
, "%s\n", argv
[0] + 3);
775 if (strcmp(argv
[0], "quit") == 0 || strcmp(argv
[0], "q") == 0 ||
776 strcmp(argv
[0], "exit") == 0 || strcmp(argv
[0], "bye") == 0)
777 /* Special value to mean "exit the program. */
778 return EXIT_THE_PROGRAM
;
780 BIO_printf(bio_err
, "Invalid command '%s'; type \"help\" for a list.\n",
785 static void list_pkey(void)
789 for (i
= 0; i
< EVP_PKEY_asn1_get_count(); i
++) {
790 const EVP_PKEY_ASN1_METHOD
*ameth
;
791 int pkey_id
, pkey_base_id
, pkey_flags
;
792 const char *pinfo
, *pem_str
;
793 ameth
= EVP_PKEY_asn1_get0(i
);
794 EVP_PKEY_asn1_get0_info(&pkey_id
, &pkey_base_id
, &pkey_flags
,
795 &pinfo
, &pem_str
, ameth
);
796 if (pkey_flags
& ASN1_PKEY_ALIAS
) {
797 BIO_printf(bio_out
, "Name: %s\n", OBJ_nid2ln(pkey_id
));
798 BIO_printf(bio_out
, "\tAlias for: %s\n",
799 OBJ_nid2ln(pkey_base_id
));
801 BIO_printf(bio_out
, "Name: %s\n", pinfo
);
802 BIO_printf(bio_out
, "\tType: %s Algorithm\n",
803 pkey_flags
& ASN1_PKEY_DYNAMIC
?
804 "External" : "Builtin");
805 BIO_printf(bio_out
, "\tOID: %s\n", OBJ_nid2ln(pkey_id
));
808 BIO_printf(bio_out
, "\tPEM string: %s\n", pem_str
);
814 static void list_pkey_meth(void)
817 size_t meth_count
= EVP_PKEY_meth_get_count();
819 for (i
= 0; i
< meth_count
; i
++) {
820 const EVP_PKEY_METHOD
*pmeth
= EVP_PKEY_meth_get0(i
);
821 int pkey_id
, pkey_flags
;
823 EVP_PKEY_meth_get0_info(&pkey_id
, &pkey_flags
, pmeth
);
824 BIO_printf(bio_out
, "%s\n", OBJ_nid2ln(pkey_id
));
825 BIO_printf(bio_out
, "\tType: %s Algorithm\n",
826 pkey_flags
& ASN1_PKEY_DYNAMIC
? "External" : "Builtin");
830 static int function_cmp(const FUNCTION
* a
, const FUNCTION
* b
)
832 return strncmp(a
->name
, b
->name
, 8);
835 static unsigned long function_hash(const FUNCTION
* a
)
837 return OPENSSL_LH_strhash(a
->name
);
840 static int SortFnByName(const void *_f1
, const void *_f2
)
842 const FUNCTION
*f1
= _f1
;
843 const FUNCTION
*f2
= _f2
;
845 if (f1
->type
!= f2
->type
)
846 return f1
->type
- f2
->type
;
847 return strcmp(f1
->name
, f2
->name
);
850 static void list_engines(void)
852 #ifndef OPENSSL_NO_ENGINE
855 BIO_puts(bio_out
, "Engines:\n");
856 e
= ENGINE_get_first();
858 BIO_printf(bio_out
, "%s\n", ENGINE_get_id(e
));
859 e
= ENGINE_get_next(e
);
862 BIO_puts(bio_out
, "Engine support is disabled.\n");
866 static void list_disabled(void)
868 BIO_puts(bio_out
, "Disabled algorithms:\n");
869 #ifdef OPENSSL_NO_ARIA
870 BIO_puts(bio_out
, "ARIA\n");
873 BIO_puts(bio_out
, "BF\n");
875 #ifdef OPENSSL_NO_BLAKE2
876 BIO_puts(bio_out
, "BLAKE2\n");
878 #ifdef OPENSSL_NO_CAMELLIA
879 BIO_puts(bio_out
, "CAMELLIA\n");
881 #ifdef OPENSSL_NO_CAST
882 BIO_puts(bio_out
, "CAST\n");
884 #ifdef OPENSSL_NO_CMAC
885 BIO_puts(bio_out
, "CMAC\n");
887 #ifdef OPENSSL_NO_CMS
888 BIO_puts(bio_out
, "CMS\n");
890 #ifdef OPENSSL_NO_COMP
891 BIO_puts(bio_out
, "COMP\n");
893 #ifdef OPENSSL_NO_DES
894 BIO_puts(bio_out
, "DES\n");
896 #ifdef OPENSSL_NO_DGRAM
897 BIO_puts(bio_out
, "DGRAM\n");
900 BIO_puts(bio_out
, "DH\n");
902 #ifdef OPENSSL_NO_DSA
903 BIO_puts(bio_out
, "DSA\n");
905 #if defined(OPENSSL_NO_DTLS)
906 BIO_puts(bio_out
, "DTLS\n");
908 #if defined(OPENSSL_NO_DTLS1)
909 BIO_puts(bio_out
, "DTLS1\n");
911 #if defined(OPENSSL_NO_DTLS1_2)
912 BIO_puts(bio_out
, "DTLS1_2\n");
915 BIO_puts(bio_out
, "EC\n");
917 #ifdef OPENSSL_NO_EC2M
918 BIO_puts(bio_out
, "EC2M\n");
920 #ifdef OPENSSL_NO_ENGINE
921 BIO_puts(bio_out
, "ENGINE\n");
923 #ifdef OPENSSL_NO_GOST
924 BIO_puts(bio_out
, "GOST\n");
926 #ifdef OPENSSL_NO_HEARTBEATS
927 BIO_puts(bio_out
, "HEARTBEATS\n");
929 #ifdef OPENSSL_NO_IDEA
930 BIO_puts(bio_out
, "IDEA\n");
932 #ifdef OPENSSL_NO_MD2
933 BIO_puts(bio_out
, "MD2\n");
935 #ifdef OPENSSL_NO_MD4
936 BIO_puts(bio_out
, "MD4\n");
938 #ifdef OPENSSL_NO_MD5
939 BIO_puts(bio_out
, "MD5\n");
941 #ifdef OPENSSL_NO_MDC2
942 BIO_puts(bio_out
, "MDC2\n");
944 #ifdef OPENSSL_NO_OCB
945 BIO_puts(bio_out
, "OCB\n");
947 #ifdef OPENSSL_NO_OCSP
948 BIO_puts(bio_out
, "OCSP\n");
950 #ifdef OPENSSL_NO_PSK
951 BIO_puts(bio_out
, "PSK\n");
953 #ifdef OPENSSL_NO_RC2
954 BIO_puts(bio_out
, "RC2\n");
956 #ifdef OPENSSL_NO_RC4
957 BIO_puts(bio_out
, "RC4\n");
959 #ifdef OPENSSL_NO_RC5
960 BIO_puts(bio_out
, "RC5\n");
962 #ifdef OPENSSL_NO_RMD160
963 BIO_puts(bio_out
, "RMD160\n");
965 #ifdef OPENSSL_NO_RSA
966 BIO_puts(bio_out
, "RSA\n");
968 #ifdef OPENSSL_NO_SCRYPT
969 BIO_puts(bio_out
, "SCRYPT\n");
971 #ifdef OPENSSL_NO_SCTP
972 BIO_puts(bio_out
, "SCTP\n");
974 #ifdef OPENSSL_NO_SEED
975 BIO_puts(bio_out
, "SEED\n");
977 #ifdef OPENSSL_NO_SM2
978 BIO_puts(bio_out
, "SM2\n");
980 #ifdef OPENSSL_NO_SM3
981 BIO_puts(bio_out
, "SM3\n");
983 #ifdef OPENSSL_NO_SM4
984 BIO_puts(bio_out
, "SM4\n");
986 #ifdef OPENSSL_NO_SOCK
987 BIO_puts(bio_out
, "SOCK\n");
989 #ifdef OPENSSL_NO_SRP
990 BIO_puts(bio_out
, "SRP\n");
992 #ifdef OPENSSL_NO_SRTP
993 BIO_puts(bio_out
, "SRTP\n");
995 #ifdef OPENSSL_NO_SSL3
996 BIO_puts(bio_out
, "SSL3\n");
998 #ifdef OPENSSL_NO_TLS1
999 BIO_puts(bio_out
, "TLS1\n");
1001 #ifdef OPENSSL_NO_TLS1_1
1002 BIO_puts(bio_out
, "TLS1_1\n");
1004 #ifdef OPENSSL_NO_TLS1_2
1005 BIO_puts(bio_out
, "TLS1_2\n");
1007 #ifdef OPENSSL_NO_WHIRLPOOL
1008 BIO_puts(bio_out
, "WHIRLPOOL\n");
1011 BIO_puts(bio_out
, "ZLIB\n");
1015 static LHASH_OF(FUNCTION
) *prog_init(void)
1017 static LHASH_OF(FUNCTION
) *ret
= NULL
;
1018 static int prog_inited
= 0;
1027 /* Sort alphabetically within category. For nicer help displays. */
1028 for (i
= 0, f
= functions
; f
->name
!= NULL
; ++f
, ++i
)
1030 qsort(functions
, i
, sizeof(*functions
), SortFnByName
);
1032 if ((ret
= lh_FUNCTION_new(function_hash
, function_cmp
)) == NULL
)
1035 for (f
= functions
; f
->name
!= NULL
; f
++)
1036 (void)lh_FUNCTION_insert(ret
, f
);