From 41299b679c32b79499ddd0011b5a3b1ac3623014 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 16 Nov 2016 14:18:59 +1030 Subject: [PATCH] sphinx: process_onionpacket doesn't modify the packet. Make it const. Signed-off-by: Rusty Russell --- daemon/sphinx.c | 12 ++++++------ daemon/sphinx.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon/sphinx.c b/daemon/sphinx.c index 35f99866b..8917528dc 100644 --- a/daemon/sphinx.c +++ b/daemon/sphinx.c @@ -181,7 +181,7 @@ static bool compute_hmac( return true; } -static void compute_packet_hmac(struct onionpacket *packet, u8 *mukey, u8 *hmac) +static void compute_packet_hmac(const struct onionpacket *packet, u8 *mukey, u8 *hmac) { u8 mactemp[ROUTING_INFO_SIZE + TOTAL_HOP_PAYLOAD_SIZE + MESSAGE_SIZE]; @@ -222,8 +222,8 @@ static bool generate_header_padding( } static void compute_blinding_factor(secp256k1_context *secpctx, - secp256k1_pubkey *key, - u8 sharedsecret[SHARED_SECRET_SIZE], + const secp256k1_pubkey *key, + const u8 sharedsecret[SHARED_SECRET_SIZE], u8 res[BLINDING_FACTOR_SIZE]) { struct sha256_ctx ctx; @@ -243,8 +243,8 @@ static void compute_blinding_factor(secp256k1_context *secpctx, static bool blind_group_element( secp256k1_context *secpctx, secp256k1_pubkey *blindedelement, - secp256k1_pubkey *pubkey, - u8 blind[BLINDING_FACTOR_SIZE]) + const secp256k1_pubkey *pubkey, + const u8 blind[BLINDING_FACTOR_SIZE]) { /* tweak_mul is inplace so copy first. */ if (pubkey != blindedelement) @@ -464,7 +464,7 @@ struct onionpacket *create_onionpacket( struct route_step *process_onionpacket( const tal_t *ctx, secp256k1_context *secpctx, - struct onionpacket *msg, + const struct onionpacket *msg, struct privkey *hop_privkey ) { diff --git a/daemon/sphinx.h b/daemon/sphinx.h index d9253b8bc..f688cb135 100644 --- a/daemon/sphinx.h +++ b/daemon/sphinx.h @@ -87,7 +87,7 @@ struct onionpacket *create_onionpacket( struct route_step *process_onionpacket( const tal_t * ctx, secp256k1_context * secpctx, - struct onionpacket *packet, + const struct onionpacket *packet, struct privkey *hop_privkey );