| 477 | } |
| 478 | |
| 479 | static void sphinx_prefill(u8 *routinginfo, const struct sphinx_path *sp, |
| 480 | size_t prefill_size, struct hop_params *params, |
| 481 | size_t fixed_size) |
| 482 | { |
| 483 | int num_hops = tal_count(sp->hops); |
| 484 | size_t fillerSize = sphinx_path_payloads_size(sp) - |
| 485 | sphinx_hop_size(&sp->hops[num_hops - 1]); |
| 486 | size_t last_hop_size = sphinx_hop_size(&sp->hops[num_hops - 1]); |
| 487 | int prefill_offset = |
| 488 | fixed_size - fillerSize - last_hop_size - prefill_size; |
| 489 | struct secret shared_secret; |
| 490 | |
| 491 | /* Generate the prefill stream, which cancels out the layers of |
| 492 | * encryption that will be applied while wrapping the onion. This |
| 493 | * leaves the middle, unused, section with all 0x00 bytes after |
| 494 | * encrypting. */ |
| 495 | generate_prefill(routinginfo + prefill_offset, prefill_size, |
| 496 | fixed_size, sp, params); |
| 497 | |
| 498 | /* Now fill in the obfuscation stream, which can be regenerated by the |
| 499 | * node processing this onion. */ |
| 500 | sphinx_create_shared_secret(&shared_secret, sp->rendezvous_id, sp->session_key); |
| 501 | sphinx_prefill_stream_xor(routinginfo + prefill_offset, prefill_size, &shared_secret); |
| 502 | } |
| 503 | |
| 504 | struct onionpacket *create_onionpacket( |
| 505 | const tal_t *ctx, |
no test coverage detected