From b73b3b17ccf02337fb07f5ae78d78c2ff1dc3ccc Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Tue, 20 Apr 2021 04:05:50 +0200 Subject: Use arc4random whereever we need strong entropy --- opentracker.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'opentracker.c') diff --git a/opentracker.c b/opentracker.c index d2c0635..1c729cf 100644 --- a/opentracker.c +++ b/opentracker.c @@ -256,11 +256,17 @@ static void * server_mainloop( void * args ) { #ifdef _DEBUG_HTTPERROR ws.debugbuf= malloc( G_DEBUGBUF_SIZE ); #endif + 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 for( ; ; ) { int64 sock; -- cgit v1.2.3