From dc67b60e28e217f298ed59d9be9ff6754c757786 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 8 Dec 2020 17:18:53 +1030 Subject: [PATCH] common/sphinx: eliminate temporary buffer for prefill. Signed-off-by: Rusty Russell --- common/sphinx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/sphinx.c b/common/sphinx.c index 016a47e41..44429c6d5 100644 --- a/common/sphinx.c +++ b/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. */