We use the SHA(pubkey | publictweak); so reader cannot figure out the * tweak and derive the base key */
| 222 | /* We use the SHA(pubkey | publictweak); so reader cannot figure out the |
| 223 | * tweak and derive the base key */ |
| 224 | void 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 | } |
no test coverage detected