Provide an application-common setup function for engines and use it
[openssl.git] / apps / spkac.c
index 5ac9b14c54b2035c56cb1989d240ff0272ea53b9..538a419345eb0f51d3a045aacd9f0e3935cb4974 100644 (file)
@@ -179,23 +179,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 = setup_engine(bio_err, engine, 0);
 
        if(keyfile) {
                if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");