summaryrefslogtreecommitdiff
path: root/trackerlogic.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 /trackerlogic.c
parente4b6decf72a91453bc8d31b4b15e7aed923c56d2 (diff)
Use new entropy fascility and add tests for it
Diffstat (limited to 'trackerlogic.c')
-rw-r--r--trackerlogic.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/trackerlogic.c b/trackerlogic.c
index 59e9643..d8a2f9b 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -22,6 +22,7 @@
22#include "ot_http.h" 22#include "ot_http.h"
23#include "ot_livesync.h" 23#include "ot_livesync.h"
24#include "ot_mutex.h" 24#include "ot_mutex.h"
25#include "ot_random.h"
25#include "ot_stats.h" 26#include "ot_stats.h"
26#include "ot_vector.h" 27#include "ot_vector.h"
27#include "ot_udp.h" 28#include "ot_udp.h"
@@ -536,8 +537,8 @@ void trackerlogic_add_random_torrents(size_t amount) {
536 ws.hash = (ot_hash *)ws.inbuf; 537 ws.hash = (ot_hash *)ws.inbuf;
537 538
538 while (amount--) { 539 while (amount--) {
539 arc4random_buf(ws.hash, sizeof(ot_hash)); 540 random_bytes(ws.hash, sizeof(ot_hash));
540 arc4random_buf(&ws.peer, sizeof(ws.peer)); 541 random_bytes(&ws.peer, sizeof(ws.peer));
541 542
542 OT_PEERFLAG(ws.peer) &= PEER_FLAG_SEEDING | PEER_FLAG_COMPLETED | PEER_FLAG_STOPPED; 543 OT_PEERFLAG(ws.peer) &= PEER_FLAG_SEEDING | PEER_FLAG_COMPLETED | PEER_FLAG_STOPPED;
543 544
@@ -555,7 +556,7 @@ void exerr(char *message) {
555} 556}
556 557
557void trackerlogic_init(void) { 558void trackerlogic_init(void) {
558 g_tracker_id = random(); 559 g_tracker_id = random_uint32();
559 560
560 if (!g_stats_path) 561 if (!g_stats_path)
561 g_stats_path = "stats"; 562 g_stats_path = "stats";