mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
Changed openssl's RAND_bytes() to sodium's randombytes_buf()
This commit is contained in:
parent
df4df8679d
commit
4751522162
@ -497,7 +497,7 @@ struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx,
|
||||
tx->output = tal_arr(tx, struct bitcoin_tx_output, tx->output_count);
|
||||
for (i = 0; i < tx->output_count; i++)
|
||||
pull_output(tx, cursor, max, tx->output + i);
|
||||
|
||||
|
||||
if (flag & SEGREGATED_WITNESS_FLAG) {
|
||||
for (i = 0; i < tx->input_count; i++)
|
||||
pull_witness(tx->input, i, cursor, max);
|
||||
|
@ -13,11 +13,11 @@
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <secp256k1.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sodium/randombytes.h>
|
||||
|
||||
struct secret {
|
||||
/* Secret ID of our node; public is dstate->id. */
|
||||
@ -147,8 +147,7 @@ static void new_keypair(struct lightningd_state *dstate,
|
||||
struct privkey *privkey, struct pubkey *pubkey)
|
||||
{
|
||||
do {
|
||||
if (RAND_bytes(privkey->secret, sizeof(privkey->secret)) != 1)
|
||||
fatal("Could not get random bytes for privkey");
|
||||
randombytes_buf(privkey->secret, sizeof(privkey->secret));
|
||||
} while (!pubkey_from_privkey(dstate->secpctx, privkey, pubkey));
|
||||
}
|
||||
|
||||
@ -158,10 +157,7 @@ void peer_secrets_init(struct peer *peer)
|
||||
|
||||
new_keypair(peer->dstate, &peer->secrets->commit, &peer->local.commitkey);
|
||||
new_keypair(peer->dstate, &peer->secrets->final, &peer->local.finalkey);
|
||||
if (RAND_bytes(peer->secrets->revocation_seed.u.u8,
|
||||
sizeof(peer->secrets->revocation_seed.u.u8)) != 1)
|
||||
fatal("Could not get random bytes for revocation seed");
|
||||
|
||||
randombytes_buf(peer->secrets->revocation_seed.u.u8, sizeof(peer->secrets->revocation_seed.u.u8));
|
||||
shachain_init(&peer->their_preimages);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "log.h"
|
||||
#include "wallet.h"
|
||||
#include <ccan/structeq/structeq.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <sodium/randombytes.h>
|
||||
|
||||
struct wallet {
|
||||
struct list_node list;
|
||||
@ -25,8 +25,7 @@ static void new_keypair(struct lightningd_state *dstate,
|
||||
struct privkey *privkey, struct pubkey *pubkey)
|
||||
{
|
||||
do {
|
||||
if (RAND_bytes(privkey->secret, sizeof(privkey->secret)) != 1)
|
||||
fatal("Could not get random bytes for privkey");
|
||||
randombytes_buf(privkey->secret, sizeof(privkey->secret));
|
||||
} while (!pubkey_from_privkey(dstate->secpctx, privkey, pubkey));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user