From 309a78aa305ee14878e453c78ccf9a7dc91264cf Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 16 Mar 2021 14:14:43 +0100 Subject: 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 (Merged from https://github.com/openssl/openssl/pull/14656) --- crypto/evp/evp_enc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crypto/evp/evp_enc.c') 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); } -- cgit v1.2.3