micro-ecc: add uECC_NO_DEFAULT_RNG to disable default RNG from OS (POSIX,

This commit is contained in:
Matthias Ringwald 2020-04-10 10:20:37 +02:00
parent 34bd46a03b
commit bf2b6c3754

View File

@ -405,7 +405,7 @@ static void vli_square(uECC_word_t *result, const uECC_word_t *left);
static void vli_modSquare_fast(uECC_word_t *result, const uECC_word_t *left); static void vli_modSquare_fast(uECC_word_t *result, const uECC_word_t *left);
#endif #endif
#if (defined(_WIN32) || defined(_WIN64)) #if ((defined(_WIN32) || defined(_WIN64)) && !defined(uECC_NO_DEFAULT_RNG))
/* Windows */ /* Windows */
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -423,8 +423,8 @@ static int default_RNG(uint8_t *dest, unsigned size) {
return 1; return 1;
} }
#elif defined(unix) || defined(__linux__) || defined(__unix__) || defined(__unix) || \ #elif (defined(unix) || defined(__linux__) || defined(__unix__) || defined(__unix) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(uECC_POSIX) (defined(__APPLE__) && defined(__MACH__)) || defined(uECC_POSIX)) && !defined(uECC_NO_DEFAULT_RNG)
/* Some POSIX-like system with /dev/urandom or /dev/random. */ /* Some POSIX-like system with /dev/urandom or /dev/random. */
#include <sys/types.h> #include <sys/types.h>