diff --git a/lightningd/hsm_control.c b/lightningd/hsm_control.c index 9f14aa02bbf4..6c81ab8c84dc 100644 --- a/lightningd/hsm_control.c +++ b/lightningd/hsm_control.c @@ -85,6 +85,8 @@ static unsigned int hsm_msg(struct subd *hsmd, void hsm_init(struct lightningd *ld) { + u8 *passphrase; + u8 *mnemonic; u8 *msg; int fds[2]; @@ -109,6 +111,13 @@ void hsm_init(struct lightningd *ld) "--encrypted-hsm startup option."); } + passphrase = tal_dup_arr(tmpctx, u8, (u8 *)ld->config.passphrase, + tal_count(ld->config.passphrase), 1); + passphrase[tal_count(ld->config.passphrase)] = '\0'; + mnemonic = tal_dup_arr(tmpctx, u8, (u8 *)ld->config.mnemonic, + tal_count(ld->config.mnemonic), 1); + mnemonic[tal_count(ld->config.mnemonic)] = '\0'; + ld->hsm_fd = fds[0]; if (!wire_sync_write(ld->hsm_fd, towire_hsm_init(tmpctx, &chainparams->bip32_key_version, @@ -117,7 +126,9 @@ void hsm_init(struct lightningd *ld) IFDEV(ld->dev_force_privkey, NULL), IFDEV(ld->dev_force_bip32_seed, NULL), IFDEV(ld->dev_force_channel_secrets, NULL), - IFDEV(ld->dev_force_channel_secrets_shaseed, NULL)))) + IFDEV(ld->dev_force_channel_secrets_shaseed, NULL), + mnemonic, + passphrase))) err(1, "Writing init msg to hsm"); ld->wallet->bip32_base = tal(ld->wallet, struct ext_key);