From b1b15910ed9ea6fbed245f220195486253ef4cd7 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 15 Oct 2013 10:17:17 +0200 Subject: [PATCH] fix rng_get_bytes() when compiling with mingw-gcc --- src/prngs/rng_get_bytes.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/prngs/rng_get_bytes.c b/src/prngs/rng_get_bytes.c index b8cc6f5..9193787 100644 --- a/src/prngs/rng_get_bytes.c +++ b/src/prngs/rng_get_bytes.c @@ -87,12 +87,16 @@ static unsigned long rng_ansic(unsigned char *buf, unsigned long len, #endif /* Try the Microsoft CSP */ -#if defined(WIN32) || defined(WINCE) -#define _WIN32_WINNT 0x0400 +#if defined(WIN32) || defined(_WIN32) || defined(WINCE) +#ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0400 +#endif #ifdef WINCE #define UNDER_CE #define ARM #endif + +#define WIN32_LEAN_AND_MEAN #include #include @@ -134,7 +138,7 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen, #if defined(LTC_DEVRANDOM) x = rng_nix(out, outlen, callback); if (x != 0) { return x; } #endif -#ifdef WIN32 +#if defined(_WIN32) || defined(_WIN32) || defined(WINCE) x = rng_win32(out, outlen, callback); if (x != 0) { return x; } #endif #ifdef ANSI_RNG