Add four, basic fuzz tests.

This change adds fuzzing tests for:
  ∙ Certificate parsing
  ∙ Private key parsing
  ∙ ClientHello parsing
  ∙ Server first flow (ServerHello, Certificate, etc) parsing.

Change-Id: I5f53282263eaaff69b1a03c819cca73750433653
Reviewed-by: Adam Langley <>
diff --git a/ b/
new file mode 100644
index 0000000..db7bb91
--- /dev/null
+++ b/
@@ -0,0 +1,25 @@
+# Fuzz testing
+Modern fuzz testers are very effective and we wish to use them to ensure that no silly bugs creep into BoringSSL.
+We primarily use Clang's [libFuzzer]( for fuzz testing and there are a number of fuzz testing functions in `fuzz/`. They are not built by default because they require libFuzzer at build time.
+In order to build the fuzz tests you will need at least Clang 3.7. Pass `-DFUZZ` on the CMake command line and enable building BoringSSL with coverage and AddressSanitizer, and to build the fuzz test binaries. In order for the fuzz tests to link, the linker needs to find libFuzzer. This is not commonly provided and you may need to download the [Clang source code]( and do the following:
+cd llvm-3.7.0.src/lib
+clang -c -g -O2 -std=c++11 Fuzzer/*.cpp -IFuzzer
+ar q libFuzzer.a *.o
+sudo cp libFuzzer.a /usr/lib
+sudo chmod a+r /usr/lib/libFuzzer.a
+From the `build/` directory, you can then run the fuzzers. For example:
+./fuzz/cert -max_len=4000 -jobs=32 -workers=32 ../fuzz/cert_corpus/
+The `max_len` argument is often important because, without it, libFuzzer defaults to limiting all test cases to 64 bytes, which is often insufficient for the formats that we wish to fuzz. The arguments to `jobs` and `workers` should be the number of cores that you wish to dedicate to fuzzing.
+There are directories in `fuzz/` for each of the fuzzing tests which contain seed files for fuzzing. Some of the seed files were generated manually but many of them are “interesting” results generated by the fuzzing itself. (Where “interesting” means that it triggered a previously unknown path in the code.)