PR: 2069
[openssl.git] / apps / dh.c
index 27c3dc8df22cdc8e86d5d8a80ccaaace72bff20d..e9609d630d9cf3c41b233e1f782726f47cbc09c8 100644 (file)
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -57,6 +57,7 @@
  * [including the GNU Public Licence.]
  */
 
  * [including the GNU Public Licence.]
  */
 
+#include <openssl/opensslconf.h>       /* for OPENSSL_NO_DH */
 #ifndef OPENSSL_NO_DH
 #include <stdio.h>
 #include <stdlib.h>
 #ifndef OPENSSL_NO_DH
 #include <stdio.h>
 #include <stdlib.h>
@@ -87,12 +88,17 @@ int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
        {
 
 int MAIN(int argc, char **argv)
        {
+#ifndef OPENSSL_NO_ENGINE
        ENGINE *e = NULL;
        ENGINE *e = NULL;
+#endif
        DH *dh=NULL;
        int i,badops=0,text=0;
        BIO *in=NULL,*out=NULL;
        int informat,outformat,check=0,noout=0,C=0,ret=1;
        DH *dh=NULL;
        int i,badops=0,text=0;
        BIO *in=NULL,*out=NULL;
        int informat,outformat,check=0,noout=0,C=0,ret=1;
-       char *infile,*outfile,*prog,*engine;
+       char *infile,*outfile,*prog;
+#ifndef OPENSSL_NO_ENGINE
+       char *engine;
+#endif
 
        apps_startup();
 
 
        apps_startup();
 
@@ -103,7 +109,9 @@ int MAIN(int argc, char **argv)
        if (!load_config(bio_err, NULL))
                goto end;
 
        if (!load_config(bio_err, NULL))
                goto end;
 
+#ifndef OPENSSL_NO_ENGINE
        engine=NULL;
        engine=NULL;
+#endif
        infile=NULL;
        outfile=NULL;
        informat=FORMAT_PEM;
        infile=NULL;
        outfile=NULL;
        informat=FORMAT_PEM;
@@ -134,11 +142,13 @@ int MAIN(int argc, char **argv)
                        if (--argc < 1) goto bad;
                        outfile= *(++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);
                        }
                else if (strcmp(*argv,"-engine") == 0)
                        {
                        if (--argc < 1) goto bad;
                        engine= *(++argv);
                        }
+#endif
                else if (strcmp(*argv,"-check") == 0)
                        check=1;
                else if (strcmp(*argv,"-text") == 0)
                else if (strcmp(*argv,"-check") == 0)
                        check=1;
                else if (strcmp(*argv,"-text") == 0)
@@ -170,13 +180,17 @@ bad:
                BIO_printf(bio_err," -text         print a text form of the DH parameters\n");
                BIO_printf(bio_err," -C            Output C code\n");
                BIO_printf(bio_err," -noout        no output\n");
                BIO_printf(bio_err," -text         print a text form of the DH parameters\n");
                BIO_printf(bio_err," -C            Output C code\n");
                BIO_printf(bio_err," -noout        no output\n");
+#ifndef OPENSSL_NO_ENGINE
                BIO_printf(bio_err," -engine e     use engine e, possibly a hardware device.\n");
                BIO_printf(bio_err," -engine e     use engine e, possibly a hardware device.\n");
+#endif
                goto end;
                }
 
        ERR_load_crypto_strings();
 
                goto end;
                }
 
        ERR_load_crypto_strings();
 
+#ifndef OPENSSL_NO_ENGINE
         e = setup_engine(bio_err, engine, 0);
         e = setup_engine(bio_err, engine, 0);
+#endif
 
        in=BIO_new(BIO_s_file());
        out=BIO_new(BIO_s_file());
 
        in=BIO_new(BIO_s_file());
        out=BIO_new(BIO_s_file());
@@ -333,6 +347,12 @@ end:
        if (out != NULL) BIO_free_all(out);
        if (dh != NULL) DH_free(dh);
        apps_shutdown();
        if (out != NULL) BIO_free_all(out);
        if (dh != NULL) DH_free(dh);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
        }
+#else /* !OPENSSL_NO_DH */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
 #endif
 #endif