From: Richard Levitte Date: Tue, 16 Mar 2021 13:21:42 +0000 (+0100) Subject: Add OSSL_DECODER_description() and OSSL_ENCODER_description() X-Git-Tag: openssl-3.0.0-alpha14~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1010884e0a6d391d3628ffdb057f1812ef08ed73;p=thirdparty%2Fopenssl.git Add OSSL_DECODER_description() and OSSL_ENCODER_description() Fixes #14514 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14656) --- diff --git a/crypto/encode_decode/decoder_meth.c b/crypto/encode_decode/decoder_meth.c index b0965cf2938..7f8a365b667 100644 --- a/crypto/encode_decode/decoder_meth.c +++ b/crypto/encode_decode/decoder_meth.c @@ -425,6 +425,11 @@ int OSSL_DECODER_number(const OSSL_DECODER *decoder) return decoder->base.id; } +const char *OSSL_DECODER_description(const OSSL_DECODER *decoder) +{ + return decoder->base.description; +} + int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name) { if (decoder->base.prov != NULL) { diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c index 81a22508d6e..de0a66578cd 100644 --- a/crypto/encode_decode/encoder_meth.c +++ b/crypto/encode_decode/encoder_meth.c @@ -437,6 +437,11 @@ int OSSL_ENCODER_number(const OSSL_ENCODER *encoder) return encoder->base.id; } +const char *OSSL_ENCODER_description(const OSSL_ENCODER *encoder) +{ + return encoder->base.description; +} + int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name) { if (encoder->base.prov != NULL) { diff --git a/doc/man3/OSSL_DECODER.pod b/doc/man3/OSSL_DECODER.pod index 289cf1bd84b..45a97454e9d 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_description, OSSL_DECODER_do_all_provided, OSSL_DECODER_names_do_all, OSSL_DECODER_gettable_params, @@ -30,6 +31,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_description(const OSSL_DECODER *decoder); void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx, void (*fn)(OSSL_DECODER *decoder, void *arg), void *arg); @@ -72,6 +74,10 @@ of an algorithm that's identifiable with I. OSSL_DECODER_number() returns the internal dynamic number assigned to the given I. +OSSL_DECODER_description() returns a description of the I, meant +for display and human consumption. The description is at the discretion +of the I implementation. + OSSL_DECODER_names_do_all() traverses all names for the given I, and calls I with each name and I as arguments. @@ -107,6 +113,9 @@ otherwise 0. OSSL_DECODER_number() returns an integer. +OSSL_DECODER_description() returns a pointer to a decription, or NULL if +there isn't one. + OSSL_DECODER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names. diff --git a/doc/man3/OSSL_ENCODER.pod b/doc/man3/OSSL_ENCODER.pod index 8515ff12f51..abaee0f9979 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_description, OSSL_ENCODER_do_all_provided, OSSL_ENCODER_names_do_all, OSSL_ENCODER_gettable_params, @@ -30,6 +31,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_description(const OSSL_ENCODER *encoder); void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx, void (*fn)(OSSL_ENCODER *encoder, void *arg), void *arg); @@ -72,6 +74,10 @@ algorithm that's identifiable with I. OSSL_ENCODER_number() returns the internal dynamic number assigned to the given I. +OSSL_ENCODER_description() returns a description of the I, meant +for display and human consumption. The description is at the discretion of the +I implementation. + OSSL_ENCODER_names_do_all() traverses all names for the given I, and calls I with each name and I as arguments. @@ -108,6 +114,9 @@ otherwise 0. OSSL_ENCODER_number() returns an integer. +OSSL_ENCODER_description() returns a pointer to a decription, or NULL if +there isn't one. + OSSL_ENCODER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names. diff --git a/include/openssl/decoder.h b/include/openssl/decoder.h index fd7e7b52c76..974fbb02ad6 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_description(const OSSL_DECODER *decoder); int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name); void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx, diff --git a/include/openssl/encoder.h b/include/openssl/encoder.h index c533efa3ec5..c51bd02a2b3 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_description(const OSSL_ENCODER *kdf); int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name); void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx, diff --git a/util/libcrypto.num b/util/libcrypto.num index b968e0da1fc..203d50263b4 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -5333,3 +5333,5 @@ 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_description ? 3_0_0 EXIST::FUNCTION: +OSSL_ENCODER_description ? 3_0_0 EXIST::FUNCTION: