Skip to content

Commit a377994

Browse files
committed
Added check-future-secret.
1 parent 9cf9bd3 commit a377994

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

contrib/remote_hsmd/NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ Some popular tests:
6464

6565
# sign-mutual-close
6666
export THETEST=tests/test_closing.py::test_closing
67+
68+
# check-future-secret
69+
export THETEST=tests/test_connection.py::test_dataloss_protection
6770

6871
rust-lightning-signer
6972
----------------------------------------------------------------

contrib/remote_hsmd/TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ COMPLETE proxy_stat proxy_handle_sign_delayed_payment_to_us
2626
COMPLETE proxy_stat proxy_handle_sign_penalty_to_us
2727
COMPLETE proxy_stat proxy_handle_sign_commitment_tx
2828
COMPLETE proxy_stat proxy_handle_sign_mutual_close_tx
29+
COMPLETE proxy_stat proxy_handle_check_future_secret
2930
3031
PARTIAL (-P2SH) proxy_stat proxy_handle_sign_withdrawal_tx
3132
3233
MARSHALED proxy_stat proxy_init_hsm
3334
MARSHALED proxy_stat proxy_handle_sign_message
3435
MARSHALED proxy_stat proxy_handle_cannouncement_sig
35-
MARSHALED proxy_stat proxy_handle_check_future_secret
3636
```
3737

3838
Improvements

contrib/remote_hsmd/hsmd.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,10 +1364,8 @@ static struct io_plan *handle_check_future_secret(struct io_conn *conn,
13641364
struct client *c,
13651365
const u8 *msg_in)
13661366
{
1367-
struct secret channel_seed;
1368-
struct sha256 shaseed;
13691367
u64 n;
1370-
struct secret secret, suggested;
1368+
struct secret suggested;
13711369

13721370
if (!fromwire_hsm_check_future_secret(msg_in, &n, &suggested))
13731371
return bad_req(conn, c, msg_in);
@@ -1383,25 +1381,11 @@ static struct io_plan *handle_check_future_secret(struct io_conn *conn,
13831381
return bad_req_fmt(conn, c, msg_in,
13841382
"proxy_%s error: %s", __FUNCTION__,
13851383
proxy_last_message());
1386-
g_proxy_impl = PROXY_IMPL_MARSHALED;
1387-
1388-
/* FIXME - REPLACE BELOW W/ REMOTE RETURN */
1389-
1390-
get_channel_seed(&c->id, c->dbid, &channel_seed);
1391-
if (!derive_shaseed(&channel_seed, &shaseed))
1392-
return bad_req_fmt(conn, c, msg_in, "bad derive_shaseed");
1393-
1394-
if (!per_commit_secret(&shaseed, &secret, n))
1395-
return bad_req_fmt(conn, c, msg_in,
1396-
"bad commit secret #%"PRIu64, n);
1384+
g_proxy_impl = PROXY_IMPL_COMPLETE;
13971385

1398-
/*~ Note the special secret_eq_consttime: we generate foo_eq for many
1399-
* types using ccan/structeq, but not 'struct secret' because any
1400-
* comparison risks leaking information about the secret if it is
1401-
* timing dependent. */
14021386
return req_reply(conn, c,
14031387
take(towire_hsm_check_future_secret_reply(NULL,
1404-
secret_eq_consttime(&secret, &suggested))));
1388+
correct)));
14051389
}
14061390

14071391
/* This is used by closingd to sign off on a mutual close tx. */

0 commit comments

Comments
 (0)