lightningd: pass the hsm_secret encryption key in hsm_init

This commit is contained in:
darosior
2019-10-03 21:38:50 +02:00
committed by neil saitug
parent a698395bf0
commit 62896566d0
3 changed files with 4 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ msgdata,hsmstatus_client_bad_request,msg,u8,len
msgtype,hsm_init,11
msgdata,hsm_init,bip32_key_version,bip32_key_version,
msgdata,hsm_init,chainparams,chainparams,
msgdata,hsm_init,hsm_encryption_key,?secret,
msgdata,hsm_init,dev_force_privkey,?privkey,
msgdata,hsm_init,dev_force_bip32_seed,?secret,
msgdata,hsm_init,dev_force_channel_secrets,?secrets,
1 # Clients should not give a bad request but not the HSM's decision to crash.
10 msgdata,hsm_init,bip32_key_version,bip32_key_version,
11 msgdata,hsm_init,chainparams,chainparams,
12 msgdata,hsm_init,dev_force_privkey,?privkey, msgdata,hsm_init,hsm_encryption_key,?secret,
13 msgdata,hsm_init,dev_force_privkey,?privkey,
14 msgdata,hsm_init,dev_force_bip32_seed,?secret,
15 msgdata,hsm_init,dev_force_channel_secrets,?secrets,
16 msgdata,hsm_init,dev_force_channel_secrets_shaseed,?sha256,

View File

@@ -580,6 +580,7 @@ static struct io_plan *init_hsm(struct io_conn *conn,
struct secret *seed;
struct secrets *secrets;
struct sha256 *shaseed;
struct secret *hsm_encryption_key;
/* This must be lightningd. */
assert(is_lightningd(c));
@@ -589,7 +590,7 @@ static struct io_plan *init_hsm(struct io_conn *conn,
* an extension of the simple comma-separated format output by the
* BOLT tools/extract-formats.py tool. */
if (!fromwire_hsm_init(NULL, msg_in, &bip32_key_version, &chainparams,
&privkey, &seed, &secrets, &shaseed))
&hsm_encryption_key, &privkey, &seed, &secrets, &shaseed))
return bad_req(conn, c, msg_in);
#if DEVELOPER

View File

@@ -96,6 +96,7 @@ void hsm_init(struct lightningd *ld)
if (!wire_sync_write(ld->hsm_fd, towire_hsm_init(tmpctx,
&ld->topology->bitcoind->chainparams->bip32_key_version,
chainparams,
ld->config.keypass,
IFDEV(ld->dev_force_privkey, NULL),
IFDEV(ld->dev_force_bip32_seed, NULL),
IFDEV(ld->dev_force_channel_secrets, NULL),