core-lightning/tests/fuzz/fuzz-base32-64.c
Rusty Russell 5787e18e69 fuzz: fix check-src/includes when fuzzing enabled.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-05 06:12:24 +09:30

26 lines
492 B
C

#include "config.h"
#include <assert.h>
#include <common/base32.h>
#include <common/base64.h>
#include <tests/fuzz/libfuzz.h>
void init(int *argc, char ***argv)
{
}
void run(const uint8_t *data, size_t size)
{
char *encoded;
uint8_t *decoded;
encoded = b32_encode(NULL, data, size);
decoded = b32_decode(NULL, encoded, strlen(encoded));
assert(memcmp(decoded, data, size) == 0);
tal_free(encoded);
tal_free(decoded);
encoded = b64_encode(NULL, data, size);
tal_free(encoded);
}