From 193d39d9b78a9e3c0c257b2e1e9f9dd4a7a13349 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 15 May 2026 20:53:25 +0200 Subject: Misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- librecrypt_next_algorithm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'librecrypt_next_algorithm.c') 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 -- cgit v1.2.3-70-g09d2