Add OSSL_DECODER_description() and OSSL_ENCODER_description()
authorRichard Levitte <levitte@openssl.org>
Tue, 16 Mar 2021 13:21:42 +0000 (14:21 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 2 Apr 2021 06:57:47 +0000 (08:57 +0200)
Fixes #14514

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14656)

crypto/encode_decode/decoder_meth.c
crypto/encode_decode/encoder_meth.c
doc/man3/OSSL_DECODER.pod
doc/man3/OSSL_ENCODER.pod
include/openssl/decoder.h
include/openssl/encoder.h
util/libcrypto.num

index b0965cf29380d5b98e00b2eea9763ad378f5ee79..7f8a365b66778d7da11743b11fbb78c4cb250cdd 100644 (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) {
index 81a22508d6ec1efb060ed6317484769aba1a01a4..de0a66578cddad03831213666ae676fd8564691c 100644 (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) {
index 289cf1bd84b652ab4ddf0b224de4552dab39414c..45a97454e9d73d469add2c550136f9f075434947 100644 (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.
 
index 8515ff12f51fe941501a7b8690943688bdaba33f..abaee0f997965dfaef18eddbeadfb8fa9a70b591 100644 (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.
 
index fd7e7b52c761625e80652cf24246d6a8edca82aa..974fbb02ad65d6e2ba984f624c2042c544dd4675 100644 (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,
index c533efa3ec51a3c1bed654106f3bed5090750d49..c51bd02a2b3509b258765532c55d21206cc9899f 100644 (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,
index b968e0da1fcd3bf8956842343a1f3fba6d9be48d..203d50263b448301bc45fab8fdb2e738d1229552 100644 (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: