lightningnetwork / lightning-onion

Onion Routed Micropayments for the Lightning Network
MIT License
396 stars 125 forks source link

sphinx: pad out the starting packet with random bytes #40

Closed Roasbeef closed 4 years ago

Roasbeef commented 4 years ago

By padding out the starting packet with random bytes rather than leaving the zeroes in tact, we patch a privacy leak that may reveal a lower bound on the true route length to an adversarial exit node.

In order to reconcile this with our existing set of test vectors, we've introduced a new abstraction that allows the caller to specify how they want the starting bytes of the packet to be filled out. By default, all callers will use the randPacketFiller, but may also pass in the blankPacketFiller, if they packet construction to be deterministic.

Fixes #42.

Roasbeef commented 4 years ago

Latest push should now pass the build. We now require the caller specify a packet filler. In lnd and everywhere else, the randomPacketFiller should be used. For our test vectors, we're able to pass in a blankPacketFiller which doesn't actually do anything a (noop).