From ecb1f1e92ab449023d1427f9db26c5bac09c4901 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 24 Oct 2026 01:50:25 +0200 Subject: Use new entropy fascility and add tests for it --- opentracker.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'opentracker.c') diff --git a/opentracker.c b/opentracker.c index 89bfd3e..4d44950 100644 --- a/opentracker.c +++ b/opentracker.c @@ -31,6 +31,7 @@ #include "ot_http.h" #include "ot_livesync.h" #include "ot_mutex.h" +#include "ot_random.h" #include "ot_stats.h" #include "ot_udp.h" #include "trackerlogic.h" @@ -294,13 +295,7 @@ static void *server_mainloop(void *args) { if (!ws.inbuf || !ws.outbuf) panic("Initializing worker failed"); -#ifdef WANT_ARC4RANDOM - arc4random_buf(&ws.rand48_state[0], 3 * sizeof(uint16_t)); -#else - ws.rand48_state[0] = (uint16_t)random(); - ws.rand48_state[1] = (uint16_t)random(); - ws.rand48_state[2] = (uint16_t)random(); -#endif + random_bytes(ws.rand48_state, sizeof(ws.rand48_state)); for (;;) { int64 sock; @@ -743,11 +738,7 @@ int main(int argc, char **argv) { serverip[10] = serverip[11] = -1; #endif -#ifdef WANT_DEV_RANDOM - srandomdev(); -#else - srandom(time(NULL)); -#endif + random_init(); while (scanon) { switch (getopt(argc, argv, -- cgit v1.3