[openssl] master update

Dr. Paul Dale pauli at openssl.org
Wed May 12 08:42:02 UTC 2021


The branch master has been updated
       via  b5d984bf67ba7bb5723a61f73cca89c1f86009ce (commit)
       via  482e6693b436e2de31a7c20d03fc73398b04767f (commit)
       via  4966411789f9337b311eacb5c45ddd3e750d4c17 (commit)
       via  b33774137202aff34a91a8caf47cc74cc35386de (commit)
      from  63ac53aa51f326f6599573f597957be7114ec139 (commit)


- Log -----------------------------------------------------------------
commit b5d984bf67ba7bb5723a61f73cca89c1f86009ce
Author: Pauli <pauli at openssl.org>
Date:   Mon May 10 15:55:13 2021 +1000

    apps: make list -help not continue with listing
    
    All the commands return after printing their help.  List doesn't.
    This brings them in line.
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15211)

commit 482e6693b436e2de31a7c20d03fc73398b04767f
Author: Pauli <pauli at openssl.org>
Date:   Mon May 10 12:12:38 2021 +1000

    apps: change list command to only list fetchable algorithms.
    
    The -propquery option will work with this change.  By default the output will
    be the same.
    
    Also address some inconsistencies in the code with respects to error checking.
    
    Fixes #15196
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15211)

commit 4966411789f9337b311eacb5c45ddd3e750d4c17
Author: Pauli <pauli at openssl.org>
Date:   Mon May 10 13:05:08 2021 +1000

    encoder: add a _name() function for encoders and decoders
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15211)

commit b33774137202aff34a91a8caf47cc74cc35386de
Author: Pauli <pauli at openssl.org>
Date:   Mon May 10 12:57:33 2021 +1000

    doc: document the encoder and decoder name functions
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15211)

-----------------------------------------------------------------------

Summary of changes:
 apps/list.c                          | 144 +++++++++++++++++++++++++----------
 crypto/encode_decode/decoder_meth.c  |  10 +++
 crypto/encode_decode/encoder_local.h |   1 +
 crypto/encode_decode/encoder_meth.c  |  10 +++
 doc/man3/OSSL_DECODER.pod            |  10 +++
 doc/man3/OSSL_ENCODER.pod            |  10 +++
 include/openssl/decoder.h            |   1 +
 include/openssl/encoder.h            |   1 +
 util/libcrypto.num                   |   2 +
 9 files changed, 147 insertions(+), 42 deletions(-)

diff --git a/apps/list.c b/apps/list.c
index a8646addb1..bf7c9b1049 100644
--- a/apps/list.c
+++ b/apps/list.c
@@ -29,6 +29,41 @@
 static int verbose = 0;
 static const char *select_name = NULL;
 
+/* Checks to see if algorithms are fetchable */
+#define IS_FETCHABLE(type, TYPE)                                \
+    static int is_ ## type ## _fetchable(const TYPE *alg)       \
+    {                                                           \
+        TYPE *impl;                                             \
+        const char *propq = app_get0_propq();                   \
+        const char *name = TYPE ## _name(alg);                  \
+                                                                \
+        ERR_set_mark();                                         \
+        impl = TYPE ## _fetch(NULL, name, propq);               \
+        ERR_pop_to_mark();                                      \
+        if (impl == NULL)                                       \
+            return 0;                                           \
+        TYPE ## _free(impl);                                    \
+        return 1;                                               \
+    }
+IS_FETCHABLE(cipher, EVP_CIPHER)
+IS_FETCHABLE(digest, EVP_MD)
+IS_FETCHABLE(mac, EVP_MAC)
+IS_FETCHABLE(kdf, EVP_KDF)
+IS_FETCHABLE(rand, EVP_RAND)
+IS_FETCHABLE(keymgmt, EVP_KEYMGMT)
+IS_FETCHABLE(signature, EVP_SIGNATURE)
+IS_FETCHABLE(kem, EVP_KEM)
+IS_FETCHABLE(asym_cipher, EVP_ASYM_CIPHER)
+IS_FETCHABLE(keyexch, EVP_KEYEXCH)
+IS_FETCHABLE(decoder, OSSL_DECODER)
+IS_FETCHABLE(encoder, OSSL_ENCODER)
+
+#ifndef OPENSSL_NO_DEPRECATED_3_0
+static int include_legacy(void)
+{
+    return app_get0_propq() == NULL;
+}
+
 static void legacy_cipher_fn(const EVP_CIPHER *c,
                              const char *from, const char *to, void *arg)
 {
@@ -46,6 +81,7 @@ static void legacy_cipher_fn(const EVP_CIPHER *c,
         BIO_printf(arg, "  %s => %s\n", from, to);
     }
 }
+#endif
 
 DEFINE_STACK_OF(EVP_CIPHER)
 static int cipher_cmp(const EVP_CIPHER * const *a,
@@ -64,7 +100,8 @@ static void collect_ciphers(EVP_CIPHER *cipher, void *stack)
 {
     STACK_OF(EVP_CIPHER) *cipher_stack = stack;
 
-    if (sk_EVP_CIPHER_push(cipher_stack, cipher) > 0)
+    if (is_cipher_fetchable(cipher)
+            && sk_EVP_CIPHER_push(cipher_stack, cipher) > 0)
         EVP_CIPHER_up_ref(cipher);
 }
 
@@ -77,8 +114,12 @@ static void list_ciphers(void)
         BIO_printf(bio_err, "ERROR: Memory allocation\n");
         return;
     }
-    BIO_printf(bio_out, "Legacy:\n");
-    EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out);
+#ifndef OPENSSL_NO_DEPRECATED_3_0
+    if (include_legacy()) {
+        BIO_printf(bio_out, "Legacy:\n");
+        EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out);
+    }
+#endif
 
     BIO_printf(bio_out, "Provided:\n");
     EVP_CIPHER_do_all_provided(NULL, collect_ciphers, ciphers);
@@ -116,7 +157,8 @@ static void list_ciphers(void)
     sk_EVP_CIPHER_pop_free(ciphers, EVP_CIPHER_free);
 }
 
-static void list_md_fn(const EVP_MD *m,
+#ifndef OPENSSL_NO_DEPRECATED_3_0
+static void legacy_md_fn(const EVP_MD *m,
                        const char *from, const char *to, void *arg)
 {
     if (m != NULL) {
@@ -129,6 +171,7 @@ static void list_md_fn(const EVP_MD *m,
         BIO_printf((BIO *)arg, "  %s => %s\n", from, to);
     }
 }
+#endif
 
 DEFINE_STACK_OF(EVP_MD)
 static int md_cmp(const EVP_MD * const *a, const EVP_MD * const *b)
@@ -142,12 +185,13 @@ static int md_cmp(const EVP_MD * const *a, const EVP_MD * const *b)
     return ret;
 }
 
-static void collect_digests(EVP_MD *md, void *stack)
+static void collect_digests(EVP_MD *digest, void *stack)
 {
     STACK_OF(EVP_MD) *digest_stack = stack;
 
-    if (sk_EVP_MD_push(digest_stack, md) > 0)
-        EVP_MD_up_ref(md);
+    if (is_digest_fetchable(digest)
+            && sk_EVP_MD_push(digest_stack, digest) > 0)
+        EVP_MD_up_ref(digest);
 }
 
 static void list_digests(void)
@@ -159,8 +203,12 @@ static void list_digests(void)
         BIO_printf(bio_err, "ERROR: Memory allocation\n");
         return;
     }
-    BIO_printf(bio_out, "Legacy:\n");
-    EVP_MD_do_all_sorted(list_md_fn, bio_out);
+#ifndef OPENSSL_NO_DEPRECATED_3_0
+    if (include_legacy()) {
+        BIO_printf(bio_out, "Legacy:\n");
+        EVP_MD_do_all_sorted(legacy_md_fn, bio_out);
+    }
+#endif
 
     BIO_printf(bio_out, "Provided:\n");
     EVP_MD_do_all_provided(NULL, collect_digests, digests);
@@ -213,7 +261,8 @@ static void collect_macs(EVP_MAC *mac, void *stack)
 {
     STACK_OF(EVP_MAC) *mac_stack = stack;
 
-    if (sk_EVP_MAC_push(mac_stack, mac) > 0)
+    if (is_mac_fetchable(mac)
+            && sk_EVP_MAC_push(mac_stack, mac) > 0)
         EVP_MAC_up_ref(mac);
 }
 
@@ -280,8 +329,9 @@ static void collect_kdfs(EVP_KDF *kdf, void *stack)
 {
     STACK_OF(EVP_KDF) *kdf_stack = stack;
 
-    sk_EVP_KDF_push(kdf_stack, kdf);
-    EVP_KDF_up_ref(kdf);
+    if (is_kdf_fetchable(kdf)
+            && sk_EVP_KDF_push(kdf_stack, kdf) > 0)
+        EVP_KDF_up_ref(kdf);
 }
 
 static void list_kdfs(void)
@@ -348,8 +398,9 @@ static void collect_rands(EVP_RAND *rand, void *stack)
 {
     STACK_OF(EVP_RAND) *rand_stack = stack;
 
-    sk_EVP_RAND_push(rand_stack, rand);
-    EVP_RAND_up_ref(rand);
+    if (is_rand_fetchable(rand)
+            && sk_EVP_RAND_push(rand_stack, rand) > 0)
+        EVP_RAND_up_ref(rand);
 }
 
 static void list_random_generators(void)
@@ -476,8 +527,9 @@ static void collect_encoders(OSSL_ENCODER *encoder, void *stack)
 {
     STACK_OF(OSSL_ENCODER) *encoder_stack = stack;
 
-    sk_OSSL_ENCODER_push(encoder_stack, encoder);
-    OSSL_ENCODER_up_ref(encoder);
+    if (is_encoder_fetchable(encoder)
+            && sk_OSSL_ENCODER_push(encoder_stack, encoder) > 0)
+        OSSL_ENCODER_up_ref(encoder);
 }
 
 static void list_encoders(void)
@@ -543,8 +595,9 @@ static void collect_decoders(OSSL_DECODER *decoder, void *stack)
 {
     STACK_OF(OSSL_DECODER) *decoder_stack = stack;
 
-    sk_OSSL_DECODER_push(decoder_stack, decoder);
-    OSSL_DECODER_up_ref(decoder);
+    if (is_decoder_fetchable(decoder)
+            && sk_OSSL_DECODER_push(decoder_stack, decoder) > 0)
+        OSSL_DECODER_up_ref(decoder);
 }
 
 static void list_decoders(void)
@@ -608,8 +661,9 @@ static void collect_keymanagers(EVP_KEYMGMT *km, void *stack)
 {
     STACK_OF(EVP_KEYMGMT) *km_stack = stack;
 
-    sk_EVP_KEYMGMT_push(km_stack, km);
-    EVP_KEYMGMT_up_ref(km);
+    if (is_keymgmt_fetchable(km)
+            && sk_EVP_KEYMGMT_push(km_stack, km) > 0)
+        EVP_KEYMGMT_up_ref(km);
 }
 
 static void list_keymanagers(void)
@@ -669,12 +723,13 @@ static int signature_cmp(const EVP_SIGNATURE * const *a,
     return ret;
 }
 
-static void collect_signatures(EVP_SIGNATURE *km, void *stack)
+static void collect_signatures(EVP_SIGNATURE *sig, void *stack)
 {
-    STACK_OF(EVP_SIGNATURE) *km_stack = stack;
+    STACK_OF(EVP_SIGNATURE) *sig_stack = stack;
 
-    sk_EVP_SIGNATURE_push(km_stack, km);
-    EVP_SIGNATURE_up_ref(km);
+    if (is_signature_fetchable(sig)
+            && sk_EVP_SIGNATURE_push(sig_stack, sig) > 0)
+        EVP_SIGNATURE_up_ref(sig);
 }
 
 static void list_signatures(void)
@@ -731,12 +786,13 @@ static int kem_cmp(const EVP_KEM * const *a,
     return ret;
 }
 
-static void collect_kem(EVP_KEM *km, void *stack)
+static void collect_kem(EVP_KEM *kem, void *stack)
 {
-    STACK_OF(EVP_KEM) *km_stack = stack;
+    STACK_OF(EVP_KEM) *kem_stack = stack;
 
-    sk_EVP_KEM_push(km_stack, km);
-    EVP_KEM_up_ref(km);
+    if (is_kem_fetchable(kem)
+            && sk_EVP_KEM_push(kem_stack, kem) > 0)
+        EVP_KEM_up_ref(kem);
 }
 
 static void list_kems(void)
@@ -792,12 +848,13 @@ static int asymcipher_cmp(const EVP_ASYM_CIPHER * const *a,
     return ret;
 }
 
-static void collect_asymciph(EVP_ASYM_CIPHER *km, void *stack)
+static void collect_asymciph(EVP_ASYM_CIPHER *asym_cipher, void *stack)
 {
-    STACK_OF(EVP_ASYM_CIPHER) *km_stack = stack;
+    STACK_OF(EVP_ASYM_CIPHER) *asym_cipher_stack = stack;
 
-    sk_EVP_ASYM_CIPHER_push(km_stack, km);
-    EVP_ASYM_CIPHER_up_ref(km);
+    if (is_asym_cipher_fetchable(asym_cipher)
+            && sk_EVP_ASYM_CIPHER_push(asym_cipher_stack, asym_cipher) > 0)
+        EVP_ASYM_CIPHER_up_ref(asym_cipher);
 }
 
 static void list_asymciphers(void)
@@ -856,12 +913,13 @@ static int kex_cmp(const EVP_KEYEXCH * const *a,
     return ret;
 }
 
-static void collect_kex(EVP_KEYEXCH *ke, void *stack)
+static void collect_kex(EVP_KEYEXCH *kex, void *stack)
 {
     STACK_OF(EVP_KEYEXCH) *kex_stack = stack;
 
-    sk_EVP_KEYEXCH_push(kex_stack, ke);
-    EVP_KEYEXCH_up_ref(ke);
+    if (is_keyexch_fetchable(kex)
+            && sk_EVP_KEYEXCH_push(kex_stack, kex) > 0)
+        EVP_KEYEXCH_up_ref(kex);
 }
 
 static void list_keyexchanges(void)
@@ -1012,33 +1070,35 @@ static void list_options_for_command(const char *command)
 static int is_md_available(const char *name)
 {
     EVP_MD *md;
+    const char *propq = app_get0_propq();
 
     /* Look through providers' digests */
     ERR_set_mark();
-    md = EVP_MD_fetch(NULL, name, NULL);
+    md = EVP_MD_fetch(NULL, name, propq);
     ERR_pop_to_mark();
     if (md != NULL) {
         EVP_MD_free(md);
         return 1;
     }
 
-    return (get_digest_from_engine(name) == NULL) ? 0 : 1;
+    return propq != NULL || get_digest_from_engine(name) == NULL ? 0 : 1;
 }
 
 static int is_cipher_available(const char *name)
 {
     EVP_CIPHER *cipher;
+    const char *propq = app_get0_propq();
 
     /* Look through providers' ciphers */
     ERR_set_mark();
-    cipher = EVP_CIPHER_fetch(NULL, name, NULL);
+    cipher = EVP_CIPHER_fetch(NULL, name, propq);
     ERR_pop_to_mark();
     if (cipher != NULL) {
         EVP_CIPHER_free(cipher);
         return 1;
     }
 
-    return (get_cipher_from_engine(name) == NULL) ? 0 : 1;
+    return propq != NULL || get_cipher_from_engine(name) == NULL ? 0 : 1;
 }
 
 static void list_type(FUNC_TYPE ft, int one)
@@ -1084,7 +1144,7 @@ static void list_pkey(void)
 #ifndef OPENSSL_NO_DEPRECATED_3_0
     int i;
 
-    if (select_name == NULL) {
+    if (select_name == NULL && include_legacy()) {
         BIO_printf(bio_out, "Legacy:\n");
         for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
             const EVP_PKEY_ASN1_METHOD *ameth;
@@ -1121,7 +1181,7 @@ static void list_pkey_meth(void)
     size_t i;
     size_t meth_count = EVP_PKEY_meth_get_count();
 
-    if (select_name == NULL) {
+    if (select_name == NULL && include_legacy()) {
         BIO_printf(bio_out, "Legacy:\n");
         for (i = 0; i < meth_count; i++) {
             const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
@@ -1500,7 +1560,7 @@ opthelp:
             return 1;
         case OPT_HELP:
             opt_help(list_options);
-            break;
+            return 0;
         case OPT_ONE:
             one = 1;
             break;
diff --git a/crypto/encode_decode/decoder_meth.c b/crypto/encode_decode/decoder_meth.c
index 7a271f7408..48a52c9612 100644
--- a/crypto/encode_decode/decoder_meth.c
+++ b/crypto/encode_decode/decoder_meth.c
@@ -58,6 +58,7 @@ void OSSL_DECODER_free(OSSL_DECODER *decoder)
     CRYPTO_DOWN_REF(&decoder->base.refcnt, &ref, decoder->base.lock);
     if (ref > 0)
         return;
+    OPENSSL_free(decoder->base.name);
     ossl_provider_free(decoder->base.prov);
     CRYPTO_THREAD_lock_free(decoder->base.lock);
     OPENSSL_free(decoder);
@@ -169,6 +170,10 @@ void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
     if ((decoder = ossl_decoder_new()) == NULL)
         return NULL;
     decoder->base.id = id;
+    if ((decoder->base.name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
+        OSSL_DECODER_free(decoder);
+        return NULL;
+    }
     decoder->base.propdef = algodef->property_definition;
     decoder->base.description = algodef->algorithm_description;
 
@@ -426,6 +431,11 @@ int OSSL_DECODER_number(const OSSL_DECODER *decoder)
     return decoder->base.id;
 }
 
+const char *OSSL_DECODER_name(const OSSL_DECODER *decoder)
+{
+    return decoder->base.name;
+}
+
 const char *OSSL_DECODER_description(const OSSL_DECODER *decoder)
 {
     return decoder->base.description;
diff --git a/crypto/encode_decode/encoder_local.h b/crypto/encode_decode/encoder_local.h
index c58362ae02..d53f760379 100644
--- a/crypto/encode_decode/encoder_local.h
+++ b/crypto/encode_decode/encoder_local.h
@@ -19,6 +19,7 @@
 struct ossl_endecode_base_st {
     OSSL_PROVIDER *prov;
     int id;
+    char *name;
     const char *propdef;
     const char *description;
 
diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c
index bb319460b9..3b2bc2d83e 100644
--- a/crypto/encode_decode/encoder_meth.c
+++ b/crypto/encode_decode/encoder_meth.c
@@ -58,6 +58,7 @@ void OSSL_ENCODER_free(OSSL_ENCODER *encoder)
     CRYPTO_DOWN_REF(&encoder->base.refcnt, &ref, encoder->base.lock);
     if (ref > 0)
         return;
+    OPENSSL_free(encoder->base.name);
     ossl_provider_free(encoder->base.prov);
     CRYPTO_THREAD_lock_free(encoder->base.lock);
     OPENSSL_free(encoder);
@@ -169,6 +170,10 @@ static void *encoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
     if ((encoder = ossl_encoder_new()) == NULL)
         return NULL;
     encoder->base.id = id;
+    if ((encoder->base.name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
+        OSSL_ENCODER_free(encoder);
+        return NULL;
+    }
     encoder->base.propdef = algodef->property_definition;
     encoder->base.description = algodef->algorithm_description;
 
@@ -438,6 +443,11 @@ int OSSL_ENCODER_number(const OSSL_ENCODER *encoder)
     return encoder->base.id;
 }
 
+const char *OSSL_ENCODER_name(const OSSL_ENCODER *encoder)
+{
+    return encoder->base.name;
+}
+
 const char *OSSL_ENCODER_description(const OSSL_ENCODER *encoder)
 {
     return encoder->base.description;
diff --git a/doc/man3/OSSL_DECODER.pod b/doc/man3/OSSL_DECODER.pod
index 45a97454e9..fed0da27f8 100644
--- a/doc/man3/OSSL_DECODER.pod
+++ b/doc/man3/OSSL_DECODER.pod
@@ -10,6 +10,7 @@ OSSL_DECODER_provider,
 OSSL_DECODER_properties,
 OSSL_DECODER_is_a,
 OSSL_DECODER_number,
+OSSL_DECODER_name,
 OSSL_DECODER_description,
 OSSL_DECODER_do_all_provided,
 OSSL_DECODER_names_do_all,
@@ -31,6 +32,7 @@ OSSL_DECODER_get_params
  const char *OSSL_DECODER_properties(const OSSL_DECODER *decoder);
  int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name);
  int OSSL_DECODER_number(const OSSL_DECODER *decoder);
+ const char *OSSL_DECODER_name(const OSSL_DECODER *decoder);
  const char *OSSL_DECODER_description(const OSSL_DECODER *decoder);
  void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
                                    void (*fn)(OSSL_DECODER *decoder, void *arg),
@@ -74,6 +76,8 @@ of an algorithm that's identifiable with I<name>.
 OSSL_DECODER_number() returns the internal dynamic number assigned
 to the given I<decoder>.
 
+OSSL_DECODER_number() returns the name used to fetch the given I<decoder>.
+
 OSSL_DECODER_description() returns a description of the I<decoder>, meant
 for display and human consumption.  The description is at the discretion
 of the I<decoder> implementation.
@@ -113,6 +117,12 @@ otherwise 0.
 
 OSSL_DECODER_number() returns an integer.
 
+OSSL_DECODER_name() returns the algorithm name from the provided
+implementation for the given I<decoder>. Note that the I<decoder> may have
+multiple synonyms associated with it. In this case the first name from the
+algorithm definition is returned. Ownership of the returned string is retained
+by the I<decoder> object and should not be freed by the caller.
+
 OSSL_DECODER_description() returns a pointer to a decription, or NULL if
 there isn't one.
 
diff --git a/doc/man3/OSSL_ENCODER.pod b/doc/man3/OSSL_ENCODER.pod
index abaee0f997..9ad335653e 100644
--- a/doc/man3/OSSL_ENCODER.pod
+++ b/doc/man3/OSSL_ENCODER.pod
@@ -10,6 +10,7 @@ OSSL_ENCODER_provider,
 OSSL_ENCODER_properties,
 OSSL_ENCODER_is_a,
 OSSL_ENCODER_number,
+OSSL_ENCODER_name,
 OSSL_ENCODER_description,
 OSSL_ENCODER_do_all_provided,
 OSSL_ENCODER_names_do_all,
@@ -31,6 +32,7 @@ OSSL_ENCODER_get_params
  const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder);
  int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
  int OSSL_ENCODER_number(const OSSL_ENCODER *encoder);
+ const char *OSSL_ENCODER_name(const OSSL_ENCODER *encoder);
  const char *OSSL_ENCODER_description(const OSSL_ENCODER *encoder);
  void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
                                    void (*fn)(OSSL_ENCODER *encoder, void *arg),
@@ -74,6 +76,8 @@ algorithm that's identifiable with I<name>.
 OSSL_ENCODER_number() returns the internal dynamic number assigned to
 the given I<encoder>.
 
+OSSL_ENCODER_number() returns the name used to fetch the given I<encoder>.
+
 OSSL_ENCODER_description() returns a description of the I<loader>, meant
 for display and human consumption.  The description is at the discretion of the
 I<loader> implementation.
@@ -114,6 +118,12 @@ otherwise 0.
 
 OSSL_ENCODER_number() returns an integer.
 
+OSSL_ENCODER_name() returns the algorithm name from the provided
+implementation for the given I<encoder>. Note that the I<encoder> may have
+multiple synonyms associated with it. In this case the first name from the
+algorithm definition is returned. Ownership of the returned string is retained
+by the I<encoder> object and should not be freed by the caller.
+
 OSSL_ENCODER_description() returns a pointer to a decription, or NULL if
 there isn't one.
 
diff --git a/include/openssl/decoder.h b/include/openssl/decoder.h
index 974fbb02ad..afe4988fdb 100644
--- a/include/openssl/decoder.h
+++ b/include/openssl/decoder.h
@@ -34,6 +34,7 @@ void OSSL_DECODER_free(OSSL_DECODER *encoder);
 const OSSL_PROVIDER *OSSL_DECODER_provider(const OSSL_DECODER *encoder);
 const char *OSSL_DECODER_properties(const OSSL_DECODER *encoder);
 int OSSL_DECODER_number(const OSSL_DECODER *encoder);
+const char *OSSL_DECODER_name(const OSSL_DECODER *decoder);
 const char *OSSL_DECODER_description(const OSSL_DECODER *decoder);
 int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name);
 
diff --git a/include/openssl/encoder.h b/include/openssl/encoder.h
index c51bd02a2b..4e2c5fe23c 100644
--- a/include/openssl/encoder.h
+++ b/include/openssl/encoder.h
@@ -34,6 +34,7 @@ void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
 const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder);
 const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder);
 int OSSL_ENCODER_number(const OSSL_ENCODER *encoder);
+const char *OSSL_ENCODER_name(const OSSL_ENCODER *kdf);
 const char *OSSL_ENCODER_description(const OSSL_ENCODER *kdf);
 int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
 
diff --git a/util/libcrypto.num b/util/libcrypto.num
index a99b5aa047..857ed43a52 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -5341,6 +5341,8 @@ X509_REQ_new_ex                         ?	3_0_0	EXIST::FUNCTION:
 EVP_PKEY_dup                            ?	3_0_0	EXIST::FUNCTION:
 RSA_PSS_PARAMS_dup                      ?	3_0_0	EXIST::FUNCTION:
 EVP_PKEY_derive_set_peer_ex             ?	3_0_0	EXIST::FUNCTION:
+OSSL_DECODER_name                       ?	3_0_0	EXIST::FUNCTION:
+OSSL_ENCODER_name                       ?	3_0_0	EXIST::FUNCTION:
 OSSL_DECODER_description                ?	3_0_0	EXIST::FUNCTION:
 OSSL_ENCODER_description                ?	3_0_0	EXIST::FUNCTION:
 OSSL_STORE_LOADER_description           ?	3_0_0	EXIST::FUNCTION:


More information about the openssl-commits mailing list