mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
hsmtool: only write 32 bytes to hsm_secret on generatehsm
Fixes #4302 Changelog-fixed: hsmtool: the `generatehsm` command now generates an appropriately-sized hsm_secret Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
parent
aa2586a45a
commit
19afe15968
2 changed files with 3 additions and 2 deletions
|
@ -1097,7 +1097,6 @@ def test_hsmtool_dump_descriptors(node_factory, bitcoind):
|
||||||
assert len(bitcoind.rpc.listunspent(1, 1, [addr])) == 1
|
assert len(bitcoind.rpc.listunspent(1, 1, [addr])) == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(strict=True)
|
|
||||||
@unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.")
|
@unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.")
|
||||||
def test_hsmtool_generatehsm(node_factory):
|
def test_hsmtool_generatehsm(node_factory):
|
||||||
l1 = node_factory.get_node()
|
l1 = node_factory.get_node()
|
||||||
|
|
|
@ -532,7 +532,9 @@ static int generate_hsm(const char *hsm_secret_path)
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
errx(ERROR_USAGE, "Unable to create hsm_secret file");
|
errx(ERROR_USAGE, "Unable to create hsm_secret file");
|
||||||
}
|
}
|
||||||
if (!write_all(fd, bip32_seed, bip32_seed_len))
|
/* Write only the first 32 bytes, length of the (plaintext) seed in the
|
||||||
|
* hsm_secret. */
|
||||||
|
if (!write_all(fd, bip32_seed, 32))
|
||||||
errx(ERROR_USAGE, "Error writing secret to hsm_secret file");
|
errx(ERROR_USAGE, "Error writing secret to hsm_secret file");
|
||||||
|
|
||||||
if (fsync(fd) != 0)
|
if (fsync(fd) != 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue