summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2020-10-23 23:10:20 +0800
committerMatt Johnston <matt@ucc.asn.au>2020-10-23 23:10:20 +0800
commitf37def57b089a884df51072cb24e830701ecbeaa (patch)
tree12017ee2c70c8a0c1dfe98c59029e0015a7463a0
parent1a208c460b412113704c4d5f98585017ee0a6ccf (diff)
Move fuzzing code to fuzz/ subdirectory, improve Makefile.in
-rw-r--r--Makefile.in53
-rw-r--r--configure.ac1
-rw-r--r--fuzz/fuzz-common.c (renamed from fuzz-common.c)0
-rw-r--r--fuzz/fuzz-harness.c (renamed from fuzz-harness.c)0
-rw-r--r--fuzz/fuzz-hostkeys.c (renamed from fuzz-hostkeys.c)0
-rw-r--r--fuzz/fuzz-wrapfd.c (renamed from fuzz-wrapfd.c)0
-rw-r--r--fuzz/fuzzer-client.c (renamed from fuzzer-client.c)0
-rw-r--r--fuzz/fuzzer-client_nomaths.c (renamed from fuzzer-client_nomaths.c)0
-rw-r--r--fuzz/fuzzer-kexcurve25519.c (renamed from fuzzer-kexcurve25519.c)0
-rw-r--r--fuzz/fuzzer-kexdh.c (renamed from fuzzer-kexdh.c)0
-rw-r--r--fuzz/fuzzer-kexecdh.c (renamed from fuzzer-kexecdh.c)0
-rw-r--r--fuzz/fuzzer-preauth.c (renamed from fuzzer-preauth.c)0
-rw-r--r--fuzz/fuzzer-preauth_nomaths.c (renamed from fuzzer-preauth_nomaths.c)0
-rw-r--r--fuzz/fuzzer-pubkey.c (renamed from fuzzer-pubkey.c)0
-rw-r--r--fuzz/fuzzer-verify.c (renamed from fuzzer-verify.c)0
15 files changed, 18 insertions, 36 deletions
diff --git a/Makefile.in b/Makefile.in
index 182cb42..42a142c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -62,7 +62,7 @@ CONVERTOBJS=dropbearconvert.o keyimport.o
SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
ifeq (@DROPBEAR_FUZZ@, 1)
- allobjs = $(COMMONOBJS) fuzz-common.o fuzz-wrapfd.o $(CLISVROBJS) $(CLIOBJS) $(SVROBJS) @CRYPTLIB@
+ allobjs = $(COMMONOBJS) fuzz/fuzz-common.o fuzz/fuzz-wrapfd.o $(CLISVROBJS) $(CLIOBJS) $(SVROBJS) @CRYPTLIB@
allobjs:=$(subst svr-main.o, ,$(allobjs))
allobjs:=$(subst cli-main.o, ,$(allobjs))
@@ -72,6 +72,7 @@ ifeq (@DROPBEAR_FUZZ@, 1)
dropbearconvertobjs=$(allobjs) $(CONVERTOBJS)
# CXX only set when fuzzing
CXX=@CXX@
+ FUZZ_CLEAN=fuzz-clean
else
dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
@@ -246,7 +247,7 @@ ltm-clean:
sizes: dropbear
objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
-clean: $(LIBTOM_CLEAN) thisclean
+clean: $(LIBTOM_CLEAN) $(FUZZ_CLEAN) thisclean
thisclean:
-rm -f dropbear$(EXEEXT) dbclient$(EXEEXT) dropbearkey$(EXEEXT) \
@@ -271,47 +272,24 @@ FUZZ_TARGETS=fuzzer-preauth fuzzer-pubkey fuzzer-verify fuzzer-preauth_nomaths \
fuzzer-kexdh fuzzer-kexecdh fuzzer-kexcurve25519 fuzzer-client fuzzer-client_nomaths
FUZZER_OPTIONS = $(addsuffix .options, $(FUZZ_TARGETS))
+FUZZ_OBJS = $(addprefix fuzz/,$(addsuffix .o,$(FUZZ_TARGETS)))
list-fuzz-targets:
@echo $(FUZZ_TARGETS)
# fuzzers that don't use libfuzzer, just a standalone harness that feeds inputs
-fuzzstandalone: FUZZLIB=fuzz-harness.o
-fuzzstandalone: fuzz-harness.o fuzz-targets
-
-fuzz-harness.o: $(HEADERS) $(LIBTOM_DEPS) Makefile $(allobjs) fuzz-common.o
-
-# build all the fuzzers. This will require fail to link unless built with
-# make fuzz-targets FUZZLIB=-lFuzzer.a
-# or similar - the library provides main().
+fuzzstandalone: FUZZLIB=fuzz/fuzz-harness.o
+fuzzstandalone: fuzz/fuzz-harness.o fuzz-targets
+
+# Build all the fuzzers. Usually like
+# make fuzz-targets FUZZLIB=-lFuzzer.a
+# the library provides main(). Otherwise
+# make fuzzstandalone
+# provides a main in fuzz-harness.c
fuzz-targets: $(FUZZ_TARGETS) $(FUZZER_OPTIONS)
-fuzzer-preauth: fuzzer-preauth.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-preauth_nomaths: fuzzer-preauth_nomaths.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-pubkey: fuzzer-pubkey.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-verify: fuzzer-verify.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-kexdh: fuzzer-kexdh.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-kexecdh: fuzzer-kexecdh.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-kexcurve25519: fuzzer-kexcurve25519.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-client: fuzzer-client.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
-
-fuzzer-client_nomaths: fuzzer-client_nomaths.o fuzz-harness.o
- $(CXX) $(CXXFLAGS) $@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
+$(FUZZ_TARGETS): $(FUZZ_OBJS) $(allobjs) $(LIBTOM_DEPS)
+ $(CXX) $(CXXFLAGS) fuzz/$@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) -lcrypt
fuzzer-%.options: Makefile
echo "[libfuzzer]" > $@
@@ -329,3 +307,6 @@ fuzz-hostkeys:
/usr/bin/xxd -i -a keye >> hostkeys.c
/usr/bin/xxd -i -a keyd >> hostkeys.c
/usr/bin/xxd -i -a keyed25519 >> hostkeys.c
+
+fuzz-clean:
+ -rm -f fuzz/*.o $(FUZZ_TARGETS) $(FUZZER_OPTIONS)
diff --git a/configure.ac b/configure.ac
index 473cea5..8f552a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,6 +347,7 @@ AC_ARG_ENABLE(fuzz,
DROPBEAR_FUZZ=1
# libfuzzer needs linking with c++ libraries
AC_PROG_CXX
+ mkdir -pv fuzz
else
AC_DEFINE(DROPBEAR_FUZZ, 0, Fuzzing)
AC_MSG_NOTICE(Disabling fuzzing)
diff --git a/fuzz-common.c b/fuzz/fuzz-common.c
index 60dab21..60dab21 100644
--- a/fuzz-common.c
+++ b/fuzz/fuzz-common.c
diff --git a/fuzz-harness.c b/fuzz/fuzz-harness.c
index ced707c..ced707c 100644
--- a/fuzz-harness.c
+++ b/fuzz/fuzz-harness.c
diff --git a/fuzz-hostkeys.c b/fuzz/fuzz-hostkeys.c
index 128c8d1..128c8d1 100644
--- a/fuzz-hostkeys.c
+++ b/fuzz/fuzz-hostkeys.c
diff --git a/fuzz-wrapfd.c b/fuzz/fuzz-wrapfd.c
index c6d59fc..c6d59fc 100644
--- a/fuzz-wrapfd.c
+++ b/fuzz/fuzz-wrapfd.c
diff --git a/fuzzer-client.c b/fuzz/fuzzer-client.c
index eb59f46..eb59f46 100644
--- a/fuzzer-client.c
+++ b/fuzz/fuzzer-client.c
diff --git a/fuzzer-client_nomaths.c b/fuzz/fuzzer-client_nomaths.c
index e0910a7..e0910a7 100644
--- a/fuzzer-client_nomaths.c
+++ b/fuzz/fuzzer-client_nomaths.c
diff --git a/fuzzer-kexcurve25519.c b/fuzz/fuzzer-kexcurve25519.c
index f2eab14..f2eab14 100644
--- a/fuzzer-kexcurve25519.c
+++ b/fuzz/fuzzer-kexcurve25519.c
diff --git a/fuzzer-kexdh.c b/fuzz/fuzzer-kexdh.c
index 224ff58..224ff58 100644
--- a/fuzzer-kexdh.c
+++ b/fuzz/fuzzer-kexdh.c
diff --git a/fuzzer-kexecdh.c b/fuzz/fuzzer-kexecdh.c
index c3a450a..c3a450a 100644
--- a/fuzzer-kexecdh.c
+++ b/fuzz/fuzzer-kexecdh.c
diff --git a/fuzzer-preauth.c b/fuzz/fuzzer-preauth.c
index 3ac49f4..3ac49f4 100644
--- a/fuzzer-preauth.c
+++ b/fuzz/fuzzer-preauth.c
diff --git a/fuzzer-preauth_nomaths.c b/fuzz/fuzzer-preauth_nomaths.c
index efdc2c3..efdc2c3 100644
--- a/fuzzer-preauth_nomaths.c
+++ b/fuzz/fuzzer-preauth_nomaths.c
diff --git a/fuzzer-pubkey.c b/fuzz/fuzzer-pubkey.c
index 7c12cdc..7c12cdc 100644
--- a/fuzzer-pubkey.c
+++ b/fuzz/fuzzer-pubkey.c
diff --git a/fuzzer-verify.c b/fuzz/fuzzer-verify.c
index a0ad086..a0ad086 100644
--- a/fuzzer-verify.c
+++ b/fuzz/fuzzer-verify.c