diff options
author | Richard Levitte <levitte@openssl.org> | 2021-03-16 14:14:43 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-04-02 08:52:37 +0200 |
commit | 309a78aa305ee14878e453c78ccf9a7dc91264cf (patch) | |
tree | 82b3791b395f3e6557084d08cdf3058a30eb38e2 /crypto/evp | |
parent | Corrected missing definitions from NonStop SPT build. (diff) | |
download | openssl-309a78aa305ee14878e453c78ccf9a7dc91264cf.tar.xz openssl-309a78aa305ee14878e453c78ccf9a7dc91264cf.zip |
CORE: Add an algorithm_description field to OSSL_ALGORITHM
This corresponds to the |info| field in EVP_PKEY_ASN1_METHOD, as well
as the generic use of OBJ_nid2ln() as a one line description.
We also add the base functionality to make use of this field.
Fixes #14514
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14656)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/asymcipher.c | 12 | ||||
-rw-r--r-- | crypto/evp/digest.c | 12 | ||||
-rw-r--r-- | crypto/evp/evp_enc.c | 12 | ||||
-rw-r--r-- | crypto/evp/evp_fetch.c | 21 | ||||
-rw-r--r-- | crypto/evp/evp_local.h | 11 | ||||
-rw-r--r-- | crypto/evp/evp_rand.c | 13 | ||||
-rw-r--r-- | crypto/evp/exchange.c | 12 | ||||
-rw-r--r-- | crypto/evp/kdf_meth.c | 12 | ||||
-rw-r--r-- | crypto/evp/kem.c | 10 | ||||
-rw-r--r-- | crypto/evp/keymgmt_meth.c | 14 | ||||
-rw-r--r-- | crypto/evp/mac_meth.c | 12 | ||||
-rw-r--r-- | crypto/evp/signature.c | 12 |
12 files changed, 89 insertions, 64 deletions
diff --git a/crypto/evp/asymcipher.c b/crypto/evp/asymcipher.c index e74aafcb13..60f3ce67cf 100644 --- a/crypto/evp/asymcipher.c +++ b/crypto/evp/asymcipher.c @@ -274,10 +274,11 @@ static EVP_ASYM_CIPHER *evp_asym_cipher_new(OSSL_PROVIDER *prov) return cipher; } -static void *evp_asym_cipher_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_asym_cipher_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_ASYM_CIPHER *cipher = NULL; int ctxfncnt = 0, encfncnt = 0, decfncnt = 0; int gparamfncnt = 0, sparamfncnt = 0; @@ -288,6 +289,7 @@ static void *evp_asym_cipher_from_dispatch(int name_id, } cipher->name_id = name_id; + cipher->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -418,7 +420,7 @@ EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties) { return evp_generic_fetch(ctx, OSSL_OP_ASYM_CIPHER, algorithm, properties, - evp_asym_cipher_from_dispatch, + evp_asym_cipher_from_algorithm, (int (*)(void *))EVP_ASYM_CIPHER_up_ref, (void (*)(void *))EVP_ASYM_CIPHER_free); } @@ -440,7 +442,7 @@ void EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_ASYM_CIPHER, (void (*)(void *, void *))fn, arg, - evp_asym_cipher_from_dispatch, + evp_asym_cipher_from_algorithm, (void (*)(void *))EVP_ASYM_CIPHER_free); } diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 494e0f5646..2e517d2f45 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -883,10 +883,11 @@ static int evp_md_cache_constants(EVP_MD *md) return ok; } -static void *evp_md_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_md_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_MD *md = NULL; int fncnt = 0; @@ -907,6 +908,7 @@ static void *evp_md_from_dispatch(int name_id, #endif md->name_id = name_id; + md->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -1017,7 +1019,7 @@ EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, { EVP_MD *md = evp_generic_fetch(ctx, OSSL_OP_DIGEST, algorithm, properties, - evp_md_from_dispatch, evp_md_up_ref, evp_md_free); + evp_md_from_algorithm, evp_md_up_ref, evp_md_free); return md; } @@ -1051,5 +1053,5 @@ void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_DIGEST, (void (*)(void *, void *))fn, arg, - evp_md_from_dispatch, evp_md_free); + evp_md_from_algorithm, evp_md_free); } diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 79ffd2275f..64759311c0 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1440,10 +1440,11 @@ static void set_legacy_nid(const char *name, void *vlegacy_nid) } #endif -static void *evp_cipher_from_dispatch(const int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_cipher_from_algorithm(const int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_CIPHER *cipher = NULL; int fnciphcnt = 0, fnctxcnt = 0; @@ -1463,6 +1464,7 @@ static void *evp_cipher_from_dispatch(const int name_id, #endif cipher->name_id = name_id; + cipher->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -1587,7 +1589,7 @@ EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, { EVP_CIPHER *cipher = evp_generic_fetch(ctx, OSSL_OP_CIPHER, algorithm, properties, - evp_cipher_from_dispatch, evp_cipher_up_ref, + evp_cipher_from_algorithm, evp_cipher_up_ref, evp_cipher_free); return cipher; @@ -1622,5 +1624,5 @@ void EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_CIPHER, (void (*)(void *, void *))fn, arg, - evp_cipher_from_dispatch, evp_cipher_free); + evp_cipher_from_algorithm, evp_cipher_free); } diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c index 701abfaaf5..4b81204046 100644 --- a/crypto/evp/evp_fetch.c +++ b/crypto/evp/evp_fetch.c @@ -50,8 +50,8 @@ struct evp_method_data_st { unsigned int flag_construct_error_occurred : 1; - void *(*method_from_dispatch)(int name_id, const OSSL_DISPATCH *, - OSSL_PROVIDER *); + void *(*method_from_algorithm)(int name_id, const OSSL_ALGORITHM *, + OSSL_PROVIDER *); int (*refcnt_up_method)(void *method); void (*destruct_method)(void *method); }; @@ -194,8 +194,7 @@ static void *construct_evp_method(const OSSL_ALGORITHM *algodef, if (name_id == 0) return NULL; - method = methdata->method_from_dispatch(name_id, algodef->implementation, - prov); + method = methdata->method_from_algorithm(name_id, algodef, prov); /* * Flag to indicate that there was actual construction errors. This @@ -220,7 +219,7 @@ inner_evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id, int name_id, const char *name, const char *properties, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), int (*up_ref_method)(void *), void (*free_method)(void *)) @@ -296,7 +295,7 @@ inner_evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id, mcmdata.name_id = name_id; mcmdata.names = name; mcmdata.propquery = properties; - mcmdata.method_from_dispatch = new_method; + mcmdata.method_from_algorithm = new_method; mcmdata.refcnt_up_method = up_ref_method; mcmdata.destruct_method = free_method; mcmdata.flag_construct_error_occurred = 0; @@ -341,7 +340,7 @@ inner_evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id, void *evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id, const char *name, const char *properties, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), int (*up_ref_method)(void *), void (*free_method)(void *)) @@ -361,7 +360,7 @@ void *evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id, void *evp_generic_fetch_by_number(OSSL_LIB_CTX *libctx, int operation_id, int name_id, const char *properties, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), int (*up_ref_method)(void *), void (*free_method)(void *)) @@ -461,7 +460,7 @@ int EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable) struct do_all_data_st { void (*user_fn)(void *method, void *arg); void *user_arg; - void *(*new_method)(const int name_id, const OSSL_DISPATCH *fns, + void *(*new_method)(const int name_id, const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov); void (*free_method)(void *); }; @@ -477,7 +476,7 @@ static void do_one(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo, void *method = NULL; if (name_id != 0) - method = data->new_method(name_id, algo->implementation, provider); + method = data->new_method(name_id, algo, provider); if (method != NULL) { data->user_fn(method, data->user_arg); @@ -489,7 +488,7 @@ void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id, void (*user_fn)(void *method, void *arg), void *user_arg, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), void (*free_method)(void *)) { diff --git a/crypto/evp/evp_local.h b/crypto/evp/evp_local.h index 0db84a3d84..72caf86aaf 100644 --- a/crypto/evp/evp_local.h +++ b/crypto/evp/evp_local.h @@ -78,6 +78,7 @@ struct evp_keymgmt_st { int id; /* libcrypto internal */ int name_id; + const char *description; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -116,6 +117,7 @@ struct evp_keymgmt_st { struct evp_keyexch_st { int name_id; + const char *description; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -134,6 +136,7 @@ struct evp_keyexch_st { struct evp_signature_st { int name_id; + const char *description; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -167,6 +170,7 @@ struct evp_signature_st { struct evp_asym_cipher_st { int name_id; + const char *description; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -186,6 +190,7 @@ struct evp_asym_cipher_st { struct evp_kem_st { int name_id; + const char *description; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -235,14 +240,14 @@ int ossl_is_partially_overlapping(const void *ptr1, const void *ptr2, int len); void *evp_generic_fetch(OSSL_LIB_CTX *ctx, int operation_id, const char *name, const char *properties, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), int (*up_ref_method)(void *), void (*free_method)(void *)); void *evp_generic_fetch_by_number(OSSL_LIB_CTX *ctx, int operation_id, int name_id, const char *properties, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), int (*up_ref_method)(void *), void (*free_method)(void *)); @@ -250,7 +255,7 @@ void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id, void (*user_fn)(void *method, void *arg), void *user_arg, void *(*new_method)(int name_id, - const OSSL_DISPATCH *fns, + const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov), void (*free_method)(void *)); diff --git a/crypto/evp/evp_rand.c b/crypto/evp/evp_rand.c index aea9d72ab7..131550b4f3 100644 --- a/crypto/evp/evp_rand.c +++ b/crypto/evp/evp_rand.c @@ -28,6 +28,7 @@ struct evp_rand_st { OSSL_PROVIDER *prov; int name_id; + const char *description; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *refcnt_lock; @@ -112,10 +113,11 @@ static void evp_rand_unlock(EVP_RAND_CTX *rand) rand->meth->unlock(rand->data); } -static void *evp_rand_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_rand_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_RAND *rand = NULL; int fnrandcnt = 0, fnctxcnt = 0, fnlockcnt = 0, fnenablelockcnt = 0; #ifdef FIPS_MODULE @@ -127,6 +129,7 @@ static void *evp_rand_from_dispatch(int name_id, return NULL; } rand->name_id = name_id; + rand->description = algodef->algorithm_description; rand->dispatch = fns; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -268,7 +271,7 @@ EVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, const char *properties) { return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties, - evp_rand_from_dispatch, evp_rand_up_ref, + evp_rand_from_algorithm, evp_rand_up_ref, evp_rand_free); } @@ -472,7 +475,7 @@ void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_RAND, (void (*)(void *, void *))fn, arg, - evp_rand_from_dispatch, evp_rand_free); + evp_rand_from_algorithm, evp_rand_free); } int EVP_RAND_names_do_all(const EVP_RAND *rand, diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c index 5bb038f118..fd8e9210a1 100644 --- a/crypto/evp/exchange.c +++ b/crypto/evp/exchange.c @@ -38,10 +38,11 @@ static EVP_KEYEXCH *evp_keyexch_new(OSSL_PROVIDER *prov) return exchange; } -static void *evp_keyexch_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_keyexch_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_KEYEXCH *exchange = NULL; int fncnt = 0, sparamfncnt = 0, gparamfncnt = 0; @@ -51,6 +52,7 @@ static void *evp_keyexch_from_dispatch(int name_id, } exchange->name_id = name_id; + exchange->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -169,7 +171,7 @@ EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties) { return evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties, - evp_keyexch_from_dispatch, + evp_keyexch_from_algorithm, (int (*)(void *))EVP_KEYEXCH_up_ref, (void (*)(void *))EVP_KEYEXCH_free); } @@ -474,7 +476,7 @@ void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_KEYEXCH, (void (*)(void *, void *))fn, arg, - evp_keyexch_from_dispatch, + evp_keyexch_from_algorithm, (void (*)(void *))EVP_KEYEXCH_free); } diff --git a/crypto/evp/kdf_meth.c b/crypto/evp/kdf_meth.c index 17526a8fe4..1caf1c579c 100644 --- a/crypto/evp/kdf_meth.c +++ b/crypto/evp/kdf_meth.c @@ -52,10 +52,11 @@ static void *evp_kdf_new(void) return kdf; } -static void *evp_kdf_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_kdf_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_KDF *kdf = NULL; int fnkdfcnt = 0, fnctxcnt = 0; @@ -64,6 +65,7 @@ static void *evp_kdf_from_dispatch(int name_id, return NULL; } kdf->name_id = name_id; + kdf->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -151,7 +153,7 @@ EVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, const char *properties) { return evp_generic_fetch(libctx, OSSL_OP_KDF, algorithm, properties, - evp_kdf_from_dispatch, evp_kdf_up_ref, + evp_kdf_from_algorithm, evp_kdf_up_ref, evp_kdf_free); } @@ -218,5 +220,5 @@ void EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_KDF, (void (*)(void *, void *))fn, arg, - evp_kdf_from_dispatch, evp_kdf_free); + evp_kdf_from_algorithm, evp_kdf_free); } diff --git a/crypto/evp/kem.c b/crypto/evp/kem.c index a4183e8311..d57290643b 100644 --- a/crypto/evp/kem.c +++ b/crypto/evp/kem.c @@ -183,9 +183,10 @@ static EVP_KEM *evp_kem_new(OSSL_PROVIDER *prov) return kem; } -static void *evp_kem_from_dispatch(int name_id, const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_kem_from_algorithm(int name_id, const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_KEM *kem = NULL; int ctxfncnt = 0, encfncnt = 0, decfncnt = 0; int gparamfncnt = 0, sparamfncnt = 0; @@ -196,6 +197,7 @@ static void *evp_kem_from_dispatch(int name_id, const OSSL_DISPATCH *fns, } kem->name_id = name_id; + kem->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -326,7 +328,7 @@ EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties) { return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties, - evp_kem_from_dispatch, + evp_kem_from_algorithm, (int (*)(void *))EVP_KEM_up_ref, (void (*)(void *))EVP_KEM_free); } @@ -346,7 +348,7 @@ void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx, void *arg) { evp_generic_do_all(libctx, OSSL_OP_KEM, (void (*)(void *, void *))fn, arg, - evp_kem_from_dispatch, + evp_kem_from_algorithm, (void (*)(void *))EVP_KEM_free); } diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c index 0d7b54316b..f7603f3fa2 100644 --- a/crypto/evp/keymgmt_meth.c +++ b/crypto/evp/keymgmt_meth.c @@ -32,10 +32,11 @@ static void *keymgmt_new(void) return keymgmt; } -static void *keymgmt_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *keymgmt_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_KEYMGMT *keymgmt = NULL; int setparamfncnt = 0, getparamfncnt = 0; int setgenparamfncnt = 0; @@ -46,6 +47,7 @@ static void *keymgmt_from_dispatch(int name_id, return NULL; } keymgmt->name_id = name_id; + keymgmt->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -202,7 +204,7 @@ EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id, { return evp_generic_fetch_by_number(ctx, OSSL_OP_KEYMGMT, name_id, properties, - keymgmt_from_dispatch, + keymgmt_from_algorithm, (int (*)(void *))EVP_KEYMGMT_up_ref, (void (*)(void *))EVP_KEYMGMT_free); } @@ -211,7 +213,7 @@ EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties) { return evp_generic_fetch(ctx, OSSL_OP_KEYMGMT, algorithm, properties, - keymgmt_from_dispatch, + keymgmt_from_algorithm, (int (*)(void *))EVP_KEYMGMT_up_ref, (void (*)(void *))EVP_KEYMGMT_free); } @@ -265,7 +267,7 @@ void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_KEYMGMT, (void (*)(void *, void *))fn, arg, - keymgmt_from_dispatch, + keymgmt_from_algorithm, (void (*)(void *))EVP_KEYMGMT_free); } diff --git a/crypto/evp/mac_meth.c b/crypto/evp/mac_meth.c index 85f87e4c61..bd43e880ae 100644 --- a/crypto/evp/mac_meth.c +++ b/crypto/evp/mac_meth.c @@ -46,10 +46,11 @@ static void *evp_mac_new(void) return mac; } -static void *evp_mac_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_mac_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_MAC *mac = NULL; int fnmaccnt = 0, fnctxcnt = 0; @@ -58,6 +59,7 @@ static void *evp_mac_from_dispatch(int name_id, return NULL; } mac->name_id = name_id; + mac->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -153,7 +155,7 @@ EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, const char *properties) { return evp_generic_fetch(libctx, OSSL_OP_MAC, algorithm, properties, - evp_mac_from_dispatch, evp_mac_up_ref, + evp_mac_from_algorithm, evp_mac_up_ref, evp_mac_free); } @@ -225,5 +227,5 @@ void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_MAC, (void (*)(void *, void *))fn, arg, - evp_mac_from_dispatch, evp_mac_free); + evp_mac_from_algorithm, evp_mac_free); } diff --git a/crypto/evp/signature.c b/crypto/evp/signature.c index 09cf4539d9..1a1235821e 100644 --- a/crypto/evp/signature.c +++ b/crypto/evp/signature.c @@ -38,10 +38,11 @@ static EVP_SIGNATURE *evp_signature_new(OSSL_PROVIDER *prov) return signature; } -static void *evp_signature_from_dispatch(int name_id, - const OSSL_DISPATCH *fns, - OSSL_PROVIDER *prov) +static void *evp_signature_from_algorithm(int name_id, + const OSSL_ALGORITHM *algodef, + OSSL_PROVIDER *prov) { + const OSSL_DISPATCH *fns = algodef->implementation; EVP_SIGNATURE *signature = NULL; int ctxfncnt = 0, signfncnt = 0, verifyfncnt = 0, verifyrecfncnt = 0; int digsignfncnt = 0, digverifyfncnt = 0; @@ -53,6 +54,7 @@ static void *evp_signature_from_dispatch(int name_id, } signature->name_id = name_id; + signature->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { switch (fns->function_id) { @@ -302,7 +304,7 @@ EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties) { return evp_generic_fetch(ctx, OSSL_OP_SIGNATURE, algorithm, properties, - evp_signature_from_dispatch, + evp_signature_from_algorithm, (int (*)(void *))EVP_SIGNATURE_up_ref, (void (*)(void *))EVP_SIGNATURE_free); } @@ -324,7 +326,7 @@ void EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx, { evp_generic_do_all(libctx, OSSL_OP_SIGNATURE, (void (*)(void *, void *))fn, arg, - evp_signature_from_dispatch, + evp_signature_from_algorithm, (void (*)(void *))EVP_SIGNATURE_free); } |