mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
channeld: use pointer for shared secret.
It's more natural than using a zero-secret when something goes wrong. Also note that the HSM will actually kill the connection if the ECDH fails, which is fortunately statistically unlikely. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
7e01efbd1f
commit
66de6b84be
@@ -72,12 +72,13 @@ void peer_failed_connection_lost(void)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
bool hsm_do_ecdh(struct secret *ss, const struct pubkey *point)
|
||||
struct secret *hsm_do_ecdh(const tal_t *ctx, const struct pubkey *point)
|
||||
{
|
||||
struct secret *ss = tal(ctx, struct secret);
|
||||
if (secp256k1_ecdh(secp256k1_ctx, ss->data, &point->pubkey,
|
||||
notsosecret.data) != 1)
|
||||
errx(1, "ECDH failed");
|
||||
return true;
|
||||
return tal_free(ss);
|
||||
return ss;
|
||||
}
|
||||
|
||||
/* We don't want to discard *any* messages. */
|
||||
|
||||
Reference in New Issue
Block a user