Provide an application-common setup function for engines and use it
[openssl.git] / apps / gendsa.c
index 1166be44110dbd34058c497d1bb4b195901c170e..3fdbf3772217e22f60b979803adc4b6e3c532046 100644 (file)
@@ -162,23 +162,7 @@ bad:
                goto end;
                }
 
-       if (engine != NULL)
-               {
-               if((e = ENGINE_by_id(engine)) == NULL)
-                       {
-                       BIO_printf(bio_err,"invalid engine \"%s\"\n",
-                               engine);
-                       goto end;
-                       }
-               if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
-                       {
-                       BIO_printf(bio_err,"can't use that engine\n");
-                       goto end;
-                       }
-               BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
-               /* Free our "structural" reference. */
-               ENGINE_free(e);
-               }
+        e = ENGINE_setup(engine, bio_err);
 
        if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
                BIO_printf(bio_err, "Error getting password\n");