MCPcopy Create free account
hub / github.com/ElementsProject/lightning / decrypt_final_enctlv

Function decrypt_final_enctlv

common/blindedpath.c:259–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259bool 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
291u8 *create_enctlv(const tal_t *ctx,
292 const struct privkey *blinding,

Callers 3

handle_onion_messageFunction · 0.85
test_final_decryptFunction · 0.85
mainFunction · 0.85

Calls 3

decrypt_encmsgFunction · 0.85
tal_bytelenFunction · 0.85
subkey_from_hmacFunction · 0.70

Tested by 2

test_final_decryptFunction · 0.68
mainFunction · 0.68