| 316 | } |
| 317 | |
| 318 | static void generate_prefill(void *dst, size_t dstlen, |
| 319 | size_t fixed_size, |
| 320 | const struct sphinx_path *path, |
| 321 | struct hop_params *params) |
| 322 | { |
| 323 | struct secret key; |
| 324 | size_t fillerStart, fillerSize; |
| 325 | |
| 326 | memset(dst, 0, dstlen); |
| 327 | for (int i = 0; i < tal_count(path->hops); i++) { |
| 328 | subkey_from_hmac("rho", ¶ms[i].secret, &key); |
| 329 | |
| 330 | /* Sum up how many bytes have been used by previous hops, |
| 331 | * that gives us the start in the stream */ |
| 332 | fillerSize = 0; |
| 333 | for (int j = 0; j < i; j++) |
| 334 | fillerSize += sphinx_hop_size(&path->hops[j]); |
| 335 | fillerStart = fixed_size - fillerSize - dstlen; |
| 336 | |
| 337 | /* Apply the cipher-stream to the part of the filler that'll |
| 338 | * be added by this hop */ |
| 339 | xor_cipher_stream_off(&key, fillerStart, dst, dstlen); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | static void compute_blinding_factor(const struct pubkey *key, |
| 344 | const struct secret *sharedsecret, |
no test coverage detected