| 257 | } |
| 258 | |
| 259 | bool decrypt_final_enctlv(const tal_t *ctx, |
| 260 | const struct pubkey *blinding, |
| 261 | const struct secret *ss, |
| 262 | const u8 *enctlv, |
| 263 | const struct pubkey *my_id, |
| 264 | struct pubkey *alias, |
| 265 | struct secret **path_id) |
| 266 | { |
| 267 | struct tlv_encrypted_data_tlv *encmsg; |
| 268 | struct secret node_id_blinding; |
| 269 | |
| 270 | /* Repeat the tweak to get the alias it was using for us */ |
| 271 | subkey_from_hmac("blinded_node_id", ss, &node_id_blinding); |
| 272 | *alias = *my_id; |
| 273 | if (secp256k1_ec_pubkey_tweak_mul(secp256k1_ctx, |
| 274 | &alias->pubkey, |
| 275 | node_id_blinding.data) != 1) |
| 276 | return false; |
| 277 | |
| 278 | encmsg = decrypt_encmsg(tmpctx, blinding, ss, enctlv); |
| 279 | if (!encmsg) |
| 280 | return false; |
| 281 | |
| 282 | if (tal_bytelen(encmsg->path_id) == sizeof(**path_id)) { |
| 283 | *path_id = tal(ctx, struct secret); |
| 284 | memcpy(*path_id, encmsg->path_id, sizeof(**path_id)); |
| 285 | } else |
| 286 | *path_id = NULL; |
| 287 | |
| 288 | return true; |
| 289 | } |
| 290 | |
| 291 | u8 *create_enctlv(const tal_t *ctx, |
| 292 | const struct privkey *blinding, |