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>
diff --git a/bootstrap b/bootstrap
index 0416b54..2647495 100755
--- a/bootstrap
+++ b/bootstrap
@@ -63,4 +63,12 @@
printf "TSS2_MU_SRC = \$(TSS2_MU_C) \$(TSS2_MU_H)"
) > ${VARS_FILE}
+# Do not generate fuzz tests unless environment variable GEN_FUZZ is set to 1
+if test "${GEN_FUZZ}0" -eq 10; then
+ echo "Generating fuzz tests"
+ script/gen_fuzz.py
+else
+ touch Makefile-fuzz-generated.am
+fi
+
${AUTORECONF} --install --sym $@