Add OSSL_DECODER_description() and OSSL_ENCODER_description()

Fixes #14514

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14656)
This commit is contained in:
Richard Levitte 2021-03-16 14:21:42 +01:00
parent 309a78aa30
commit 1010884e0a
7 changed files with 32 additions and 0 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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<name>.
OSSL_DECODER_number() returns the internal dynamic number assigned
to 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.
OSSL_DECODER_names_do_all() traverses all names for the given
I<decoder>, and calls I<fn> with each name and I<data> 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.

View File

@ -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<name>.
OSSL_ENCODER_number() returns the internal dynamic number assigned to
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.
OSSL_ENCODER_names_do_all() traverses all names for the given
I<encoder>, and calls I<fn> with each name and I<data> 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.

View File

@ -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,

View File

@ -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,

View File

@ -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: