hsmd: derive an onion_reply secret.

We put this in reply paths, so we can tell if they are used.  This lets us
avoid responding unless the correct reply path is used.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-09-22 06:47:25 +09:30
parent 3a966191b8
commit 01161aac68
6 changed files with 24 additions and 8 deletions

View File

@@ -116,7 +116,8 @@ struct ext_key *hsm_init(struct lightningd *ld)
msg = wire_sync_read(tmpctx, ld->hsm_fd);
if (!fromwire_hsmd_init_reply(msg,
&ld->id, bip32_base,
&ld->bolt12_base)) {
&ld->bolt12_base,
&ld->onion_reply_secret)) {
if (ld->config.keypass)
errx(1, "Wrong password for encrypted hsm_secret.");
errx(1, "HSM did not give init reply");