From b449e03f43967277afa49ef6b46602ca736761f8 Mon Sep 17 00:00:00 2001 From: Rick V Date: Thu, 13 Feb 2020 20:18:12 -0600 Subject: [PATCH] So as of GCC 9.2, std::random_device on Windows is RtlGenRandom() ....which is precisely the thing i patch out in libsodium to use CryptoAPI documented interfaces instead (which fall through to RtlGenRandom() on such devices _anyway_) we can just use libsodium directly, i happened to patch it out in libstdc++ as a side effect (since my local toolchain can target any version of windows) --- llarp/router/rc_lookup_handler.cpp | 2 +- llarp/util/endian.hpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/llarp/router/rc_lookup_handler.cpp b/llarp/router/rc_lookup_handler.cpp index 7d2b5514c..b98d65beb 100644 --- a/llarp/router/rc_lookup_handler.cpp +++ b/llarp/router/rc_lookup_handler.cpp @@ -276,7 +276,7 @@ namespace llarp if(lookupRouters.size() > LookupPerTick) { - static std::mt19937_64 rng{std::random_device{}()}; + static std::mt19937_64 rng{llarp::randint()}; std::shuffle(lookupRouters.begin(), lookupRouters.end(), rng); lookupRouters.resize(LookupPerTick); } diff --git a/llarp/util/endian.hpp b/llarp/util/endian.hpp index 54a90c145..f2b5a1cef 100644 --- a/llarp/util/endian.hpp +++ b/llarp/util/endian.hpp @@ -10,6 +10,7 @@ #include #elif defined(__sun) #include +#include #define htobe16(x) htons(x) #define htole16(x) (x) #define be16toh(x) ntohs(x)