From 991ff882fd128f2010728c701cb1374fb8e43e10 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 2 Jun 2019 13:17:31 +0300 Subject: [PATCH] tests: New style fuzzing tool for X.509 certificate parsing This is a newer version of tests/test-x509 tool. Signed-off-by: Jouni Malinen --- tests/fuzzing/x509/Makefile | 20 ++++++++++++++++++++ tests/fuzzing/x509/corpus/ca.der | Bin 0 -> 560 bytes tests/fuzzing/x509/x509.c | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/fuzzing/x509/Makefile create mode 100644 tests/fuzzing/x509/corpus/ca.der create mode 100644 tests/fuzzing/x509/x509.c diff --git a/tests/fuzzing/x509/Makefile b/tests/fuzzing/x509/Makefile new file mode 100644 index 000000000..d7f751a9d --- /dev/null +++ b/tests/fuzzing/x509/Makefile @@ -0,0 +1,20 @@ +all: x509 +include ../rules.include + +LIBS += $(SRC)/common/libcommon.a +LIBS += $(SRC)/crypto/libcrypto.a +LIBS += $(SRC)/tls/libtls.a +LIBS += $(SRC)/utils/libutils.a + +ELIBS += $(SRC)/crypto/libcrypto.a +ELIBS += $(SRC)/tls/libtls.a + +x509: x509.o $(OBJS) $(LIBS) + $(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS) + +clean: + $(MAKE) -C $(SRC) clean + $(MAKE) -C $(WPAS_SRC) clean + rm -f x509 *~ *.o *.d ../*~ ../*.o ../*.d + +-include $(OBJS:%.o=%.d) diff --git a/tests/fuzzing/x509/corpus/ca.der b/tests/fuzzing/x509/corpus/ca.der new file mode 100644 index 0000000000000000000000000000000000000000..09d5fa051bf308db6af69760ef3b1dc3776b6eb8 GIT binary patch literal 560 zcmXqLV$v~aVw}2wnTe5!iId^R<;TlTKR$ENfR~L^tIebBJ1-+6D=UM6z9F{(CmVAp z3!5;Lo2Mb40S}17#lu=|sF#*$C}6+`;xqHG2j%CNC^$PB$cghB8XK4ySsI#|7#bNx ziSrtPxaLqU=>|5=M|KkC#qWv{R6 z+II2zW>Kb{Ow5c7jEe&d{0wA)!63`WBE}-JW7569T@srO4$lw$Y#h7ggl3nch=Dvv zTA4+{K&%0~0#LBZ3bU{pFf%g#NA@r<5}1KLl{#OZ;NpBFlyByP&Q&`vR~v1QnNxG> zU(b~($KpOWOU7$PW-Rf)!=ksN@IbEhI>skEJ7%6a*R(H7oszR56QpXZL + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#include "includes.h" + +#include "common.h" +#include "tls/x509v3.h" +#include "../fuzzer-common.h" + + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + struct x509_certificate *cert; + + wpa_fuzzer_set_debug_level(); + + cert = x509_certificate_parse(data, size); + x509_certificate_free(cert); + return 0; +}