diff options
Diffstat (limited to 'crypto/evp/evp_enc.c')
-rw-r--r-- | crypto/evp/evp_enc.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index f2511a2b28..6e509b2d13 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1281,7 +1281,7 @@ EVP_CIPHER *evp_cipher_new(void) return cipher; } -static void *evp_cipher_from_dispatch(const char *name, +static void *evp_cipher_from_dispatch(const int name_id, const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov, void *unused) @@ -1289,22 +1289,23 @@ static void *evp_cipher_from_dispatch(const char *name, EVP_CIPHER *cipher = NULL; int fnciphcnt = 0, fnctxcnt = 0; - if ((cipher = evp_cipher_new()) == NULL - || (cipher->name = OPENSSL_strdup(name)) == NULL) { - EVP_CIPHER_free(cipher); + if ((cipher = evp_cipher_new()) == NULL) { EVPerr(0, ERR_R_MALLOC_FAILURE); return NULL; } + cipher->name_id = name_id; #ifndef FIPS_MODE - /* - * FIPS module note: since internal fetches will be entirely - * provider based, we know that none of its code depends on legacy - * NIDs or any functionality that use them. - * - * TODO(3.x) get rid of the need for legacy NIDs - */ - cipher->nid = OBJ_sn2nid(name); + { + /* + * FIPS module note: since internal fetches will be entirely + * provider based, we know that none of its code depends on legacy + * NIDs or any functionality that use them. + * + * TODO(3.x) get rid of the need for legacy NIDs + */ + cipher->nid = OBJ_sn2nid(evp_first_name(prov, name_id)); + } #endif for (; fns->function_id != 0; fns++) { @@ -1449,7 +1450,6 @@ void EVP_CIPHER_free(EVP_CIPHER *cipher) if (i > 0) return; ossl_provider_free(cipher->prov); - OPENSSL_free(cipher->name); CRYPTO_THREAD_lock_free(cipher->lock); OPENSSL_free(cipher); } |