diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/random.c | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8136217..35460e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ endif() # extra needed libraries if(WIN32) - list(APPEND mi_libraries psapi shell32 user32 advapi32) + list(APPEND mi_libraries psapi shell32 user32 advapi32 bcrypt) else() if(NOT ${CMAKE_C_COMPILER} MATCHES "android") list(APPEND mi_libraries pthread) diff --git a/src/random.c b/src/random.c index 2d15c18..a03e80c 100644 --- a/src/random.c +++ b/src/random.c @@ -162,14 +162,13 @@ If we cannot get good randomness, we fall back to weak randomness based on a tim -----------------------------------------------------------------------------*/ #if defined(_WIN32) -/* // We prefer BCryptGenRandom over RtlGenRandom but it leads to a crash a when using dynamic override combined with the C++ runtime :-( #pragma comment (lib,"bcrypt.lib") #include <bcrypt.h> static bool os_random_buf(void* buf, size_t buf_len) { return (BCryptGenRandom(NULL, (PUCHAR)buf, (ULONG)buf_len, BCRYPT_USE_SYSTEM_PREFERRED_RNG) >= 0); } -*/ +/* #pragma comment (lib,"advapi32.lib") #define RtlGenRandom SystemFunction036 #ifdef __cplusplus @@ -185,7 +184,7 @@ static bool os_random_buf(void* buf, size_t buf_len) { bool ok = (RtlGenRandom(buf, (ULONG)buf_len) != 0); return ok; } - +*/ #elif defined(ANDROID) || defined(XP_DARWIN) || defined(__APPLE__) || defined(__DragonFly__) || \ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ defined(__sun) || defined(__wasi__) |