summaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/evp/evp_enc.c')
-rw-r--r--crypto/evp/evp_enc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index c1f7e77eb1..bfdd581e0d 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -1127,7 +1127,8 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
return 1;
}
-static void *evp_cipher_from_dispatch(const OSSL_DISPATCH *fns,
+static void *evp_cipher_from_dispatch(const char *name,
+ const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov)
{
EVP_CIPHER *cipher = NULL;
@@ -1137,8 +1138,12 @@ static void *evp_cipher_from_dispatch(const OSSL_DISPATCH *fns,
* The legacy NID is set by EVP_CIPHER_fetch() if the name exists in
* the object database.
*/
- if ((cipher = EVP_CIPHER_meth_new(0, 0, 0)) == NULL)
+ if ((cipher = EVP_CIPHER_meth_new(0, 0, 0)) == NULL
+ || (cipher->name = OPENSSL_strdup(name)) == NULL) {
+ EVP_CIPHER_meth_free(cipher);
+ EVPerr(0, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
for (; fns->function_id != 0; fns++) {
switch (fns->function_id) {