Provide an application-common setup function for engines and use it
[openssl.git] / apps / genrsa.c
index d67880811facf4c7a8fafc99dabec7979b11b07b..5d7fca404d2639c973eb3a16dd79c01279efbf46 100644 (file)
@@ -176,23 +176,7 @@ bad:
                goto err;
        }
 
-       if (engine != NULL)
-               {
-               if((e = ENGINE_by_id(engine)) == NULL)
-                       {
-                       BIO_printf(bio_err,"invalid engine \"%s\"\n",
-                               engine);
-                       goto err;
-                       }
-               if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
-                       {
-                       BIO_printf(bio_err,"can't use that engine\n");
-                       goto err;
-                       }
-               BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
-               /* Free our "structural" reference. */
-               ENGINE_free(e);
-               }
+        e = setup_engine(bio_err, engine, 0);
 
        if (outfile == NULL)
                {