Make ciphers and digests obtain an ENGINE functional reference
authorDr. Stephen Henson <steve@openssl.org>
Sat, 9 Mar 2002 18:58:05 +0000 (18:58 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 9 Mar 2002 18:58:05 +0000 (18:58 +0000)
if impl is explicitly supplied.

crypto/evp/digest.c
crypto/evp/evp_enc.c

index 12c6cec5d88db89077b2ea999d53a1efaae27992..a969ac69edb6ac98e7f35425c18aaf82189ef265 100644 (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). */
                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)
index 9c65a553d39ed66302d96afa777b3e385f8de09d..22a7b745c174ac3d68bd36698da6d8cf57fa82f5 100644 (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). */
                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)