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 static void setup_trace(const char *str
)
170 val
= OPENSSL_strdup(str
);
176 for (valp
= val
; (item
= strtok(valp
, ",")) != NULL
; valp
= NULL
) {
177 int category
= OSSL_trace_get_category_num(item
);
180 BIO
*channel
= BIO_push(BIO_new(apps_bf_prefix()),
181 dup_bio_err(FORMAT_TEXT
));
182 tracedata
*trace_data
= OPENSSL_zalloc(sizeof(*trace_data
));
184 if (trace_data
== NULL
185 || (trace_data
->bio
= channel
) == NULL
186 || OSSL_trace_set_callback(category
, internal_trace_cb
,
189 "warning: unable to setup trace callback for category '%s'.\n",
194 "warning: unknown trace category: '%s'.\n",
203 int main(int argc
, char *argv
[])
206 LHASH_OF(FUNCTION
) *prog
= NULL
;
211 int first
, n
, i
, ret
= 0;
216 /* Set up some of the environment. */
217 default_config_file
= make_config_name();
218 bio_in
= dup_bio_in(FORMAT_TEXT
);
219 bio_out
= dup_bio_out(FORMAT_TEXT
);
220 bio_err
= dup_bio_err(FORMAT_TEXT
);
222 #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
223 argv
= copy_argv(&argc
, argv
);
224 #elif defined(_WIN32)
226 * Replace argv[] with UTF-8 encoded strings.
228 win32_utf8argv(&argc
, &argv
);
232 * We use the prefix method to get the trace output we want. Since some
233 * trace outputs happen with OPENSSL_cleanup(), which is run automatically
234 * after exit(), we need to destroy the prefix method as late as possible.
236 atexit(destroy_prefix_method
);
238 setup_trace(getenv("OPENSSL_TRACE"));
240 p
= getenv("OPENSSL_DEBUG_MEMORY");
241 if (p
!= NULL
&& strcmp(p
, "on") == 0)
242 CRYPTO_set_mem_debug(1);
243 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON
);
245 if (getenv("OPENSSL_FIPS")) {
246 BIO_printf(bio_err
, "FIPS mode not supported.\n");
250 if (!apps_startup()) {
252 "FATAL: Startup failure (dev note: apps_startup() failed)\n");
253 ERR_print_errors(bio_err
);
259 pname
= opt_progname(argv
[0]);
261 /* first check the program name */
263 fp
= lh_FUNCTION_retrieve(prog
, &f
);
266 ret
= fp
->func(argc
, argv
);
270 /* If there is stuff on the command line, run with that. */
274 ret
= do_cmd(prog
, argc
, argv
);
280 /* ok, lets enter interactive mode */
283 /* Read a line, continue reading if line ends with \ */
284 for (p
= buf
, n
= sizeof(buf
), i
= 0, first
= 1; n
> 0; first
= 0) {
285 prompt
= first
? "OpenSSL> " : "> ";
288 fputs(prompt
, stdout
);
290 if (!fgets(p
, n
, stdin
))
297 if (p
[i
- 2] != '\\')
304 extern char *readline(const char *);
305 extern void add_history(const char *cp
);
308 text
= readline(prompt
);
314 if (text
[i
- 1] != '\\') {
315 p
+= strlen(strcpy(p
, text
));
322 p
+= strlen(strcpy(p
, text
));
329 if (!chopup_args(&arg
, buf
)) {
330 BIO_printf(bio_err
, "Can't parse (no memory?)\n");
334 ret
= do_cmd(prog
, arg
.argc
, arg
.argv
);
335 if (ret
== EXIT_THE_PROGRAM
) {
340 BIO_printf(bio_err
, "error in %s\n", arg
.argv
[0]);
341 (void)BIO_flush(bio_out
);
342 (void)BIO_flush(bio_err
);
346 OPENSSL_free(default_config_file
);
347 lh_FUNCTION_free(prog
);
348 OPENSSL_free(arg
.argv
);
352 BIO_free_all(bio_out
);
354 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
355 if (CRYPTO_mem_leaks(bio_err
) <= 0)
362 static void list_cipher_fn(const EVP_CIPHER
*c
,
363 const char *from
, const char *to
, void *arg
)
366 BIO_printf(arg
, "%s\n", EVP_CIPHER_name(c
));
369 from
= "<undefined>";
372 BIO_printf(arg
, "%s => %s\n", from
, to
);
376 static void list_md_fn(const EVP_MD
*m
,
377 const char *from
, const char *to
, void *arg
)
380 BIO_printf(arg
, "%s\n", EVP_MD_name(m
));
383 from
= "<undefined>";
386 BIO_printf((BIO
*)arg
, "%s => %s\n", from
, to
);
390 static void list_mac_fn(const EVP_MAC
*m
,
391 const char *from
, const char *to
, void *arg
)
394 BIO_printf(arg
, "%s\n", EVP_MAC_name(m
));
397 from
= "<undefined>";
400 BIO_printf(arg
, "%s => %s\n", from
, to
);
404 static void list_missing_help(void)
409 for (fp
= functions
; fp
->name
!= NULL
; fp
++) {
410 if ((o
= fp
->help
) != NULL
) {
411 /* If there is help, list what flags are not documented. */
412 for ( ; o
->name
!= NULL
; o
++) {
413 if (o
->helpstr
== NULL
)
414 BIO_printf(bio_out
, "%s %s\n", fp
->name
, o
->name
);
416 } else if (fp
->func
!= dgst_main
) {
417 /* If not aliased to the dgst command, */
418 BIO_printf(bio_out
, "%s *\n", fp
->name
);
423 static void list_objects(void)
425 int max_nid
= OBJ_new_nid(0);
427 char *oid_buf
= NULL
;
430 /* Skip 0, since that's NID_undef */
431 for (i
= 1; i
< max_nid
; i
++) {
432 const ASN1_OBJECT
*obj
= OBJ_nid2obj(i
);
433 const char *sn
= OBJ_nid2sn(i
);
434 const char *ln
= OBJ_nid2ln(i
);
438 * If one of the retrieved objects somehow generated an error,
439 * we ignore it. The check for NID_undef below will detect the
440 * error and simply skip to the next NID.
444 if (OBJ_obj2nid(obj
) == NID_undef
)
447 if ((n
= OBJ_obj2txt(NULL
, 0, obj
, 1)) == 0) {
448 BIO_printf(bio_out
, "# None-OID object: %s, %s\n", sn
, ln
);
455 oid_buf
= OPENSSL_realloc(oid_buf
, n
+ 1);
456 if (oid_buf
== NULL
) {
457 BIO_printf(bio_err
, "ERROR: Memory allocation\n");
462 if (OBJ_obj2txt(oid_buf
, oid_size
, obj
, 1) < 0)
464 if (ln
== NULL
|| strcmp(sn
, ln
) == 0)
465 BIO_printf(bio_out
, "%s = %s\n", sn
, oid_buf
);
467 BIO_printf(bio_out
, "%s = %s, %s\n", sn
, ln
, oid_buf
);
470 OPENSSL_free(oid_buf
);
473 static void list_options_for_command(const char *command
)
478 for (fp
= functions
; fp
->name
!= NULL
; fp
++)
479 if (strcmp(fp
->name
, command
) == 0)
481 if (fp
->name
== NULL
) {
482 BIO_printf(bio_err
, "Invalid command '%s'; type \"help\" for a list.\n",
487 if ((o
= fp
->help
) == NULL
)
490 for ( ; o
->name
!= NULL
; o
++) {
491 if (o
->name
== OPT_HELP_STR
492 || o
->name
== OPT_MORE_STR
493 || o
->name
[0] == '\0')
495 BIO_printf(bio_out
, "%s %c\n", o
->name
, o
->valtype
);
500 /* Unified enum for help and list commands. */
501 typedef enum HELPLIST_CHOICE
{
502 OPT_ERR
= -1, OPT_EOF
= 0, OPT_HELP
, OPT_ONE
,
503 OPT_COMMANDS
, OPT_DIGEST_COMMANDS
, OPT_MAC_ALGORITHMS
, OPT_OPTIONS
,
504 OPT_DIGEST_ALGORITHMS
, OPT_CIPHER_COMMANDS
, OPT_CIPHER_ALGORITHMS
,
505 OPT_PK_ALGORITHMS
, OPT_PK_METHOD
, OPT_DISABLED
, OPT_MISSING_HELP
,
509 const OPTIONS list_options
[] = {
510 {"help", OPT_HELP
, '-', "Display this summary"},
511 {"1", OPT_ONE
, '-', "List in one column"},
512 {"commands", OPT_COMMANDS
, '-', "List of standard commands"},
513 {"digest-commands", OPT_DIGEST_COMMANDS
, '-',
514 "List of message digest commands"},
515 {"digest-algorithms", OPT_DIGEST_ALGORITHMS
, '-',
516 "List of message digest algorithms"},
517 {"mac-algorithms", OPT_MAC_ALGORITHMS
, '-',
518 "List of message authentication code algorithms"},
519 {"cipher-commands", OPT_CIPHER_COMMANDS
, '-', "List of cipher commands"},
520 {"cipher-algorithms", OPT_CIPHER_ALGORITHMS
, '-',
521 "List of cipher algorithms"},
522 {"public-key-algorithms", OPT_PK_ALGORITHMS
, '-',
523 "List of public key algorithms"},
524 {"public-key-methods", OPT_PK_METHOD
, '-',
525 "List of public key methods"},
526 {"disabled", OPT_DISABLED
, '-',
527 "List of disabled features"},
528 {"missing-help", OPT_MISSING_HELP
, '-',
529 "List missing detailed help strings"},
530 {"options", OPT_OPTIONS
, 's',
531 "List options for specified command"},
532 {"objects", OPT_OBJECTS
, '-',
533 "List built in objects (OID<->name mappings)"},
537 int list_main(int argc
, char **argv
)
541 int one
= 0, done
= 0;
543 prog
= opt_init(argc
, argv
, list_options
);
544 while ((o
= opt_next()) != OPT_EOF
) {
546 case OPT_EOF
: /* Never hit, but suppresses warning */
549 BIO_printf(bio_err
, "%s: Use -help for summary.\n", prog
);
552 opt_help(list_options
);
558 list_type(FT_general
, one
);
560 case OPT_DIGEST_COMMANDS
:
561 list_type(FT_md
, one
);
563 case OPT_DIGEST_ALGORITHMS
:
564 EVP_MD_do_all_sorted(list_md_fn
, bio_out
);
566 case OPT_MAC_ALGORITHMS
:
567 EVP_MAC_do_all_sorted(list_mac_fn
, bio_out
);
569 case OPT_CIPHER_COMMANDS
:
570 list_type(FT_cipher
, one
);
572 case OPT_CIPHER_ALGORITHMS
:
573 EVP_CIPHER_do_all_sorted(list_cipher_fn
, bio_out
);
575 case OPT_PK_ALGORITHMS
:
584 case OPT_MISSING_HELP
:
591 list_options_for_command(opt_arg());
596 if (opt_num_rest() != 0) {
597 BIO_printf(bio_err
, "Extra arguments given.\n");
607 typedef enum HELP_CHOICE
{
608 OPT_hERR
= -1, OPT_hEOF
= 0, OPT_hHELP
611 const OPTIONS help_options
[] = {
612 {OPT_HELP_STR
, 1, '-', "Usage: help [options]\n"},
613 {OPT_HELP_STR
, 1, '-', " help [command]\n"},
614 {"help", OPT_hHELP
, '-', "Display this summary"},
619 int help_main(int argc
, char **argv
)
628 prog
= opt_init(argc
, argv
, help_options
);
629 while ((o
= opt_next()) != OPT_hEOF
) {
633 BIO_printf(bio_err
, "%s: Use -help for summary.\n", prog
);
636 opt_help(help_options
);
641 if (opt_num_rest() == 1) {
644 new_argv
[0] = opt_rest()[0];
645 new_argv
[1] = "--help";
647 return do_cmd(prog_init(), 2, new_argv
);
649 if (opt_num_rest() != 0) {
650 BIO_printf(bio_err
, "Usage: %s\n", prog
);
654 calculate_columns(&dc
);
655 BIO_printf(bio_err
, "Standard commands");
658 for (fp
= functions
; fp
->name
!= NULL
; fp
++) {
660 if (i
++ % dc
.columns
== 0) {
661 BIO_printf(bio_err
, "\n");
664 if (fp
->type
!= tp
) {
667 BIO_printf(bio_err
, "\n");
671 "\nMessage Digest commands (see the `dgst' command for more details)\n");
672 } else if (tp
== FT_cipher
) {
675 "\nCipher commands (see the `enc' command for more details)\n");
678 BIO_printf(bio_err
, "%-*s", dc
.width
, fp
->name
);
680 BIO_printf(bio_err
, "\n\n");
684 static void list_type(FUNC_TYPE ft
, int one
)
688 DISPLAY_COLUMNS dc
= {0};
691 calculate_columns(&dc
);
693 for (fp
= functions
; fp
->name
!= NULL
; fp
++) {
697 BIO_printf(bio_out
, "%s\n", fp
->name
);
699 if (i
% dc
.columns
== 0 && i
> 0)
700 BIO_printf(bio_out
, "\n");
701 BIO_printf(bio_out
, "%-*s", dc
.width
, fp
->name
);
706 BIO_printf(bio_out
, "\n\n");
709 static int do_cmd(LHASH_OF(FUNCTION
) *prog
, int argc
, char *argv
[])
713 if (argc
<= 0 || argv
[0] == NULL
)
716 fp
= lh_FUNCTION_retrieve(prog
, &f
);
718 if (EVP_get_digestbyname(argv
[0])) {
722 } else if (EVP_get_cipherbyname(argv
[0])) {
729 return fp
->func(argc
, argv
);
731 if ((strncmp(argv
[0], "no-", 3)) == 0) {
733 * User is asking if foo is unsupported, by trying to "run" the
734 * no-foo command. Strange.
736 f
.name
= argv
[0] + 3;
737 if (lh_FUNCTION_retrieve(prog
, &f
) == NULL
) {
738 BIO_printf(bio_out
, "%s\n", argv
[0]);
741 BIO_printf(bio_out
, "%s\n", argv
[0] + 3);
744 if (strcmp(argv
[0], "quit") == 0 || strcmp(argv
[0], "q") == 0 ||
745 strcmp(argv
[0], "exit") == 0 || strcmp(argv
[0], "bye") == 0)
746 /* Special value to mean "exit the program. */
747 return EXIT_THE_PROGRAM
;
749 BIO_printf(bio_err
, "Invalid command '%s'; type \"help\" for a list.\n",
754 static void list_pkey(void)
758 for (i
= 0; i
< EVP_PKEY_asn1_get_count(); i
++) {
759 const EVP_PKEY_ASN1_METHOD
*ameth
;
760 int pkey_id
, pkey_base_id
, pkey_flags
;
761 const char *pinfo
, *pem_str
;
762 ameth
= EVP_PKEY_asn1_get0(i
);
763 EVP_PKEY_asn1_get0_info(&pkey_id
, &pkey_base_id
, &pkey_flags
,
764 &pinfo
, &pem_str
, ameth
);
765 if (pkey_flags
& ASN1_PKEY_ALIAS
) {
766 BIO_printf(bio_out
, "Name: %s\n", OBJ_nid2ln(pkey_id
));
767 BIO_printf(bio_out
, "\tAlias for: %s\n",
768 OBJ_nid2ln(pkey_base_id
));
770 BIO_printf(bio_out
, "Name: %s\n", pinfo
);
771 BIO_printf(bio_out
, "\tType: %s Algorithm\n",
772 pkey_flags
& ASN1_PKEY_DYNAMIC
?
773 "External" : "Builtin");
774 BIO_printf(bio_out
, "\tOID: %s\n", OBJ_nid2ln(pkey_id
));
777 BIO_printf(bio_out
, "\tPEM string: %s\n", pem_str
);
783 static void list_pkey_meth(void)
786 size_t meth_count
= EVP_PKEY_meth_get_count();
788 for (i
= 0; i
< meth_count
; i
++) {
789 const EVP_PKEY_METHOD
*pmeth
= EVP_PKEY_meth_get0(i
);
790 int pkey_id
, pkey_flags
;
792 EVP_PKEY_meth_get0_info(&pkey_id
, &pkey_flags
, pmeth
);
793 BIO_printf(bio_out
, "%s\n", OBJ_nid2ln(pkey_id
));
794 BIO_printf(bio_out
, "\tType: %s Algorithm\n",
795 pkey_flags
& ASN1_PKEY_DYNAMIC
? "External" : "Builtin");
799 static int function_cmp(const FUNCTION
* a
, const FUNCTION
* b
)
801 return strncmp(a
->name
, b
->name
, 8);
804 static unsigned long function_hash(const FUNCTION
* a
)
806 return OPENSSL_LH_strhash(a
->name
);
809 static int SortFnByName(const void *_f1
, const void *_f2
)
811 const FUNCTION
*f1
= _f1
;
812 const FUNCTION
*f2
= _f2
;
814 if (f1
->type
!= f2
->type
)
815 return f1
->type
- f2
->type
;
816 return strcmp(f1
->name
, f2
->name
);
819 static void list_disabled(void)
821 BIO_puts(bio_out
, "Disabled algorithms:\n");
822 #ifdef OPENSSL_NO_ARIA
823 BIO_puts(bio_out
, "ARIA\n");
826 BIO_puts(bio_out
, "BF\n");
828 #ifdef OPENSSL_NO_BLAKE2
829 BIO_puts(bio_out
, "BLAKE2\n");
831 #ifdef OPENSSL_NO_CAMELLIA
832 BIO_puts(bio_out
, "CAMELLIA\n");
834 #ifdef OPENSSL_NO_CAST
835 BIO_puts(bio_out
, "CAST\n");
837 #ifdef OPENSSL_NO_CMAC
838 BIO_puts(bio_out
, "CMAC\n");
840 #ifdef OPENSSL_NO_CMS
841 BIO_puts(bio_out
, "CMS\n");
843 #ifdef OPENSSL_NO_COMP
844 BIO_puts(bio_out
, "COMP\n");
846 #ifdef OPENSSL_NO_DES
847 BIO_puts(bio_out
, "DES\n");
849 #ifdef OPENSSL_NO_DGRAM
850 BIO_puts(bio_out
, "DGRAM\n");
853 BIO_puts(bio_out
, "DH\n");
855 #ifdef OPENSSL_NO_DSA
856 BIO_puts(bio_out
, "DSA\n");
858 #if defined(OPENSSL_NO_DTLS)
859 BIO_puts(bio_out
, "DTLS\n");
861 #if defined(OPENSSL_NO_DTLS1)
862 BIO_puts(bio_out
, "DTLS1\n");
864 #if defined(OPENSSL_NO_DTLS1_2)
865 BIO_puts(bio_out
, "DTLS1_2\n");
868 BIO_puts(bio_out
, "EC\n");
870 #ifdef OPENSSL_NO_EC2M
871 BIO_puts(bio_out
, "EC2M\n");
873 #ifdef OPENSSL_NO_ENGINE
874 BIO_puts(bio_out
, "ENGINE\n");
876 #ifdef OPENSSL_NO_GOST
877 BIO_puts(bio_out
, "GOST\n");
879 #ifdef OPENSSL_NO_HEARTBEATS
880 BIO_puts(bio_out
, "HEARTBEATS\n");
882 #ifdef OPENSSL_NO_IDEA
883 BIO_puts(bio_out
, "IDEA\n");
885 #ifdef OPENSSL_NO_MD2
886 BIO_puts(bio_out
, "MD2\n");
888 #ifdef OPENSSL_NO_MD4
889 BIO_puts(bio_out
, "MD4\n");
891 #ifdef OPENSSL_NO_MD5
892 BIO_puts(bio_out
, "MD5\n");
894 #ifdef OPENSSL_NO_MDC2
895 BIO_puts(bio_out
, "MDC2\n");
897 #ifdef OPENSSL_NO_OCB
898 BIO_puts(bio_out
, "OCB\n");
900 #ifdef OPENSSL_NO_OCSP
901 BIO_puts(bio_out
, "OCSP\n");
903 #ifdef OPENSSL_NO_PSK
904 BIO_puts(bio_out
, "PSK\n");
906 #ifdef OPENSSL_NO_RC2
907 BIO_puts(bio_out
, "RC2\n");
909 #ifdef OPENSSL_NO_RC4
910 BIO_puts(bio_out
, "RC4\n");
912 #ifdef OPENSSL_NO_RC5
913 BIO_puts(bio_out
, "RC5\n");
915 #ifdef OPENSSL_NO_RMD160
916 BIO_puts(bio_out
, "RMD160\n");
918 #ifdef OPENSSL_NO_RSA
919 BIO_puts(bio_out
, "RSA\n");
921 #ifdef OPENSSL_NO_SCRYPT
922 BIO_puts(bio_out
, "SCRYPT\n");
924 #ifdef OPENSSL_NO_SCTP
925 BIO_puts(bio_out
, "SCTP\n");
927 #ifdef OPENSSL_NO_SEED
928 BIO_puts(bio_out
, "SEED\n");
930 #ifdef OPENSSL_NO_SM2
931 BIO_puts(bio_out
, "SM2\n");
933 #ifdef OPENSSL_NO_SM3
934 BIO_puts(bio_out
, "SM3\n");
936 #ifdef OPENSSL_NO_SM4
937 BIO_puts(bio_out
, "SM4\n");
939 #ifdef OPENSSL_NO_SOCK
940 BIO_puts(bio_out
, "SOCK\n");
942 #ifdef OPENSSL_NO_SRP
943 BIO_puts(bio_out
, "SRP\n");
945 #ifdef OPENSSL_NO_SRTP
946 BIO_puts(bio_out
, "SRTP\n");
948 #ifdef OPENSSL_NO_SSL3
949 BIO_puts(bio_out
, "SSL3\n");
951 #ifdef OPENSSL_NO_TLS1
952 BIO_puts(bio_out
, "TLS1\n");
954 #ifdef OPENSSL_NO_TLS1_1
955 BIO_puts(bio_out
, "TLS1_1\n");
957 #ifdef OPENSSL_NO_TLS1_2
958 BIO_puts(bio_out
, "TLS1_2\n");
960 #ifdef OPENSSL_NO_WHIRLPOOL
961 BIO_puts(bio_out
, "WHIRLPOOL\n");
964 BIO_puts(bio_out
, "ZLIB\n");
968 static LHASH_OF(FUNCTION
) *prog_init(void)
970 static LHASH_OF(FUNCTION
) *ret
= NULL
;
971 static int prog_inited
= 0;
980 /* Sort alphabetically within category. For nicer help displays. */
981 for (i
= 0, f
= functions
; f
->name
!= NULL
; ++f
, ++i
)
983 qsort(functions
, i
, sizeof(*functions
), SortFnByName
);
985 if ((ret
= lh_FUNCTION_new(function_hash
, function_cmp
)) == NULL
)
988 for (f
= functions
; f
->name
!= NULL
; f
++)
989 (void)lh_FUNCTION_insert(ret
, f
);