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

Function unblind_onion

common/blindedpath.c:130–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130bool unblind_onion(const struct pubkey *blinding,
131 void (*ecdh)(const struct pubkey *point, struct secret *ss),
132 struct pubkey *onion_key,
133 struct secret *ss)
134{
135 struct secret hmac;
136
137 /* E(i) */
138 ecdh(blinding, ss);
139
140 /* b(i) = HMAC256("blinded_node_id", ss(i)) * k(i) */
141 subkey_from_hmac("blinded_node_id", ss, &hmac);
142
143 /* We instead tweak the *ephemeral* key from the onion and use
144 * our normal privkey: since hsmd knows only how to ECDH with
145 * our real key */
146 return secp256k1_ec_pubkey_tweak_mul(secp256k1_ctx,
147 &onion_key->pubkey,
148 hmac.data) == 1;
149}
150
151static u8 *decrypt_encmsg_raw(const tal_t *ctx,
152 const struct pubkey *blinding,

Callers 5

handle_onion_messageFunction · 0.85
next_onionFunction · 0.85
test_decryptFunction · 0.85
test_final_decryptFunction · 0.85
mainFunction · 0.85

Calls 2

ecdhFunction · 0.70
subkey_from_hmacFunction · 0.70

Tested by 4

next_onionFunction · 0.68
test_decryptFunction · 0.68
test_final_decryptFunction · 0.68
mainFunction · 0.68