Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ-
Binary file not shown.
6 changes: 3 additions & 3 deletions tests/fuzz/fuzz-full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* from that test.
*/
#include "config.h"
#include <fcntl.h>
#include <common/blockheight_states.h>
#include <ccan/ccan/array_size/array_size.h>
#include <channeld/full_channel.h>
#include <common/blockheight_states.h>
#include <common/channel_type.h>
#include <common/fee_states.h>
#include <common/htlc_wire.h>
#include <common/setup.h>
#include <common/status.h>
#include <channeld/full_channel.h>
#include <fcntl.h>
#include <tests/fuzz/libfuzz.h>

/* MOCKS START */
Expand Down
10 changes: 5 additions & 5 deletions tests/fuzz/fuzz-handle_onion_message.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "config.h"
#include <fcntl.h>
#include <setjmp.h>
#include <secp256k1_ecdh.h>
#include <common/daemon_conn.h>
#include <common/ecdh.h>
#include <common/setup.h>
#include <common/status.h>
#include <common/wire_error.h>
#include <connectd/connectd_wiregen.h>
#include <connectd/connectd.h>
#include <connectd/connectd_wiregen.h>
#include <connectd/multiplex.h>
#include <connectd/onion_message.h>
#include <wire/peer_wiregen.h>
#include <fcntl.h>
#include <secp256k1_ecdh.h>
#include <setjmp.h>
#include <tests/fuzz/libfuzz.h>
#include <wire/peer_wiregen.h>

static int lightningd_fd;
static struct privkey priv;
Expand Down
11 changes: 6 additions & 5 deletions tests/fuzz/fuzz-hsm_secret.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ void init(int *argc, char ***argv)

void run(const uint8_t *data, size_t size)
{
/* 4294967295 is crypto_pwhash_argon2id_PASSWD_MAX. libfuzzer won't
* generate inputs that large in practice, but hey. */
if (size > 32 && size < 4294967295) {
/* LibFuzzer won't generate inputs larger than
* crypto_pwhash_argon2id_PASSWD_MAX in practice, but hey. */
if (size > sizeof(struct secret) && size < crypto_pwhash_argon2id_PASSWD_MAX) {
struct secret *hsm_secret, *encryption_key;
char *passphrase;
u8 encrypted_data[ENCRYPTED_HSM_SECRET_LEN];
Expand All @@ -31,8 +31,9 @@ void run(const uint8_t *data, size_t size)

/* Take the first 32 bytes as the plaintext hsm_secret seed,
* and the remaining ones as the passphrase. */
hsm_secret = (struct secret *)tal_dup_arr(NULL, u8, data, 32, 0);
passphrase = to_string(NULL, data + 32, size - 32);
hsm_secret = (struct secret *)tal_dup_arr(NULL, u8, data, sizeof(struct secret), 0);
mlock_tal_memory(hsm_secret);
passphrase = to_string(NULL, data + sizeof(struct secret), size - sizeof(struct secret));

/* A valid seed, a valid passphrase. This should not fail. */
encryption_key = get_encryption_key(NULL, passphrase);
Expand Down
Loading