Stop spurious "unable to load config info" errors in req
[openssl.git] / apps / rsa.c
index bdfe2189ba3656f676985fe33ec069d5468dd079..8ae67bbac556ea2816afea0d2b03e4c20894e2eb 100644 (file)
@@ -68,7 +68,6 @@
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include <openssl/pem.h>
-#include <openssl/engine.h>
 
 #undef PROG
 #define PROG   rsa_main
@@ -209,23 +208,7 @@ bad:
 
        ERR_load_crypto_strings();
 
-       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(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
                BIO_printf(bio_err, "Error getting passwords\n");
@@ -416,6 +399,7 @@ end:
        if(rsa != NULL) RSA_free(rsa);
        if(passin) OPENSSL_free(passin);
        if(passout) OPENSSL_free(passout);
+       apps_shutdown();
        EXIT(ret);
        }
 #else /* !OPENSSL_NO_RSA */