Blinds node_id and calculates next blinding factor. */
| 15 | |
| 16 | /* Blinds node_id and calculates next blinding factor. */ |
| 17 | static bool blind_node(const struct privkey *path_privkey, |
| 18 | const struct secret *ss, |
| 19 | const struct pubkey *node, |
| 20 | struct pubkey *node_alias, |
| 21 | struct privkey *next_path_privkey) |
| 22 | { |
| 23 | struct pubkey path_pubkey; |
| 24 | struct sha256 h; |
| 25 | |
| 26 | if (!blindedpath_get_alias(ss, node, node_alias)) |
| 27 | return false; |
| 28 | SUPERVERBOSE("\t\"blinded_node_id\": \"%s\",\n", |
| 29 | fmt_pubkey(tmpctx, node_alias)); |
| 30 | |
| 31 | /* BOLT #4: |
| 32 | * - $`E_{i+1} = SHA256(E_i || ss_i) * E_i`$ |
| 33 | * (`path_key`. NB: $`N_i`$ MUST NOT learn $`e_i`$) |
| 34 | */ |
| 35 | if (!pubkey_from_privkey(path_privkey, &path_pubkey)) |
| 36 | return false; |
| 37 | SUPERVERBOSE("\t\"E\": \"%s\",\n", |
| 38 | fmt_pubkey(tmpctx, &path_pubkey)); |
| 39 | |
| 40 | /* BOLT #4: |
| 41 | * - $`e_{i+1} = SHA256(E_i || ss_i) * e_i`$ |
| 42 | * (ephemeral private path key, only known by $`N_r`$) |
| 43 | */ |
| 44 | blinding_hash_e_and_ss(&path_pubkey, ss, &h); |
| 45 | SUPERVERBOSE("\t\"H(E || ss)\": \"%s\",\n", |
| 46 | fmt_sha256(tmpctx, &h)); |
| 47 | blinding_next_path_privkey(path_privkey, &h, next_path_privkey); |
| 48 | SUPERVERBOSE("\t\"next_e\": \"%s\",\n", |
| 49 | fmt_privkey(tmpctx, next_path_privkey)); |
| 50 | |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | static u8 *enctlv_from_encmsg_raw(const tal_t *ctx, |
| 55 | const struct privkey *path_privkey, |
no test coverage detected