fuzz: Added PA-TNC fuzzer
[strongswan.git] / fuzz / Makefile.am
1 AM_CPPFLAGS = @CPPFLAGS@ \
2         -I$(top_srcdir)/src/libstrongswan \
3         -I$(top_srcdir)/src/libimcv \
4         -I$(top_srcdir)/src/libtncif \
5         -I$(top_srcdir)/src/libtpmtss \
6         -DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
7         -DPLUGINS="\"${fuzz_plugins}\""
8
9 fuzz_ldflags = ${libfuzzer} \
10         $(top_builddir)/src/libstrongswan/.libs/libstrongswan.a \
11         -Wl,-Bstatic -lgmp -Wl,-Bdynamic \
12         @FUZZING_LDFLAGS@
13
14 pa_tnc_ldflags = \
15         $(top_builddir)/src/libimcv/.libs/libimcv.a \
16         $(top_builddir)/src/libtncif/.libs/libtncif.a \
17         $(top_builddir)/src/libtpmtss/.libs/libtpmtss.a \
18         $(fuzz_ldflags)
19
20 FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_pa_tnc
21
22 all-local: $(FUZZ_TARGETS)
23
24 CLEANFILES=$(FUZZ_TARGETS)
25
26 fuzz_certs: fuzz_certs.c ${libfuzzer}
27         $(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
28
29 fuzz_crls: fuzz_crls.c ${libfuzzer}
30         $(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
31
32 fuzz_pa_tnc: fuzz_pa_tnc.c ${libfuzzer}
33         $(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(pa_tnc_ldflags)
34
35 noinst_LIBRARIES = libFuzzerLocal.a
36 libFuzzerLocal_a_SOURCES = libFuzzerLocal.c
37 libFuzzerLocal_a_LIBADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
38
39 check: all
40         for f in $(FUZZ_TARGETS); do \
41                 corpus=$${f#fuzz_}; \
42                 ./$$f $(FUZZING_CORPORA)/$${corpus}/*; \
43                 crashes=$(FUZZING_CORPORA)/$${corpus}-crash; \
44                 test ! -d $${crashes} || ./$$f $${crashes}/*; \
45         done