From fc2d3e1360471c4ece0a6056c026ba2efacf3013 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 10 Jan 2025 18:09:36 +0100 Subject: [PATCH] using openssl random in why2_random --- src/core/lib/utils/crypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/lib/utils/crypto.c b/src/core/lib/utils/crypto.c index 643fc50..9e11d72 100644 --- a/src/core/lib/utils/crypto.c +++ b/src/core/lib/utils/crypto.c @@ -24,6 +24,8 @@ along with this program. If not, see . #include #include +#include + unsigned long long why2_sum_segment(char *input) //THE OUTPUT IS GOING TO GROW A LOT WITH LONG input, BUT IT SHOULDN'T BE A BIG PROBLEM. I TESTED FOR OVERFLOWS UP TO 4096-CHAR input AND ONLY GOT TO (14*10^(-7))% OF FULL ULL RANGE LMAO { unsigned long input_size = strlen(input); @@ -50,7 +52,7 @@ unsigned long long why2_sum_segment(char *input) //THE OUTPUT IS GOING TO GROW A ssize_t why2_random(void *dest, size_t size) { - return getrandom(dest, size, GRND_NONBLOCK); + return RAND_bytes((unsigned char*) dest, size) == 1; } void why2_seed_random(unsigned int seed)