ikev2: Only send one certificate request for the same CA
[strongswan.git] / fuzz / Makefile.am
index f2a84c1..3962896 100644 (file)
@@ -1,12 +1,34 @@
-AM_CPPFLAGS = \
+AM_CPPFLAGS = @CPPFLAGS@ \
        -I$(top_srcdir)/src/libstrongswan \
        -DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
        -DPLUGINS="\"${fuzz_plugins}\""
 
-noinst_PROGRAMS = fuzz_certs
+fuzz_ldflags = ${libfuzzer} \
+       $(top_builddir)/src/libstrongswan/.libs/libstrongswan.a \
+       -Wl,-Bstatic -lgmp -Wl,-Bdynamic \
+       @FUZZING_LDFLAGS@
 
-fuzz_certs_SOURCES = fuzz_certs.c
+FUZZ_TARGETS=fuzz_certs fuzz_crls
 
-fuzz_certs_LDFLAGS = libFuzzer.a -lstdc++
+all-local: $(FUZZ_TARGETS)
 
-fuzz_certs_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
+CLEANFILES=$(FUZZ_TARGETS)
+
+fuzz_certs: fuzz_certs.c ${libfuzzer}
+       $(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
+
+fuzz_crls: fuzz_crls.c ${libfuzzer}
+       $(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
+
+noinst_LIBRARIES = libFuzzerLocal.a
+libFuzzerLocal_a_SOURCES = libFuzzerLocal.c
+libFuzzerLocal_a_LIBADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
+
+check: all
+       for f in $(FUZZ_TARGETS); do \
+               corpus=$${f#fuzz_}; \
+               corpus=$${corpus%%_*}; \
+               ./$$f $(FUZZING_CORPORA)/$${corpus}/*; \
+               crashes=$(FUZZING_CORPORA)/$${corpus}-crash; \
+               test ! -d $${crashes} || ./$$f $${crashes}/*; \
+       done