Provide an application-common setup function for engines and use it
[openssl.git] / apps / dgst.c
index a010ba071960814cab4251fcee84f01d09b220ea..1fbef6bed21ef28716cd6eb8e64d8aebdb85c594 100644 (file)
@@ -225,23 +225,7 @@ int MAIN(int argc, char **argv)
                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);
 
        in=BIO_new(BIO_s_file());
        bmd=BIO_new(BIO_f_md());