summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-08-19 08:56:28 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2017-08-19 08:56:30 +0200
commit63d045fe3a09aa3c63c663cac0821568d5202071 (patch)
tree6305494843a375562373986bda956d5d0429f64b
parent1d311aa0b202751f1b8033a25249a432f070095a (diff)
downloadgnutls-63d045fe3a09aa3c63c663cac0821568d5202071.tar.gz
rnd-fuzzer: use ifdef instead of conditional compilation
This allows compiling in fuzzying mode even when --enable-fuzzer-target is not specified on configure, but the definition is present. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--lib/nettle/Makefile.am2
-rw-r--r--lib/nettle/rnd-fuzzer.c6
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/nettle/Makefile.am b/lib/nettle/Makefile.am
index c7196ae307..182d7d9838 100644
--- a/lib/nettle/Makefile.am
+++ b/lib/nettle/Makefile.am
@@ -53,9 +53,7 @@ libcrypto_la_SOURCES += sysrng-linux.c
endif
endif
-if FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
libcrypto_la_SOURCES += rnd-fuzzer.c
-endif
if ENABLE_FIPS140
libcrypto_la_SOURCES += rnd-fips.c int/drbg-aes-self-test.c \
diff --git a/lib/nettle/rnd-fuzzer.c b/lib/nettle/rnd-fuzzer.c
index 6229e1fba4..9d0e9d5115 100644
--- a/lib/nettle/rnd-fuzzer.c
+++ b/lib/nettle/rnd-fuzzer.c
@@ -33,9 +33,7 @@
#include <stdlib.h>
#include <rnd-common.h>
-#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
-# error 1
-#endif
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
struct r48_rand_data {
unsigned short int __x[3]; /* Current state. */
@@ -146,3 +144,5 @@ gnutls_crypto_rnd_st _gnutls_fuzz_rnd_ops = {
.rnd_refresh = _rngfuzz_refresh,
.self_test = NULL,
};
+
+#endif /* FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */