global: replace randombytes_buf() with randbytes() wrapper.

This allows us to override it for deterministic results.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-11-13 15:39:31 +10:30
parent 2086699b70
commit f8fd97fb5d
69 changed files with 112 additions and 45 deletions

View File

@@ -17,6 +17,7 @@
#include <common/daemon_conn.h>
#include <common/hsm_secret.h>
#include <common/memleak.h>
#include <common/randbytes.h>
#include <common/status.h>
#include <common/status_wiregen.h>
#include <common/subdaemon.h>
@@ -310,7 +311,7 @@ static void create_hsm(int fd, const char *passphrase)
/* Initialize wally tal context for libwally operations */
/* Generate random entropy for new mnemonic */
randombytes_buf(entropy, sizeof(entropy));
randbytes(entropy, sizeof(entropy));
/* Generate mnemonic from entropy */
tal_wally_start();