common/sphinx: eliminate temporary buffer for prefill.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2020-12-08 17:18:53 +10:30 committed by Christian Decker
parent b5ab7e3ce3
commit dc67b60e28
1 changed files with 1 additions and 3 deletions

View File

@ -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. */