aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/fuzz/Makefile21
-rw-r--r--tests/fuzz/README.md6
-rw-r--r--tests/fuzz/fuzz.c7
l---------tests/fuzz/sha3.c1
l---------tests/fuzz/sha3.h1
5 files changed, 36 insertions, 0 deletions
diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile
new file mode 100644
index 0000000..9c305a8
--- /dev/null
+++ b/tests/fuzz/Makefile
@@ -0,0 +1,21 @@
+CFLAGS=-g -fsanitize=address,fuzzer -W -Wall -Wextra -Werror -pedantic -std=c11
+APP=./fuzz-shake128
+OBJS=sha3.o fuzz.o
+CC=clang
+
+.PHONY=all clean fuzz
+
+all: $(APP)
+
+# build sample application
+$(APP): $(OBJS)
+ $(CC) -o $(APP) $(CFLAGS) $(OBJS)
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $<
+
+fuzz: $(APP)
+ $(APP)
+
+clean:
+ $(RM) -f $(APP) $(OBJS)
diff --git a/tests/fuzz/README.md b/tests/fuzz/README.md
new file mode 100644
index 0000000..2acf59d
--- /dev/null
+++ b/tests/fuzz/README.md
@@ -0,0 +1,6 @@
+# fuzz
+
+Initial fuzz testing based on [libFuzzer][].
+
+[libfuzzer]: http://libfuzzer.info/
+ "clang-based fuzzer."
diff --git a/tests/fuzz/fuzz.c b/tests/fuzz/fuzz.c
new file mode 100644
index 0000000..6045186
--- /dev/null
+++ b/tests/fuzz/fuzz.c
@@ -0,0 +1,7 @@
+#include "sha3.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *src, size_t len) {
+ uint8_t dst[128];
+ shake128_xof_once(src, len, dst, sizeof(dst));
+ return 0;
+}
diff --git a/tests/fuzz/sha3.c b/tests/fuzz/sha3.c
new file mode 120000
index 0000000..4748193
--- /dev/null
+++ b/tests/fuzz/sha3.c
@@ -0,0 +1 @@
+../../sha3.c \ No newline at end of file
diff --git a/tests/fuzz/sha3.h b/tests/fuzz/sha3.h
new file mode 120000
index 0000000..b7c53d4
--- /dev/null
+++ b/tests/fuzz/sha3.h
@@ -0,0 +1 @@
+../../sha3.h \ No newline at end of file