diff options
author | Pauli <pauli@openssl.org> | 2021-05-10 13:05:08 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-05-12 18:40:57 +1000 |
commit | 4966411789f9337b311eacb5c45ddd3e750d4c17 (patch) | |
tree | 95a0932914988eb8e0f99ac603b88ecfdb81d775 /crypto/encode_decode/decoder_meth.c | |
parent | b33774137202aff34a91a8caf47cc74cc35386de (diff) | |
download | openssl-new-4966411789f9337b311eacb5c45ddd3e750d4c17.tar.gz |
encoder: add a _name() function for encoders and decoders
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15211)
Diffstat (limited to 'crypto/encode_decode/decoder_meth.c')
-rw-r--r-- | crypto/encode_decode/decoder_meth.c | 10 |
1 files changed, 10 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; |