From a38d0c985ebf2bfda396deae9ad04acb61803d53 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 22 Jan 2016 06:41:37 +1030 Subject: [PATCH] Makefile: more fascist warnings. Signed-off-by: Rusty Russell --- Makefile | 5 ++++- state.h | 6 ++++++ test/onion_key.c | 2 +- test/test_onion.c | 27 ++++++++++++++++----------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 689dacec0..229d8ff9f 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,10 @@ CDUMP_OBJS := ccan-cdump.o ccan-strmap.o PROGRAMS := $(TEST_CLI_PROGRAMS) $(TEST_PROGRAMS) -CFLAGS := -g -Wall -I $(CCANDIR) -I secp256k1/include/ $(FEATURES) +CWARNFLAGS := -Werror -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition +CDEBUGFLAGS := -g -fstack-protector +CFLAGS := $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) -I secp256k1/include/ $(FEATURES) + LDLIBS := -lcrypto -lprotobuf-c $(PROGRAMS): CFLAGS+=-I. diff --git a/state.h b/state.h index b096725be..61c2953b2 100644 --- a/state.h +++ b/state.h @@ -393,4 +393,10 @@ struct bitcoin_tx *bitcoin_htlc_spend(const tal_t *ctx, const struct state_data *sdata, const struct htlc *htlc); +struct htlc_rval *r_value_from_cmd(const tal_t *ctx, + const struct state_data *sdata, + const struct htlc *htlc); +struct htlc_rval *bitcoin_r_value(const tal_t *ctx, const struct htlc *htlc); +struct htlc_rval *r_value_from_pkt(const tal_t *ctx, const Pkt *pkt); + #endif /* LIGHTNING_STATE_H */ diff --git a/test/onion_key.c b/test/onion_key.c index 06f1fe7cf..5af7ecf0a 100644 --- a/test/onion_key.c +++ b/test/onion_key.c @@ -44,7 +44,7 @@ static void gen_keys(secp256k1_context *ctx, assert(len == sizeof(pubkey->u8)); } -void print_keypair(bool pub, bool priv) +static void print_keypair(bool pub, bool priv) { secp256k1_context *ctx; struct seckey seckey; diff --git a/test/test_onion.c b/test/test_onion.c index 7a44173b9..4ca408b34 100644 --- a/test/test_onion.c +++ b/test/test_onion.c @@ -281,7 +281,8 @@ static bool aes_decrypt(void *dst, const void *src, size_t len, return true; } -void dump_contents(const void *data, size_t n) +#if 0 +static void dump_contents(const void *data, size_t n) { size_t i; const unsigned char *p = memcheck(data, n); @@ -292,6 +293,7 @@ void dump_contents(const void *data, size_t n) printf("\n"); } } +#endif static bool aes_encrypt_offset(size_t offset, void *dst, const void *src, size_t len, @@ -345,7 +347,8 @@ static void make_hmac(const struct hop *hops, size_t num_hops, HMAC_Final(&ctx, hmac->u.u8, NULL); } -void _dump_hex(unsigned char *x, size_t s) { +#if 0 +static void _dump_hex(unsigned char *x, size_t s) { printf(" "); while (s > 0) { printf("%02x", *x); @@ -353,12 +356,14 @@ void _dump_hex(unsigned char *x, size_t s) { } } #define dump_hex(x) _dump_hex((void*)&x, sizeof(x)) -void dump_pkey(secp256k1_context *ctx, secp256k1_pubkey pkey) { + +static void dump_pkey(secp256k1_context *ctx, secp256k1_pubkey pkey) { unsigned char tmp[65]; size_t len; secp256k1_ec_pubkey_serialize(ctx, tmp, &len, &pkey, 0); dump_hex(tmp); } +#endif static bool check_hmac(struct onion *onion, const struct hmackey *hmackey) { @@ -368,10 +373,10 @@ static bool check_hmac(struct onion *onion, const struct hmackey *hmackey) return CRYPTO_memcmp(&hmac, &myhop(onion)->hmac, sizeof(hmac)) == 0; } -bool create_onion(const secp256k1_pubkey pubkey[], - char *const msg[], - size_t num, - struct onion *onion) +static bool create_onion(const secp256k1_pubkey pubkey[], + char *const msg[], + size_t num, + struct onion *onion) { int i; struct seckey seckeys[MAX_HOPS]; @@ -497,8 +502,8 @@ static bool pubkey_parse(const secp256k1_context *ctx, * * Returns enckey and pad_iv for use in unwrap. */ -bool decrypt_onion(const struct seckey *myseckey, struct onion *onion, - struct enckey *enckey, struct iv *pad_iv) +static bool decrypt_onion(const struct seckey *myseckey, struct onion *onion, + struct enckey *enckey, struct iv *pad_iv) { secp256k1_context *ctx; unsigned char secret[32]; @@ -562,8 +567,8 @@ fail: } /* Get next layer of onion, for forwarding. */ -bool peel_onion(struct onion *onion, - const struct enckey *enckey, const struct iv *pad_iv) +static bool peel_onion(struct onion *onion, + const struct enckey *enckey, const struct iv *pad_iv) { /* Move next one to back. */ memmove(&onion->hop[1], &onion->hop[0],