From 6c9bc258d2e9e7b500236a1c696da1f384f0b907 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Fri, 16 Apr 2021 16:22:03 +0200 Subject: Add type_name member to provided methods and use it Fixes #14701 Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/14898) --- crypto/evp/evp_enc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crypto/evp/evp_enc.c') diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 2de2a11e5a..50e1c3452b 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -13,15 +13,16 @@ #include #include #include -#include "internal/cryptlib.h" #include #include #include #include #include #include -#include "crypto/evp.h" +#include "internal/cryptlib.h" #include "internal/provider.h" +#include "internal/core.h" +#include "crypto/evp.h" #include "evp_local.h" int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx) @@ -1468,6 +1469,10 @@ static void *evp_cipher_from_algorithm(const int name_id, #endif cipher->name_id = name_id; + if ((cipher->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) { + EVP_CIPHER_free(cipher); + return NULL; + } cipher->description = algodef->algorithm_description; for (; fns->function_id != 0; fns++) { @@ -1610,6 +1615,7 @@ int EVP_CIPHER_up_ref(EVP_CIPHER *cipher) void evp_cipher_free_int(EVP_CIPHER *cipher) { + OPENSSL_free(cipher->type_name); ossl_provider_free(cipher->prov); CRYPTO_THREAD_lock_free(cipher->lock); OPENSSL_free(cipher); -- cgit v1.2.3