diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 07:47:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 07:47:30 (GMT) |
commit | bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5 (patch) | |
tree | 495b0afaa05b7c0d235af2e54c70015b16f4d2e3 /configure | |
parent | 87bddbac9d178b549fac830adc76bc8f100b2a47 (diff) | |
download | cpython-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')
-rwxr-xr-x | configure | 43 |
1 files changed, 40 insertions, 3 deletions
@@ -16085,11 +16085,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #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; } @@ -16111,6 +16111,43 @@ $as_echo "#define HAVE_GETRANDOM_SYSCALL 1" >>confdefs.h fi +# check if the getrandom() function is available +# the test was written for the Solaris function of <sys/random.h> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the getrandom() function" >&5 +$as_echo_n "checking for the getrandom() function... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + #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; + } + + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + have_getrandom=yes +else + have_getrandom=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_getrandom" >&5 +$as_echo "$have_getrandom" >&6; } + +if test "$have_getrandom" = yes; then + +$as_echo "#define HAVE_GETRANDOM 1" >>confdefs.h + +fi + # generate output files ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh" |