diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-15 20:53:25 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-15 20:53:25 +0200 |
| commit | 193d39d9b78a9e3c0c257b2e1e9f9dd4a7a13349 (patch) | |
| tree | c3b4eaf8df53babc7e37df4384d1be3be1cd9186 /librecrypt_next_algorithm.c | |
| parent | Fix some minor issues (diff) | |
| download | librecrypt-193d39d9b78a9e3c0c257b2e1e9f9dd4a7a13349.tar.gz librecrypt-193d39d9b78a9e3c0c257b2e1e9f9dd4a7a13349.tar.bz2 librecrypt-193d39d9b78a9e3c0c257b2e1e9f9dd4a7a13349.tar.xz | |
Misc
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_next_algorithm.c')
| -rw-r--r-- | librecrypt_next_algorithm.c | 25 |
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 |
