summaryrefslogtreecommitdiff
path: root/fuzz/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/Makefile.am')
-rw-r--r--fuzz/Makefile.am85
1 files changed, 85 insertions, 0 deletions
diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am
new file mode 100644
index 0000000000..b747fe0f82
--- /dev/null
+++ b/fuzz/Makefile.am
@@ -0,0 +1,85 @@
+AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) -Wno-unused-parameter -Wno-pedantic
+AM_CPPFLAGS = -I$(top_srcdir)/lib/includes -I$(top_builddir)/lib/includes -I$(srcdir) \
+ -DSRCDIR=\"$(abs_srcdir)\" -DTEST_RUN
+AM_LDFLAGS = -static
+LDADD = ../gl/libgnu.la ../lib/libgnutls.la \
+ $(LIBOBJS) $(GETADDRINFO_LIB) $(HOSTENT_LIB) $(INET_NTOP_LIB)\
+ $(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) $(LIB_POLL) $(LIB_PTHREAD)\
+ $(LIB_SELECT) $(LIBTHREAD) $(SERVENT_LIB) \
+ $(LIBS)
+
+FUZZERS = \
+ gnutls_base64_decoder_fuzzer$(EXEEXT) \
+ gnutls_base64_encoder_fuzzer$(EXEEXT) \
+ gnutls_client_fuzzer$(EXEEXT) \
+ gnutls_dn_parser_fuzzer$(EXEEXT) \
+ gnutls_idna_parser_fuzzer$(EXEEXT) \
+ gnutls_ocsp_req_parser_fuzzer$(EXEEXT) \
+ gnutls_ocsp_resp_parser_fuzzer$(EXEEXT) \
+ gnutls_pkcs12_key_parser_fuzzer$(EXEEXT) \
+ gnutls_pkcs7_parser_fuzzer$(EXEEXT) \
+ gnutls_pkcs8_key_parser_fuzzer$(EXEEXT) \
+ gnutls_private_key_parser_fuzzer$(EXEEXT) \
+ gnutls_psk_client_fuzzer$(EXEEXT) \
+ gnutls_psk_server_fuzzer$(EXEEXT) \
+ gnutls_reverse_idna_parser_fuzzer$(EXEEXT) \
+ gnutls_server_fuzzer$(EXEEXT) \
+ gnutls_srp_client_fuzzer$(EXEEXT) \
+ gnutls_srp_server_fuzzer$(EXEEXT) \
+ gnutls_set_trust_file_fuzzer$(EXEEXT) \
+ gnutls_x509_parser_fuzzer$(EXEEXT)
+
+check_PROGRAMS = $(FUZZERS)
+
+gnutls_base64_decoder_fuzzer_SOURCES = gnutls_base64_decoder_fuzzer.c main.c fuzzer.h
+gnutls_base64_encoder_fuzzer_SOURCES = gnutls_base64_encoder_fuzzer.c main.c fuzzer.h
+gnutls_client_fuzzer_SOURCES = gnutls_client_fuzzer.c main.c fuzzer.h
+gnutls_dn_parser_fuzzer_SOURCES = gnutls_dn_parser_fuzzer.c main.c fuzzer.h
+gnutls_idna_parser_fuzzer_SOURCES = gnutls_idna_parser_fuzzer.c main.c fuzzer.h
+gnutls_ocsp_req_parser_fuzzer_SOURCES = gnutls_ocsp_req_parser_fuzzer.c main.c fuzzer.h
+gnutls_ocsp_resp_parser_fuzzer_SOURCES = gnutls_ocsp_resp_parser_fuzzer.c main.c fuzzer.h
+gnutls_pkcs12_key_parser_fuzzer_SOURCES = gnutls_pkcs12_key_parser_fuzzer.c main.c fuzzer.h
+gnutls_pkcs7_parser_fuzzer_SOURCES = gnutls_pkcs7_parser_fuzzer.c main.c fuzzer.h
+gnutls_pkcs8_key_parser_fuzzer_SOURCES = gnutls_pkcs8_key_parser_fuzzer.c main.c fuzzer.h
+gnutls_private_key_parser_fuzzer_SOURCES = gnutls_private_key_parser_fuzzer.c main.c fuzzer.h
+gnutls_psk_client_fuzzer_SOURCES = gnutls_psk_client_fuzzer.c main.c fuzzer.h
+gnutls_psk_server_fuzzer_SOURCES = gnutls_psk_server_fuzzer.c main.c fuzzer.h
+gnutls_reverse_idna_parser_fuzzer_SOURCES = gnutls_reverse_idna_parser_fuzzer.c main.c fuzzer.h
+gnutls_server_fuzzer_SOURCES = gnutls_server_fuzzer.c main.c fuzzer.h
+gnutls_srp_client_fuzzer_SOURCES = gnutls_srp_client_fuzzer.c main.c fuzzer.h
+gnutls_srp_server_fuzzer_SOURCES = gnutls_srp_server_fuzzer.c main.c fuzzer.h
+gnutls_set_trust_file_fuzzer_SOURCES = gnutls_set_trust_file_fuzzer.c main.c fuzzer.h
+gnutls_x509_parser_fuzzer_SOURCES = gnutls_x509_parser_fuzzer.c main.c fuzzer.h
+
+gnutls_set_trust_file_fuzzer_LDADD = $(LDADD) -ldl
+
+
+#EXTRA_DIST = $(wildcard *.options) $(wildcard *.dict) \
+# $(wildcard *.in) $(wildcard *.repro)
+
+dist-hook:
+ find . -name '*.options' -exec cp -v '{}' $(distdir) ';'
+ find . -name '*.dict' -exec cp -v '{}' $(distdir) ';'
+ find . -name '*.in' -exec cp -vr '{}' $(distdir) ';'
+ find . -name '*.repro' -exec cp -vr '{}' $(distdir) ';'
+
+TESTS = $(FUZZERS)
+
+clean-local:
+ rm -rf *.gc?? *.log lcov
+
+oss-fuzz:
+ if test "$$OUT" != ""; then \
+ for ccfile in *_fuzzer.c; do \
+ fuzzer=$$(basename $$ccfile .c); \
+ XLIBS="-lnettle -lhogweed -ltasn1 -lgmp -lidn2 -lunistring"; \
+ $$CXX $$CXXFLAGS -I$(top_srcdir)/lib/includes/ -I$(top_srcdir) \
+ "$${fuzzer}.c" -o "$${fuzzer}" \
+ ../lib/.libs/libgnutls.a $${LIB_FUZZING_ENGINE} \
+ -Wl,-Bstatic \
+ $${XLIBS} \
+ -Wl,-Bdynamic; \
+ done; \
+ fi
+
+.PHONY: oss-fuzz