From c77bd28775a0da593d9977d4084b2e25ef145f7a Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 9 Mar 2002 18:56:38 +0000 Subject: [PATCH] Make ciphers and digests obtain an ENGINE functional reference if impl is explicitly supplied. --- crypto/evp/digest.c | 10 +++++++++- crypto/evp/evp_enc.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 12c6cec5d8..a969ac69ed 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -152,7 +152,15 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) * ENGINE and EVP_MD could be used). */ if(ctx->engine) ENGINE_finish(ctx->engine); - if(!impl) + if(impl) + { + if (!ENGINE_init(impl)) + { + EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_INITIALIZATION_ERROR); + return 0; + } + } + else /* Ask if an ENGINE is reserved for this job */ impl = ENGINE_get_digest_engine(type->type); if(impl) diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 9c65a553d3..22a7b745c1 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -100,7 +100,15 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp * ENGINE and EVP_CIPHER could be used). */ if(ctx->engine) ENGINE_finish(ctx->engine); - if(!impl) + if(impl) + { + if (!ENGINE_init(impl)) + { + EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_INITIALIZATION_ERROR); + return 0; + } + } + else /* Ask if an ENGINE is reserved for this job */ impl = ENGINE_get_cipher_engine(cipher->nid); if(impl) -- 2.25.1