summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-24 01:50:25 +0200
committerDirk Engling <erdgeist@erdgeist.org>2026-10-24 01:50:25 +0200
commitecb1f1e92ab449023d1427f9db26c5bac09c4901 (patch)
tree5af48da0cac32e2927aa5e2946c9f08173fedb69 /opentracker.c
parente4b6decf72a91453bc8d31b4b15e7aed923c56d2 (diff)
Use new entropy fascility and add tests for it
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/opentracker.c b/opentracker.c
index 89bfd3e..4d44950 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -31,6 +31,7 @@
31#include "ot_http.h" 31#include "ot_http.h"
32#include "ot_livesync.h" 32#include "ot_livesync.h"
33#include "ot_mutex.h" 33#include "ot_mutex.h"
34#include "ot_random.h"
34#include "ot_stats.h" 35#include "ot_stats.h"
35#include "ot_udp.h" 36#include "ot_udp.h"
36#include "trackerlogic.h" 37#include "trackerlogic.h"
@@ -294,13 +295,7 @@ static void *server_mainloop(void *args) {
294 if (!ws.inbuf || !ws.outbuf) 295 if (!ws.inbuf || !ws.outbuf)
295 panic("Initializing worker failed"); 296 panic("Initializing worker failed");
296 297
297#ifdef WANT_ARC4RANDOM 298 random_bytes(ws.rand48_state, sizeof(ws.rand48_state));
298 arc4random_buf(&ws.rand48_state[0], 3 * sizeof(uint16_t));
299#else
300 ws.rand48_state[0] = (uint16_t)random();
301 ws.rand48_state[1] = (uint16_t)random();
302 ws.rand48_state[2] = (uint16_t)random();
303#endif
304 299
305 for (;;) { 300 for (;;) {
306 int64 sock; 301 int64 sock;
@@ -743,11 +738,7 @@ int main(int argc, char **argv) {
743 serverip[10] = serverip[11] = -1; 738 serverip[10] = serverip[11] = -1;
744#endif 739#endif
745 740
746#ifdef WANT_DEV_RANDOM 741 random_init();
747 srandomdev();
748#else
749 srandom(time(NULL));
750#endif
751 742
752 while (scanon) { 743 while (scanon) {
753 switch (getopt(argc, argv, 744 switch (getopt(argc, argv,