diff options
author | John Andersen <john.s.andersen@intel.com> | 2019-01-16 13:59:16 -0800 |
---|---|---|
committer | Tadeusz Struk <tadeusz.struk@intel.com> | 2019-02-27 10:12:03 -0800 |
commit | 4eab6da6bb877eeb89ee073411220a559d05cd5c (patch) | |
tree | ef2fc5a340bb0d4332a6ab79d4f6df7599f2e4b6 /Makefile-fuzz.am | |
parent | 443455b885c5e51aaeab691ebba31090a8809d68 (diff) | |
download | tpm2-tss-4eab6da6bb877eeb89ee073411220a559d05cd5c.tar.gz |
test: fuzz: Generate libfuzzer and OSS Fuzz tests
* Added python script gen_fuzz.py which reads include/tss2/tss2_sys.h
and generates a fuzz target for all _Prepare and _Complete calls. It
also generates Makefile-fuzz-generated.am for building each fuzz test.
* Modified Makefile-fuzz.am to include Makefile-fuzz-generated.am
* Added test/fuzz/main-sapi.cpp which defines a libfuzzer target used to
fuzz SAPI calls.
Signed-off-by: John Andersen <john.s.andersen@intel.com>
Diffstat (limited to 'Makefile-fuzz.am')
-rw-r--r-- | Makefile-fuzz.am | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile-fuzz.am b/Makefile-fuzz.am index b7b917f0..390ee05b 100644 --- a/Makefile-fuzz.am +++ b/Makefile-fuzz.am @@ -2,6 +2,8 @@ # Copyright (c) 2019 Intel Corporation # All rights reserved. +TEST_EXTENSIONS += .fuzz +FUZZ_LOG_COMPILER = $(srcdir)/script/fuzz-log-compiler.sh INCLUDE_DIRS += -I$(srcdir)/test/fuzz/tcti # tcti library used for fuzzing @@ -15,3 +17,25 @@ test_fuzz_tcti_libtss2_tcti_fuzzing_la_SOURCES = \ src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \ test/fuzz/tcti/tcti-fuzzing.c test/fuzz/tcti/tcti-fuzzing.h endif # ENABLE_TCTI_FUZZING + +if ENABLE_FUZZING +FUZZ_CFLAGS = $(TESTS_CFLAGS) -I$(srcdir)/test/integration +FUZZ_CPPFLAGS = $(INCLUDE_DIRS) -I$(srcdir)/test/integration \ + $(LIB_FUZZING_ENGINE) +FUZZ_LDADD = $(TESTS_LDADD) $(FUZZ_LDFLAGS) + +noinst_LTLIBRARIES += test/fuzz/libfuzz_utils.la +test_fuzz_libfuzz_utils_la_CFLAGS = $(AM_CFLAGS) $(FUZZ_CFLAGS) +test_fuzz_libfuzz_utils_la_SOURCES = \ + test/integration/sapi-context-util.c test/integration/context-util.h \ + test/integration/sapi-test-options.c test/integration/test-options.h + +fuzzdir = $(srcdir) +fuzz-targets: $(fuzz_PROGRAMS) + +check_PROGRAMS += $(TESTS_FUZZ) +fuzz_PROGRAMS = $(TESTS_FUZZ) +FUZZ = $(check_PROGRAMS) + +include Makefile-fuzz-generated.am +endif # ENABLE_FUZZING |