From 8f6afedafe1af00eb91ab42ad5c09b3cfccbe0b4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 25 Jul 2022 16:29:09 +0930 Subject: [PATCH] fuzz: fix fuzzing compilation. It had bitrotted. Signed-off-by: Rusty Russell --- Makefile | 2 +- tests/fuzz/Makefile | 4 +++- tests/fuzz/fuzz-close_tx.c | 2 +- tests/fuzz/fuzz-hsm_encryption.c | 3 ++- tests/fuzz/fuzz-initial_channel.c | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 83e9d4e0f..6730f97cd 100644 --- a/Makefile +++ b/Makefile @@ -661,7 +661,7 @@ $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS): # which brings its own main(). FUZZ_LDFLAGS = -fsanitize=fuzzer $(ALL_FUZZ_TARGETS): - @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) $(FUZZ_LDFLAGS) -o $@) + @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) libccan.a $(FUZZ_LDFLAGS) -o $@) # Everything depends on the CCAN headers, and Makefile diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index 6a6c35fa7..cf980ea1c 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -19,6 +19,7 @@ FUZZ_COMMON_OBJS := \ common/blockheight_states.o \ common/channel_config.o \ common/close_tx.o \ + common/configdir.o \ common/channel_id.o \ common/channel_type.o \ common/daemon.o \ @@ -32,13 +33,14 @@ FUZZ_COMMON_OBJS := \ common/permute_tx.o \ common/initial_channel.o \ common/initial_commit_tx.o \ - common/json.o \ + common/json_parse_simple.o \ common/json_stream.o \ common/key_derive.o \ common/keyset.o \ common/msg_queue.o \ common/memleak.o \ common/node_id.o \ + common/psbt_keypath.o \ common/wireaddr.o \ common/setup.o \ common/status.o \ diff --git a/tests/fuzz/fuzz-close_tx.c b/tests/fuzz/fuzz-close_tx.c index a0919d3bf..271515068 100644 --- a/tests/fuzz/fuzz-close_tx.c +++ b/tests/fuzz/fuzz-close_tx.c @@ -77,7 +77,7 @@ void run(const uint8_t *data, size_t size) PUBKEY_CMPR_LEN, pk2); funding_script = bitcoin_redeem_2of2(tmpctx, pk1, pk2); - create_close_tx(tmpctx, chainparams, our_script, + create_close_tx(tmpctx, chainparams, NULL, NULL, our_script, their_script, funding_script, &outpoint, funding, to_us, to_them, dust_limit); diff --git a/tests/fuzz/fuzz-hsm_encryption.c b/tests/fuzz/fuzz-hsm_encryption.c index 1f0a861e2..d0a18f736 100644 --- a/tests/fuzz/fuzz-hsm_encryption.c +++ b/tests/fuzz/fuzz-hsm_encryption.c @@ -17,6 +17,7 @@ void run(const uint8_t *data, size_t size) struct secret *hsm_secret, decrypted_hsm_secret, encryption_key; char *passphrase; struct encrypted_hsm_secret encrypted_secret; + char *emsg; /* Take the first 32 bytes as the plaintext hsm_secret seed, * and the remaining ones as the passphrase. */ @@ -24,7 +25,7 @@ void run(const uint8_t *data, size_t size) passphrase = to_string(NULL, data + 32, size - 32); /* A valid seed, a valid passphrase. This should not fail. */ - assert(!hsm_secret_encryption_key(passphrase, &encryption_key)); + assert(!hsm_secret_encryption_key_with_exitcode(passphrase, &encryption_key, &emsg)); /* Roundtrip */ assert(encrypt_hsm_secret(&encryption_key, hsm_secret, &encrypted_secret)); diff --git a/tests/fuzz/fuzz-initial_channel.c b/tests/fuzz/fuzz-initial_channel.c index 0eed31095..e76b1fc15 100644 --- a/tests/fuzz/fuzz-initial_channel.c +++ b/tests/fuzz/fuzz-initial_channel.c @@ -95,6 +95,7 @@ void run(const uint8_t *data, size_t size) wumbo, opener); /* TODO: make initial_channel_tx() work with ASAN.. */ + (void)channel; } clean_tmpctx();