diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index dbd89716..1d3eb607 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -6,11 +6,11 @@ # include #endif #ifdef __linux__ -#ifdef __dietlibc__ -#define _LINUX_SOURCE -#else -# include -#endif +# ifdef __dietlibc__ +# define _LINUX_SOURCE +# else +# include +# endif # include #endif @@ -219,11 +219,11 @@ _randombytes_linux_getrandom(void * const buf, const size_t size) assert(size <= 256U); do { -#ifdef __dietlibc__ +# ifdef __dietlibc__ readnb = getrandom(buf, size, 0); -#else +# else readnb = syscall(SYS_getrandom, buf, (int) size, 0); -#endif +# endif } while (readnb < 0 && (errno == EINTR || errno == EAGAIN)); return (readnb == (int) size) - 1; diff --git a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c index e7c902c8..80b93746 100644 --- a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +++ b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c @@ -6,11 +6,11 @@ # include #endif #ifdef __linux__ -#ifdef __dietlibc__ -#define _LINUX_SOURCE -#else -# include -#endif +# ifdef __dietlibc__ +# define _LINUX_SOURCE +# else +# include +# endif # include #endif @@ -201,11 +201,11 @@ _randombytes_linux_getrandom(void * const buf, const size_t size) assert(size <= 256U); do { -#ifdef __dietlibc__ - readnb = getrandom( buf, size, 0); -#else +# ifdef __dietlibc__ + readnb = getrandom(buf, size, 0); +# else readnb = syscall(SYS_getrandom, buf, (int) size, 0); -#endif +# endif } while (readnb < 0 && (errno == EINTR || errno == EAGAIN)); return (readnb == (int) size) - 1;