From 5c804e1ac835acdc4d7a17f654d5fc86b5a95c6d Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 23 Oct 2019 18:23:31 +0200 Subject: [PATCH] Better getentropy() usability checks --- configure | 9 ++++----- configure.ac | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/configure b/configure index bb26c755..46e2e521 100755 --- a/configure +++ b/configure @@ -19145,12 +19145,11 @@ int main () { -#ifdef __APPLE__ -# error getentropy() is currently disabled on Apple operating systems -#endif - unsigned char buf; -(void) getentropy((void *) &buf, 1U); + +if (&getentropy != NULL) { + (void) getentropy((void *) &buf, 1U); +} ; return 0; diff --git a/configure.ac b/configure.ac index 152c7c0d..a996c20e 100644 --- a/configure.ac +++ b/configure.ac @@ -848,12 +848,11 @@ unsigned char buf; # error A recent libasan version on an old system may intercept nonexistent functions #endif ]], [[ -#ifdef __APPLE__ -# error getentropy() is currently disabled on Apple operating systems -#endif - unsigned char buf; -(void) getentropy((void *) &buf, 1U); + +if (&getentropy != NULL) { + (void) getentropy((void *) &buf, 1U); +} ]])], [AC_MSG_RESULT(yes) AC_CHECK_FUNCS([getentropy])],