From db1ed1abcf4b219d9824e4a6ae5f9ae364f8d009 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 13 Mar 2019 20:57:28 -0700 Subject: crypto: Use getrandom for qcrypto_random_bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prefer it to direct use of /dev/urandom. Reviewed-by: Laurent Vivier Reviewed-by: Daniel P. Berrangé Signed-off-by: Richard Henderson --- configure | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index 54fa78c..f3526a5 100755 --- a/configure +++ b/configure @@ -5816,6 +5816,20 @@ if compile_prog "" "" ; then fi ########################################## +# check for getrandom() + +have_getrandom=no +cat > $TMPC << EOF +#include +int main(void) { + return getrandom(0, 0, GRND_NONBLOCK); +} +EOF +if compile_prog "" "" ; then + have_getrandom=yes +fi + +########################################## # checks for sanitizers have_asan=no @@ -7204,7 +7218,9 @@ fi if test "$have_utmpx" = "yes" ; then echo "HAVE_UTMPX=y" >> $config_host_mak fi - +if test "$have_getrandom" = "yes" ; then + echo "CONFIG_GETRANDOM=y" >> $config_host_mak +fi if test "$ivshmem" = "yes" ; then echo "CONFIG_IVSHMEM=y" >> $config_host_mak fi -- cgit v1.1