aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_next_algorithm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--librecrypt_next_algorithm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/librecrypt_next_algorithm.c b/librecrypt_next_algorithm.c
index 937a2f8..831f52e 100644
--- a/librecrypt_next_algorithm.c
+++ b/librecrypt_next_algorithm.c
@@ -7,6 +7,7 @@ extern inline char *librecrypt_next_algorithm(char **hash);
#else
+# ifndef FUZZ
static void
@@ -85,4 +86,28 @@ main(void)
}
+# else
+
+
+int
+LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ char *hash, *r;
+ size_t sum = 0u;
+ hash = malloc(size + 1u);
+ assert(hash);
+ memcpy(hash, data, size);
+ hash[size] = '\0';
+ for (;;) {
+ r = librecrypt_next_algorithm(&hash);
+ if (!r)
+ break;
+ sum += strlen(r) + 1u;
+ }
+ EXPECT(sum == size + 1u);
+ return 0;
+}
+
+
+# endif
#endif