mirror of
https://github.com/monero-project/monero.git
synced 2025-08-11 16:40:09 -04:00
crypto: make clear generate_random_bytes is not thread safe
And add a thread safe version to encourage proper use
This commit is contained in:
parent
8b0d22a2aa
commit
d539be3359
4 changed files with 11 additions and 4 deletions
|
@ -83,7 +83,7 @@ namespace crypto {
|
|||
/* generate a random 32-byte (256-bit) integer and copy it to res */
|
||||
static inline void random_scalar(ec_scalar &res) {
|
||||
unsigned char tmp[64];
|
||||
generate_random_bytes(64, tmp);
|
||||
generate_random_bytes_not_thread_safe(64, tmp);
|
||||
sc_reduce(tmp);
|
||||
memcpy(&res, tmp, 32);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue