We derive invoice secret using 1-way function from payment_preimage * (just a different one from the payment_hash!) */
| 127 | /* We derive invoice secret using 1-way function from payment_preimage |
| 128 | * (just a different one from the payment_hash!) */ |
| 129 | static void invoice_secret(const struct preimage *payment_preimage, |
| 130 | struct secret *payment_secret) |
| 131 | { |
| 132 | struct preimage modified; |
| 133 | struct sha256 secret; |
| 134 | |
| 135 | modified = *payment_preimage; |
| 136 | modified.r[0] ^= 1; |
| 137 | |
| 138 | sha256(&secret, modified.r, |
| 139 | ARRAY_SIZE(modified.r) * sizeof(*modified.r)); |
| 140 | BUILD_ASSERT(sizeof(secret.u.u8) == sizeof(payment_secret->data)); |
| 141 | memcpy(payment_secret->data, secret.u.u8, sizeof(secret.u.u8)); |
| 142 | } |
| 143 | |
| 144 | /* FIXME: This is a hack. The real secret should be a signature of some |
| 145 | * onion key, using the payer_id */ |
no test coverage detected