| 344 | } |
| 345 | |
| 346 | static void generate_prefill(void *dst, size_t dstlen, |
| 347 | size_t fixed_size, |
| 348 | const struct sphinx_path *path, |
| 349 | struct hop_params *params) |
| 350 | { |
| 351 | struct secret key; |
| 352 | size_t fillerStart, fillerSize; |
| 353 | |
| 354 | memset(dst, 0, dstlen); |
| 355 | for (int i = 0; i < tal_count(path->hops); i++) { |
| 356 | subkey_from_hmac("rho", ¶ms[i].secret, &key); |
| 357 | |
| 358 | /* Sum up how many bytes have been used by previous hops, |
| 359 | * that gives us the start in the stream */ |
| 360 | fillerSize = 0; |
| 361 | for (int j = 0; j < i; j++) |
| 362 | fillerSize += sphinx_hop_size(&path->hops[j]); |
| 363 | fillerStart = fixed_size - fillerSize - dstlen; |
| 364 | |
| 365 | /* Apply the cipher-stream to the part of the filler that'll |
| 366 | * be added by this hop */ |
| 367 | xor_cipher_stream_off(&key, fillerStart, dst, dstlen); |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | static void compute_blinding_factor(const struct pubkey *key, |
| 372 | const struct secret *sharedsecret, |
no test coverage detected