Make ciphers and digests obtain an ENGINE functional reference

if impl is explicitly supplied.
This commit is contained in:
Dr. Stephen Henson 2002-03-09 18:58:05 +00:00
parent 0c372b94f7
commit bf6a9e66d6
2 changed files with 18 additions and 2 deletions

View File

@ -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). */ * ENGINE and EVP_MD could be used). */
if(ctx->engine) if(ctx->engine)
ENGINE_finish(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 */ /* Ask if an ENGINE is reserved for this job */
impl = ENGINE_get_digest_engine(type->type); impl = ENGINE_get_digest_engine(type->type);
if(impl) if(impl)

View File

@ -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). */ * ENGINE and EVP_CIPHER could be used). */
if(ctx->engine) if(ctx->engine)
ENGINE_finish(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 */ /* Ask if an ENGINE is reserved for this job */
impl = ENGINE_get_cipher_engine(cipher->nid); impl = ENGINE_get_cipher_engine(cipher->nid);
if(impl) if(impl)