| 128 | } |
| 129 | |
| 130 | bool 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 | |
| 151 | static u8 *decrypt_encmsg_raw(const tal_t *ctx, |
| 152 | const struct pubkey *blinding, |