diff --git a/.travis.yml b/.travis.yml index 1d308afd..151c6a1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,5 +11,7 @@ matrix: include: - os: osx env: OCAML_VERSION=4.08 + - dist: xenial + env: OCAML_VERSION=4.08 notifications: email: false diff --git a/rng/unix/mc_getrandom_stubs.c b/rng/unix/mc_getrandom_stubs.c index fc8b7413..88bc9019 100644 --- a/rng/unix/mc_getrandom_stubs.c +++ b/rng/unix/mc_getrandom_stubs.c @@ -6,9 +6,16 @@ #include #if defined(__linux) +# include // on Linux, we use getrandom and loop -#include -#include + +# if __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 25 +# include +# define getrandom(buf, len, flags) syscall(SYS_getrandom, (buf), (len), (flags)) +# else +# include +# define getrandom(buf, len, flags) getrandom((buf), (len), (flags)) +# endif void raw_getrandom (uint8_t *data, uint32_t len) { int r, off = 0; @@ -19,7 +26,6 @@ void raw_getrandom (uint8_t *data, uint32_t len) { off += r; } } - #elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)) // on BSD and macOS, loop (in pieces of 256) getentropy #if defined(__APPLE__)