xref: /freebsd/crypto/krb5/src/tests/fuzzing/README (revision f1c4c3daccbaf3820f0e2224de53df12fc952fcc)
1*f1c4c3daSCy SchubertThis directory builds fuzzing targets for oss-fuzz compatibility.
2*f1c4c3daSCy Schubert If you wish to build it locally, you can do so by using the given
3*f1c4c3daSCy Schubert guide below. Note that it only works on GNU/Linux.
4*f1c4c3daSCy Schubert
5*f1c4c3daSCy SchubertExport flags required for building fuzzing targets.
6*f1c4c3daSCy Schubert```bash
7*f1c4c3daSCy Schubertexport CC=clang
8*f1c4c3daSCy Schubertexport CXX=clang++
9*f1c4c3daSCy Schubertexport CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link"
10*f1c4c3daSCy Schubertexport CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link"
11*f1c4c3daSCy Schubertexport LIB_FUZZING_ENGINE="-fsanitize=fuzzer"
12*f1c4c3daSCy Schubert```
13*f1c4c3daSCy Schubert
14*f1c4c3daSCy SchubertCompilation of the fuzzing targets.
15*f1c4c3daSCy Schubert```bash
16*f1c4c3daSCy Schubertautoreconf
17*f1c4c3daSCy Schubert./configure CFLAGS="-fcommon $CFLAGS" CXXFLAGS="-fcommon $CXXFLAGS" \
18*f1c4c3daSCy Schubert    --enable-static --disable-shared --enable-ossfuzz
19*f1c4c3daSCy Schubertmake
20*f1c4c3daSCy Schubert```
21*f1c4c3daSCy Schubert
22*f1c4c3daSCy SchubertRunning fuzzing targets.
23*f1c4c3daSCy Schubert```bash
24*f1c4c3daSCy Schubertmkdir fuzz_${TARGET}_corpus
25*f1c4c3daSCy Schubert./fuzz_${TARGET} fuzz_${TARGET}_corpus/ fuzz_${TARGET}_seed_corpus
26*f1c4c3daSCy Schubert```
27