apps: constify some string parameters
[openssl.git] / apps / dhparam.c
index 5fab29eb87bf0936ae51f40936c904af110af5c6..f5d7126af7a5d16bedbcb9dc9713f9212e56c189 100644 (file)
@@ -149,9 +149,6 @@ int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
        {
-#ifndef OPENSSL_NO_ENGINE
-       ENGINE *e = NULL;
-#endif
        DH *dh=NULL;
        int i,badops=0,text=0;
 #ifndef OPENSSL_NO_DSA
@@ -270,7 +267,7 @@ bad:
        ERR_load_crypto_strings();
 
 #ifndef OPENSSL_NO_ENGINE
-        e = setup_engine(bio_err, engine, 0);
+        setup_engine(bio_err, engine, 0);
 #endif
 
        if (g && !num)
@@ -335,7 +332,6 @@ bad:
                        BIO_printf(bio_err,"This is going to take a long time\n");
                        if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb))
                                {
-                               if(dh) DH_free(dh);
                                ERR_print_errors(bio_err);
                                goto end;
                                }
@@ -516,7 +512,12 @@ bad:
                if      (outformat == FORMAT_ASN1)
                        i=i2d_DHparams_bio(out,dh);
                else if (outformat == FORMAT_PEM)
-                       i=PEM_write_bio_DHparams(out,dh);
+                       {
+                       if (dh->q)
+                               i=PEM_write_bio_DHxparams(out,dh);
+                       else
+                               i=PEM_write_bio_DHparams(out,dh);
+                       }
                else    {
                        BIO_printf(bio_err,"bad output format specified for outfile\n");
                        goto end;