summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-03-16 14:45:07 +0100
committerRichard Levitte <levitte@openssl.org>2021-04-02 08:57:47 +0200
commitbaf02793fc5b5095ad8929b8e2aae679e113f457 (patch)
treed3b61d638752c2f8c6cfc4a440f21f2c12299bd1 /apps
parent03888233290bf3b8410e8dc2acbef8950fffef60 (diff)
APPS: Replace the use of OBJ_nid2ln() with name or description calls
With new provided algorithms added, we'd rather rely on the names and descriptions that we get from the providers. Specifically with the 'openssl list' command, we now display the description of all algorithms. For '-public-key-algorithms', we additionally print key type information a bit more like we do for legacy methods. We also add descriptions to all our keymgmt functions, because the built in EVP_PKEY_ASN1_METHODs had them. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14656)
Diffstat (limited to 'apps')
-rw-r--r--apps/list.c64
1 files changed, 58 insertions, 6 deletions
diff --git a/apps/list.c b/apps/list.c
index 5326a4b367..df87880ba7 100644
--- a/apps/list.c
+++ b/apps/list.c
@@ -96,15 +96,19 @@ static void list_ciphers(void)
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
- OSSL_PROVIDER_name(EVP_CIPHER_provider(c)));
+ OSSL_PROVIDER_name(EVP_CIPHER_provider(c)));
if (verbose) {
+ const char *desc = EVP_CIPHER_description(c);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("retrievable algorithm parameters",
- EVP_CIPHER_gettable_params(c), 4);
+ EVP_CIPHER_gettable_params(c), 4);
print_param_types("retrievable operation parameters",
- EVP_CIPHER_gettable_ctx_params(c), 4);
+ EVP_CIPHER_gettable_ctx_params(c), 4);
print_param_types("settable operation parameters",
- EVP_CIPHER_settable_ctx_params(c), 4);
+ EVP_CIPHER_settable_ctx_params(c), 4);
}
}
sk_OPENSSL_CSTRING_free(names);
@@ -176,6 +180,10 @@ static void list_digests(void)
BIO_printf(bio_out, " @ %s\n", OSSL_PROVIDER_name(EVP_MD_provider(m)));
if (verbose) {
+ const char *desc = EVP_MD_description(m);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("retrievable algorithm parameters",
EVP_MD_gettable_params(m), 4);
print_param_types("retrievable operation parameters",
@@ -236,6 +244,10 @@ static void list_macs(void)
BIO_printf(bio_out, " @ %s\n", OSSL_PROVIDER_name(EVP_MAC_provider(m)));
if (verbose) {
+ const char *desc = EVP_MAC_description(m);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("retrievable algorithm parameters",
EVP_MAC_gettable_params(m), 4);
print_param_types("retrievable operation parameters",
@@ -299,6 +311,10 @@ static void list_kdfs(void)
BIO_printf(bio_out, " @ %s\n", OSSL_PROVIDER_name(EVP_KDF_provider(k)));
if (verbose) {
+ const char *desc = EVP_KDF_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("retrievable algorithm parameters",
EVP_KDF_gettable_params(k), 4);
print_param_types("retrievable operation parameters",
@@ -358,6 +374,10 @@ static void list_random_generators(void)
BIO_printf(bio_out, " @ %s\n", OSSL_PROVIDER_name(EVP_RAND_provider(m)));
if (verbose) {
+ const char *desc = EVP_RAND_description(m);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("retrievable algorithm parameters",
EVP_RAND_gettable_params(m), 4);
print_param_types("retrievable operation parameters",
@@ -491,6 +511,10 @@ static void list_encoders(void)
OSSL_ENCODER_properties(k));
if (verbose) {
+ const char *desc = OSSL_ENCODER_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("settable operation parameters",
OSSL_ENCODER_settable_ctx_params(k), 4);
}
@@ -555,6 +579,10 @@ static void list_decoders(void)
OSSL_DECODER_properties(k));
if (verbose) {
+ const char *desc = OSSL_DECODER_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("settable operation parameters",
OSSL_DECODER_settable_ctx_params(k), 4);
}
@@ -601,9 +629,17 @@ static void list_keymanagers(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_KEYMGMT_names_do_all(k, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ const char *desc = EVP_KEYMGMT_description(k);
+
+ BIO_printf(bio_out, " Name: ");
+ if (desc != NULL)
+ BIO_printf(bio_out, "%s", desc);
+ else
+ BIO_printf(bio_out, "%s", sk_OPENSSL_CSTRING_value(names, 0));
+ BIO_printf(bio_out, "\n");
+ BIO_printf(bio_out, " Type: Provider Algorithm\n");
+ BIO_printf(bio_out, " IDs: ");
print_names(bio_out, names);
-
BIO_printf(bio_out, " @ %s\n",
OSSL_PROVIDER_name(EVP_KEYMGMT_provider(k)));
@@ -666,6 +702,10 @@ static void list_signatures(void)
OSSL_PROVIDER_name(EVP_SIGNATURE_provider(k)));
if (verbose) {
+ const char *desc = EVP_SIGNATURE_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("settable operation parameters",
EVP_SIGNATURE_settable_ctx_params(k), 4);
print_param_types("retrievable operation parameters",
@@ -723,6 +763,10 @@ static void list_kems(void)
BIO_printf(bio_out, " @ %s\n", OSSL_PROVIDER_name(EVP_KEM_provider(k)));
if (verbose) {
+ const char *desc = EVP_KEM_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("settable operation parameters",
EVP_KEM_settable_ctx_params(k), 4);
print_param_types("retrievable operation parameters",
@@ -783,6 +827,10 @@ static void list_asymciphers(void)
OSSL_PROVIDER_name(EVP_ASYM_CIPHER_provider(k)));
if (verbose) {
+ const char *desc = EVP_ASYM_CIPHER_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("settable operation parameters",
EVP_ASYM_CIPHER_settable_ctx_params(k), 4);
print_param_types("retrievable operation parameters",
@@ -841,6 +889,10 @@ static void list_keyexchanges(void)
OSSL_PROVIDER_name(EVP_KEYEXCH_provider(k)));
if (verbose) {
+ const char *desc = EVP_KEYEXCH_description(k);
+
+ if (desc != NULL)
+ BIO_printf(bio_out, " description: %s\n", desc);
print_param_types("settable operation parameters",
EVP_KEYEXCH_settable_ctx_params(k), 4);
print_param_types("retrievable operation parameters",