summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/encode_decode/decoder_meth.c10
-rw-r--r--crypto/encode_decode/encoder_local.h1
-rw-r--r--crypto/encode_decode/encoder_meth.c10
-rw-r--r--include/openssl/decoder.h1
-rw-r--r--include/openssl/encoder.h1
5 files changed, 23 insertions, 0 deletions
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/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);