From becf8cef00fd2794e65cd54e85cf83c928ee91ba Mon Sep 17 00:00:00 2001 From: bcook <> Date: Tue, 13 Mar 2018 22:53:28 +0000 Subject: [PATCH] ensure SYS_getrandom and GRND_NONBLOCK are both defined before using getrandom(2) Based on discussion here https://github.com/libressl-portable/openbsd/pull/82 Suggested fix from jsing@ --- src/lib/libcrypto/arc4random/getentropy_linux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/libcrypto/arc4random/getentropy_linux.c b/src/lib/libcrypto/arc4random/getentropy_linux.c index a845239e..408d7fda 100644 --- a/src/lib/libcrypto/arc4random/getentropy_linux.c +++ b/src/lib/libcrypto/arc4random/getentropy_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getentropy_linux.c,v 1.44 2017/04/29 18:43:31 beck Exp $ */ +/* $OpenBSD: getentropy_linux.c,v 1.45 2018/03/13 22:53:28 bcook Exp $ */ /* * Copyright (c) 2014 Theo de Raadt @@ -74,7 +74,7 @@ int getentropy(void *buf, size_t len); static int gotdata(char *buf, size_t len); -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(GRND_NONBLOCK) static int getentropy_getrandom(void *buf, size_t len); #endif static int getentropy_urandom(void *buf, size_t len); @@ -94,7 +94,7 @@ getentropy(void *buf, size_t len) return (-1); } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(GRND_NONBLOCK) /* * Try descriptor-less getrandom(), in non-blocking mode. * @@ -193,7 +193,7 @@ gotdata(char *buf, size_t len) return (0); } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(GRND_NONBLOCK) static int getentropy_getrandom(void *buf, size_t len) {