sphinx: Variable left-shift when unwrapping onion

This is all it takes on the read side to use multiple frames. We are
overshooting the padding a bit since we can at most use 16 additional frames,
but ChaCha20 is cheap.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-02-20 14:27:37 +01:00
committed by Rusty Russell
parent 7bc4cf83b1
commit d607afd195
2 changed files with 63 additions and 8 deletions

View File

@@ -83,15 +83,24 @@ struct hop_data {
struct short_channel_id channel_id;
struct amount_msat amt_forward;
u32 outgoing_cltv;
/* Padding omitted, will be zeroed */
u8 hmac[HMAC_SIZE];
};
enum sphinx_payload_type {
SPHINX_V0_PAYLOAD = 0,
SPHINX_RAW_PAYLOAD = 255,
};
struct route_step {
enum route_next_case nextcase;
struct onionpacket *next;
struct hop_data hop_data;
u8 realm;
enum sphinx_payload_type type;
union {
struct hop_data v0;
} payload;
u8 *raw_payload;
u8 payload_frames;
};
/**