summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-10-16 21:14:00 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-10-16 21:14:00 +0000
commit8be9590f78d0f7cf04ade6a2ff0bddd365e3fd7c (patch)
treed0916c78ebed536b49c2daca60948c816a8729bc /src
parent46529d0c27923bb961c1b0734de0c2562cbabe30 (diff)
downloadskalibs-8be9590f78d0f7cf04ade6a2ff0bddd365e3fd7c.tar.xz
Fix headers in random_init.c; add a workaround for (pathological) getrandom() without /dev/urandom
Diffstat (limited to 'src')
-rw-r--r--src/librandom/random_init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librandom/random_init.c b/src/librandom/random_init.c
index 18bb8fa..6a30db1 100644
--- a/src/librandom/random_init.c
+++ b/src/librandom/random_init.c
@@ -24,15 +24,20 @@ int random_init ()
int random_init ()
{
+#ifdef SKALIBS_HASDEVURANDOM
char seed[160] ;
random_makeseed(seed) ;
return openwritenclose_unsafe("/dev/urandom", seed, 160) ;
+#else
+ return 1 ;
+#endif
}
#else
#ifdef SKALIBS_HASDEVURANDOM
#include <skalibs/djbunix.h>
+#include <skalibs/surf.h>
#include <skalibs/random.h>
#include "random-internal.h"
@@ -58,6 +63,7 @@ int random_init ()
#else /* default */
+#include <skalibs/surf.h>
#include <skalibs/random.h>
#include "random-internal.h"