sphinx: process_onionpacket doesn't modify the packet.

Make it const.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-11-16 14:18:59 +10:30
parent 423572190b
commit 41299b679c
2 changed files with 7 additions and 7 deletions

View File

@ -181,7 +181,7 @@ static bool compute_hmac(
return true; 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]; 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, static void compute_blinding_factor(secp256k1_context *secpctx,
secp256k1_pubkey *key, const secp256k1_pubkey *key,
u8 sharedsecret[SHARED_SECRET_SIZE], const u8 sharedsecret[SHARED_SECRET_SIZE],
u8 res[BLINDING_FACTOR_SIZE]) u8 res[BLINDING_FACTOR_SIZE])
{ {
struct sha256_ctx ctx; struct sha256_ctx ctx;
@ -243,8 +243,8 @@ static void compute_blinding_factor(secp256k1_context *secpctx,
static bool blind_group_element( static bool blind_group_element(
secp256k1_context *secpctx, secp256k1_context *secpctx,
secp256k1_pubkey *blindedelement, secp256k1_pubkey *blindedelement,
secp256k1_pubkey *pubkey, const secp256k1_pubkey *pubkey,
u8 blind[BLINDING_FACTOR_SIZE]) const u8 blind[BLINDING_FACTOR_SIZE])
{ {
/* tweak_mul is inplace so copy first. */ /* tweak_mul is inplace so copy first. */
if (pubkey != blindedelement) if (pubkey != blindedelement)
@ -464,7 +464,7 @@ struct onionpacket *create_onionpacket(
struct route_step *process_onionpacket( struct route_step *process_onionpacket(
const tal_t *ctx, const tal_t *ctx,
secp256k1_context *secpctx, secp256k1_context *secpctx,
struct onionpacket *msg, const struct onionpacket *msg,
struct privkey *hop_privkey struct privkey *hop_privkey
) )
{ {

View File

@ -87,7 +87,7 @@ struct onionpacket *create_onionpacket(
struct route_step *process_onionpacket( struct route_step *process_onionpacket(
const tal_t * ctx, const tal_t * ctx,
secp256k1_context * secpctx, secp256k1_context * secpctx,
struct onionpacket *packet, const struct onionpacket *packet,
struct privkey *hop_privkey struct privkey *hop_privkey
); );