Fix dsaparam -genkey with DER outform
[openssl.git] / apps / gendsa.c
index fd1360acd57f559a01a974d4ec760d43472af64a..31510e6123d7c44c68e78b8c883ce125b1445964 100644 (file)
@@ -85,9 +85,8 @@ int MAIN(int argc, char **argv)
     char *passargout = NULL, *passout = NULL;
     BIO *out = NULL, *in = NULL;
     const EVP_CIPHER *enc = NULL;
-# ifndef OPENSSL_NO_ENGINE
     char *engine = NULL;
-# endif
+    ENGINE *e = NULL;
 
     apps_startup();
 
@@ -206,9 +205,7 @@ int MAIN(int argc, char **argv)
                    "           - a DSA parameter file as generated by the dsaparam command\n");
         goto end;
     }
-# ifndef OPENSSL_NO_ENGINE
-    setup_engine(bio_err, engine, 0);
-# endif
+    e = setup_engine(bio_err, engine, 0);
 
     if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
         BIO_printf(bio_err, "Error getting password\n");
@@ -273,6 +270,7 @@ int MAIN(int argc, char **argv)
         BIO_free_all(out);
     if (dsa != NULL)
         DSA_free(dsa);
+    release_engine(e);
     if (passout)
         OPENSSL_free(passout);
     apps_shutdown();