diff options
author | Pauli <pauli@openssl.org> | 2022-09-08 12:54:23 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-09-11 20:58:40 +1000 |
commit | 35b670702466b91b3baa724635e5aecbc2061fa7 (patch) | |
tree | 67a74c6d5c0f3a57f1000afd38f08a11ab023cd7 /apps/list.c | |
parent | 8e39049d38ebe8b8398d6c4aa8a6f7cef9712132 (diff) |
list: add an option to list all available algorithms
Fixes #19145
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19168)
Diffstat (limited to 'apps/list.c')
-rw-r--r-- | apps/list.c | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/apps/list.c b/apps/list.c index 37d2c788de..adcfaa4260 100644 --- a/apps/list.c +++ b/apps/list.c @@ -102,7 +102,7 @@ static void collect_ciphers(EVP_CIPHER *cipher, void *stack) EVP_CIPHER_up_ref(cipher); } -static void list_ciphers(void) +static void list_ciphers(const char *prefix) { STACK_OF(EVP_CIPHER) *ciphers = sk_EVP_CIPHER_new(cipher_cmp); int i; @@ -113,12 +113,12 @@ static void list_ciphers(void) } #ifndef OPENSSL_NO_DEPRECATED_3_0 if (include_legacy()) { - BIO_printf(bio_out, "Legacy:\n"); + BIO_printf(bio_out, "%sLegacy:\n", prefix); EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out); } #endif - BIO_printf(bio_out, "Provided:\n"); + BIO_printf(bio_out, "%sProvided:\n", prefix); EVP_CIPHER_do_all_provided(app_get0_libctx(), collect_ciphers, ciphers); sk_EVP_CIPHER_sort(ciphers); for (i = 0; i < sk_EVP_CIPHER_num(ciphers); i++) { @@ -186,7 +186,7 @@ static void collect_digests(EVP_MD *digest, void *stack) EVP_MD_up_ref(digest); } -static void list_digests(void) +static void list_digests(const char *prefix) { STACK_OF(EVP_MD) *digests = sk_EVP_MD_new(md_cmp); int i; @@ -197,12 +197,12 @@ static void list_digests(void) } #ifndef OPENSSL_NO_DEPRECATED_3_0 if (include_legacy()) { - BIO_printf(bio_out, "Legacy:\n"); + BIO_printf(bio_out, "%sLegacy:\n", prefix); EVP_MD_do_all_sorted(legacy_md_fn, bio_out); } #endif - BIO_printf(bio_out, "Provided:\n"); + BIO_printf(bio_out, "%sProvided:\n", prefix); EVP_MD_do_all_provided(app_get0_libctx(), collect_digests, digests); sk_EVP_MD_sort(digests); for (i = 0; i < sk_EVP_MD_num(digests); i++) { @@ -1430,6 +1430,7 @@ static void list_disabled(void) typedef enum HELPLIST_CHOICE { OPT_COMMON, OPT_ONE, OPT_VERBOSE, + OPT_ALL_ARGORITHMS, OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS, OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS, OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_DISABLED, @@ -1455,6 +1456,7 @@ const OPTIONS list_options[] = { {"select", OPT_SELECT_NAME, 's', "Select a single algorithm"}, {"commands", OPT_COMMANDS, '-', "List of standard commands"}, {"standard-commands", OPT_COMMANDS, '-', "List of standard commands"}, + {"all-algorithms", OPT_ALL_ARGORITHMS, '-', "List of all algorithms"}, #ifndef OPENSSL_NO_DEPRECATED_3_0 {"digest-commands", OPT_DIGEST_COMMANDS, '-', "List of message digest commands (deprecated)"}, @@ -1515,6 +1517,7 @@ int list_main(int argc, char **argv) int one = 0, done = 0; struct { unsigned int commands:1; + unsigned int all_algorithms:1; unsigned int random_instances:1; unsigned int random_generators:1; unsigned int digest_commands:1; @@ -1558,6 +1561,9 @@ opthelp: case OPT_ONE: one = 1; break; + case OPT_ALL_ARGORITHMS: + todo.all_algorithms = 1; + break; case OPT_COMMANDS: todo.commands = 1; break; @@ -1652,6 +1658,29 @@ opthelp: if (todo.commands) list_type(FT_general, one); + if (todo.all_algorithms) { + BIO_printf(bio_out, "Digests:\n"); + list_digests(" "); + BIO_printf(bio_out, "Symmetric Ciphers:\n"); + list_ciphers(" "); + list_kdfs(); + list_macs(); + + BIO_printf(bio_out, "Provided Asymmetric Encryption:\n"); + list_asymciphers(); + BIO_printf(bio_out, "Provided Key Exchange:\n"); + list_keyexchanges(); + BIO_printf(bio_out, "Provided Signatures:\n"); + list_signatures(); + BIO_printf(bio_out, "Provided Key encapsulation:\n"); + list_kems(); + BIO_printf(bio_out, "Provided Key managers:\n"); + list_keymanagers(); + + list_encoders(); + list_decoders(); + list_store_loaders(); + } if (todo.random_instances) list_random_instances(); if (todo.random_generators) @@ -1659,7 +1688,7 @@ opthelp: if (todo.digest_commands) list_type(FT_md, one); if (todo.digest_algorithms) - list_digests(); + list_digests(""); if (todo.kdf_algorithms) list_kdfs(); if (todo.mac_algorithms) @@ -1667,7 +1696,7 @@ opthelp: if (todo.cipher_commands) list_type(FT_cipher, one); if (todo.cipher_algorithms) - list_ciphers(); + list_ciphers(""); if (todo.encoder_algorithms) list_encoders(); if (todo.decoder_algorithms) |