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

Function payer_key_tweak

common/bolt12_merkle.c:224–238  ·  view source on GitHub ↗

We use the SHA(pubkey | publictweak); so reader cannot figure out the * tweak and derive the base key */

Source from the content-addressed store, hash-verified

222/* We use the SHA(pubkey | publictweak); so reader cannot figure out the
223 * tweak and derive the base key */
224void payer_key_tweak(const struct point32 *bolt12,
225 const u8 *publictweak, size_t publictweaklen,
226 struct sha256 *tweak)
227{
228 u8 rawkey[32];
229 struct sha256_ctx sha;
230
231 secp256k1_xonly_pubkey_serialize(secp256k1_ctx, rawkey, &bolt12->pubkey);
232 sha256_init(&sha);
233 sha256_update(&sha, rawkey, sizeof(rawkey));
234 sha256_update(&sha,
235 memcheck(publictweak, publictweaklen),
236 publictweaklen);
237 sha256_done(&sha, tweak);
238}

Callers 2

handle_sign_bolt12Function · 0.85
payer_keyFunction · 0.85

Calls 3

sha256_initFunction · 0.85
sha256_updateFunction · 0.85
sha256_doneFunction · 0.85

Tested by

no test coverage detected