summaryrefslogtreecommitdiff
path: root/apps/dhparam.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2020-03-04 16:52:22 -0500
committerBernd Edlinger <bernd.edlinger@hotmail.de>2020-04-10 15:24:02 +0200
commit1ae56f2f43d36618e54cbb8dd47a7107b74505b6 (patch)
treea2704c85168a338361457a3b9765fcb02d9d2bb3 /apps/dhparam.c
parentfa4d3fe46dfb4909c3c18c9d6141bb3b60a09eed (diff)
downloadopenssl-new-1ae56f2f43d36618e54cbb8dd47a7107b74505b6.tar.gz
Don't compile commands if disabled
Rather than wrapping whole files in "ifndef OPENSSL_NO_xxx" we handle the changes in build.info Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/11250)
Diffstat (limited to 'apps/dhparam.c')
-rw-r--r--apps/dhparam.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/apps/dhparam.c b/apps/dhparam.c
index 3f694c5a35..019a7ce8ab 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -11,28 +11,25 @@
#define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h>
-#ifdef OPENSSL_NO_DH
-NON_EMPTY_TRANSLATION_UNIT
-#else
-
-# include <stdio.h>
-# include <stdlib.h>
-# include <time.h>
-# include <string.h>
-# include "apps.h"
-# include "progs.h"
-# include <openssl/bio.h>
-# include <openssl/err.h>
-# include <openssl/bn.h>
-# include <openssl/dh.h>
-# include <openssl/x509.h>
-# include <openssl/pem.h>
-
-# ifndef OPENSSL_NO_DSA
-# include <openssl/dsa.h>
-# endif
-
-# define DEFBITS 2048
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include "apps.h"
+#include "progs.h"
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/bn.h>
+#include <openssl/dh.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+
+#ifndef OPENSSL_NO_DSA
+# include <openssl/dsa.h>
+#endif
+
+#define DEFBITS 2048
static int dh_cb(int p, int n, BN_GENCB *cb);
@@ -50,13 +47,13 @@ const OPTIONS dhparam_options[] = {
OPT_SECTION("General"),
{"help", OPT_HELP, '-', "Display this summary"},
{"check", OPT_CHECK, '-', "Check the DH parameters"},
-# ifndef OPENSSL_NO_DSA
+#ifndef OPENSSL_NO_DSA
{"dsaparam", OPT_DSAPARAM, '-',
"Read or generate DSA parameters, convert to DH"},
-# endif
-# ifndef OPENSSL_NO_ENGINE
+#endif
+#ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
-# endif
+#endif
OPT_SECTION("Input"),
{"in", OPT_IN, '<', "Input file"},
@@ -167,13 +164,13 @@ int dhparam_main(int argc, char **argv)
if (g && !num)
num = DEFBITS;
-# ifndef OPENSSL_NO_DSA
+#ifndef OPENSSL_NO_DSA
if (dsaparam && g) {
BIO_printf(bio_err,
"generator may not be chosen for DSA parameters\n");
goto end;
}
-# endif
+#endif
out = bio_open_default(outfile, 'w', outformat);
if (out == NULL)
@@ -194,7 +191,7 @@ int dhparam_main(int argc, char **argv)
BN_GENCB_set(cb, dh_cb, bio_err);
-# ifndef OPENSSL_NO_DSA
+#ifndef OPENSSL_NO_DSA
if (dsaparam) {
DSA *dsa = DSA_new();
@@ -217,7 +214,7 @@ int dhparam_main(int argc, char **argv)
goto end;
}
} else
-# endif
+#endif
{
dh = DH_new();
BIO_printf(bio_err,
@@ -238,7 +235,7 @@ int dhparam_main(int argc, char **argv)
if (in == NULL)
goto end;
-# ifndef OPENSSL_NO_DSA
+#ifndef OPENSSL_NO_DSA
if (dsaparam) {
DSA *dsa;
@@ -260,7 +257,7 @@ int dhparam_main(int argc, char **argv)
goto end;
}
} else
-# endif
+#endif
{
if (informat == FORMAT_ASN1) {
/*
@@ -397,4 +394,3 @@ static int dh_cb(int p, int n, BN_GENCB *cb)
(void)BIO_flush(BN_GENCB_get_arg(cb));
return 1;
}
-#endif