From 94ea4192473d316bfe40baa11b742af0ae7cc5bb Mon Sep 17 00:00:00 2001 From: Robert Spychala Date: Tue, 20 Sep 2016 15:13:07 -0400 Subject: [PATCH] add preprocessor flag to skip blocking /dev/random during libsodium init (#429) --- .../randombytes/salsa20/randombytes_salsa20_random.c | 4 ++-- src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index 2d214721..a84c107a 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -130,7 +130,7 @@ safe_read(const int fd, void * const buf_, size_t size) #endif #ifndef _WIN32 -# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) +# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL) static int randombytes_block_on_dev_random(void) { @@ -172,7 +172,7 @@ randombytes_salsa20_random_random_dev_open(void) const char ** device = devices; int fd; -# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) +# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL) if (randombytes_block_on_dev_random() != 0) { return -1; } diff --git a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c index 6410cf8b..83c8a39f 100644 --- a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +++ b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c @@ -114,7 +114,7 @@ safe_read(const int fd, void * const buf_, size_t size) #endif #ifndef _WIN32 -# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) +# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL) static int randombytes_block_on_dev_random(void) { @@ -155,7 +155,7 @@ randombytes_sysrandom_random_dev_open(void) const char ** device = devices; int fd; -# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) +# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL) if (randombytes_block_on_dev_random() != 0) { return -1; }