Fix warnings (From HEAD, original patch by Ben).
[openssl.git] / apps / dsaparam.c
index b6abe785abd9aa9a738cc492964cc050f8dfaff7..fe72c1d3dfa8fb5205143f589168c6199987f2b4 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#include <openssl/opensslconf.h>       /* for OPENSSL_NO_DSA */
 /* Until the key-gen callbacks are modified to use newer prototypes, we allow
  * deprecated functions for openssl-internal code */
 #ifdef OPENSSL_NO_DEPRECATED
@@ -110,7 +111,6 @@ int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
        {
-       ENGINE *e = NULL;
        DSA *dsa=NULL;
        int i,badops=0,text=0;
        BIO *in=NULL,*out=NULL;
@@ -118,7 +118,9 @@ int MAIN(int argc, char **argv)
        char *infile,*outfile,*prog,*inrand=NULL;
        int numbits= -1,num,genkey=0;
        int need_rand=0;
+#ifndef OPENSSL_NO_ENGINE
        char *engine=NULL;
+#endif
 #ifdef GENCB_TEST
        int timebomb=0;
 #endif
@@ -162,11 +164,13 @@ int MAIN(int argc, char **argv)
                        if (--argc < 1) goto bad;
                        outfile= *(++argv);
                        }
+#ifndef OPENSSL_NO_ENGINE
                else if(strcmp(*argv, "-engine") == 0)
                        {
                        if (--argc < 1) goto bad;
                        engine = *(++argv);
                        }
+#endif
 #ifdef GENCB_TEST
                else if(strcmp(*argv, "-timebomb") == 0)
                        {
@@ -221,7 +225,9 @@ bad:
                BIO_printf(bio_err," -noout        no output\n");
                BIO_printf(bio_err," -genkey       generate a DSA key\n");
                BIO_printf(bio_err," -rand         files to use for random number input\n");
+#ifndef OPENSSL_NO_ENGINE
                BIO_printf(bio_err," -engine e     use engine e, possibly a hardware device.\n");
+#endif
 #ifdef GENCB_TEST
                BIO_printf(bio_err," -timebomb n   interrupt keygen after <n> seconds\n");
 #endif
@@ -268,7 +274,9 @@ bad:
                        }
                }
 
-        e = setup_engine(bio_err, engine, 0);
+#ifndef OPENSSL_NO_ENGINE
+        setup_engine(bio_err, engine, 0);
+#endif
 
        if (need_rand)
                {
@@ -346,12 +354,10 @@ bad:
        if (C)
                {
                unsigned char *data;
-               int l,len,bits_p,bits_q,bits_g;
+               int l,len,bits_p;
 
                len=BN_num_bytes(dsa->p);
                bits_p=BN_num_bits(dsa->p);
-               bits_q=BN_num_bits(dsa->q);
-               bits_g=BN_num_bits(dsa->g);
                data=(unsigned char *)OPENSSL_malloc(len+20);
                if (data == NULL)
                        {
@@ -464,4 +470,10 @@ static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb)
 #endif
        return 1;
        }
+#else /* !OPENSSL_NO_DSA */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
 #endif