summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-10-01 07:47:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-10-01 07:47:30 (GMT)
commitbae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5 (patch)
tree495b0afaa05b7c0d235af2e54c70015b16f4d2e3 /configure.ac
parent87bddbac9d178b549fac830adc76bc8f100b2a47 (diff)
downloadcpython-bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5.zip
cpython-bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5.tar.gz
cpython-bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5.tar.bz2
Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the getrandom()
function instead of the getentropy() function. The getentropy() function is blocking to generate very good quality entropy, os.urandom() doesn't need such high-quality entropy.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac31
1 files changed, 28 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 792f580..694293e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5154,11 +5154,11 @@ AC_LINK_IFELSE(
#include <sys/syscall.h>
int main() {
- const int flags = 0;
char buffer[1];
- int n;
+ const size_t buflen = sizeof(buffer);
+ const int flags = 0;
/* ignore the result, Python checks for ENOSYS at runtime */
- (void)syscall(SYS_getrandom, buffer, sizeof(buffer), flags);
+ (void)syscall(SYS_getrandom, buffer, buflen, flags);
return 0;
}
]])
@@ -5170,6 +5170,31 @@ if test "$have_getrandom_syscall" = yes; then
[Define to 1 if the Linux getrandom() syscall is available])
fi
+# check if the getrandom() function is available
+# the test was written for the Solaris function of <sys/random.h>
+AC_MSG_CHECKING(for the getrandom() function)
+AC_LINK_IFELSE(
+[
+ AC_LANG_SOURCE([[
+ #include <sys/random.h>
+
+ int main() {
+ char buffer[1];
+ const size_t buflen = sizeof(buffer);
+ const int flags = 0;
+ /* ignore the result, Python checks for ENOSYS at runtime */
+ (void)getrandom(buffer, buflen, flags);
+ return 0;
+ }
+ ]])
+],[have_getrandom=yes],[have_getrandom=no])
+AC_MSG_RESULT($have_getrandom)
+
+if test "$have_getrandom" = yes; then
+ AC_DEFINE(HAVE_GETRANDOM, 1,
+ [Define to 1 if the getrandom() function is available])
+fi
+
# generate output files
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])