Browse Source

common/sphinx: eliminate temporary buffer for prefill.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
fix-mocks
Rusty Russell 4 years ago
committed by Christian Decker
parent
commit
dc67b60e28
  1. 4
      common/sphinx.c

4
common/sphinx.c

@ -452,15 +452,13 @@ static void sphinx_prefill(u8 *routinginfo, const struct sphinx_path *sp,
size_t last_hop_size = sphinx_hop_size(&sp->hops[num_hops - 1]);
int prefill_offset =
ROUTING_INFO_SIZE - fillerSize - last_hop_size - prefill_size;
u8 prefill[prefill_size];
struct secret shared_secret;
/* Generate the prefill stream, which cancels out the layers of
* encryption that will be applied while wrapping the onion. This
* leaves the middle, unused, section with all 0x00 bytes after
* encrypting. */
generate_prefill(prefill, prefill_size, sp, params);
memcpy(routinginfo + prefill_offset, prefill, prefill_size);
generate_prefill(routinginfo + prefill_offset, prefill_size, sp, params);
/* Now fill in the obfuscation stream, which can be regenerated by the
* node processing this onion. */

Loading…
Cancel
Save