diff options
Diffstat (limited to 'compat/getentropy_linux.c')
-rw-r--r-- | compat/getentropy_linux.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compat/getentropy_linux.c b/compat/getentropy_linux.c index 60e010db713aa..d4adab2852d4e 100644 --- a/compat/getentropy_linux.c +++ b/compat/getentropy_linux.c @@ -93,6 +93,13 @@ getentropy(void *buf, size_t len) return -1; } +#ifdef SYS_getrandom + /* try to use getrandom syscall introduced with kernel 3.17 */ + ret = syscall(SYS_getrandom, buf, len, 0); + if (ret != -1) + return (ret); +#endif /* SYS_getrandom */ + /* * Try to get entropy with /dev/urandom * |