Victor Stinner
b27df6faa5
Issue #29157 : enhance py_getrandom() documentation
2017-01-06 11:39:15 +01:00
Victor Stinner
de2f1ea124
py_getentropy() now supports ENOSYS, EPERM & EINTR
...
Issue #29157 .
2017-01-06 11:33:18 +01:00
Victor Stinner
2f7964393d
Issue #29157 : getrandom() is now preferred over getentropy()
...
The glibc now implements getentropy() on Linux using the getrandom() syscall.
But getentropy() doesn't support non-blocking mode.
Since getrandom() is tried first, it's not more needed to explicitly exclude
getentropy() on Solaris. Replace:
if defined(HAVE_GETENTROPY) && !defined(sun)
with
if defined(HAVE_GETENTROPY)
2017-01-06 11:26:01 +01:00
Victor Stinner
a49a2078e8
Issue #29157 : Simplify dev_urandom()
...
pyurandom() is now responsible to call getentropy() or getrandom().
Enhance also dev_urandom() and pyurandom() documentation.
2017-01-06 11:17:52 +01:00
Victor Stinner
dcdb60e4b3
Issue #29157 : dev_urandom() now calls py_getentropy()
...
Prepare the fallback to support getentropy() failure and falls back on reading
from /dev/urandom.
2017-01-06 11:16:20 +01:00
Benjamin Peterson
46322587ec
merge 3.5 ( #29057 )
2017-01-01 22:30:26 -06:00
Benjamin Peterson
493ac1bbe0
only include sys/random.h if it seems like it might have something useful ( #29057 )
2017-01-01 22:29:36 -06:00
Benjamin Peterson
b0eb986eb2
merge 3.5 ( #28932 )
2016-12-19 23:54:57 -08:00
Benjamin Peterson
fb2ae15c67
add a specific configure check for sys/random.h ( closes #28932 )
2016-12-19 23:54:25 -08:00
Ned Deily
7d895d3c37
Issue #28676 : merge from 3.5
2016-11-12 16:38:03 -05:00
Ned Deily
7ae4112649
Issue #28676 : Prevent missing 'getentropy' declaration warning on macOS.
...
Patch by Gareth Rees.
2016-11-12 16:35:48 -05:00
Victor Stinner
75024c6589
(Merge 3.5) Catch EPERM error in py_getrandom()
...
Issue #27955 : Fallback on reading /dev/urandom device when the getrandom()
syscall fails with EPERM, for example when blocked by SECCOMP.
2016-09-20 22:49:52 +02:00
Victor Stinner
6d8bc46cc0
Catch EPERM error in py_getrandom()
...
Issue #27955 : Fallback on reading /dev/urandom device when the getrandom()
syscall fails with EPERM, for example when blocked by SECCOMP.
2016-09-20 22:46:02 +02:00
Victor Stinner
af59732102
Cleanup random.c
...
Issue #27955 : modify py_getrnadom() and dev_urandom()
* Add comments from Python 3.7
* PEP 7 style: add {...}
2016-09-20 22:26:18 +02:00
Victor Stinner
e66987e626
os.urandom() now blocks on Linux
...
Issue #27776 : The os.urandom() function does now block on Linux 3.17 and newer
until the system urandom entropy pool is initialized to increase the security.
This change is part of the PEP 524.
2016-09-06 16:33:52 -07:00
Victor Stinner
3ee933f1c3
Issue #27776 : dev_urandom(raise=0) now closes the file descriptor on error
2016-08-16 18:27:44 +02:00
Victor Stinner
6974cf2c27
Issue #27776 : Cleanup random.c
...
Merge dev_urandom_python() and dev_urandom_noraise() functions to reduce code
duplication.
2016-08-16 18:46:38 +02:00
Victor Stinner
cecdd9634b
Issue #27776 : _PyRandom_Init() doesn't call PyErr_CheckSignals() anymore
...
Modify py_getrandom() to not call PyErr_CheckSignals() if raise is zero.
_PyRandom_Init() is called very early in the Python initialization, so it's
safer to not call PyErr_CheckSignals().
2016-08-16 15:19:09 +02:00
Victor Stinner
4bad3b622e
Issue #27776 : Cleanup random.c
...
* Add pyurandom() helper function to factorize the code
* don't call Py_FatalError() in helper functions, but only in _PyRandom_Init()
if pyurandom() failed, to uniformize the code
2016-08-16 15:23:58 +02:00
Martin Panter
d2f87472fe
Issue #17596 : MINGW: add wincrypt.h in Python/random.c
...
Based on patch by Roumen Petrov.
2016-07-29 04:00:44 +00:00
Victor Stinner
a63073a807
Merge 3.5
2016-06-17 00:01:30 +02:00
Victor Stinner
ec721f3305
py_getrandom(): use long type for the syscall() result
...
Issue #27278 . It should fix a conversion warning.
In practice, the Linux kernel doesn't return more than 32 MB per call to the
getrandom() syscall.
2016-06-16 23:53:47 +02:00
Victor Stinner
d017176209
Merge 3.5
2016-06-14 16:36:00 +02:00
Victor Stinner
c72828ba33
cleanup random.c
...
Casting Py_ssize_t to Py_ssize_t is useless.
2016-06-14 16:35:49 +02:00
Victor Stinner
370f5136d4
Merge 3.5 (os.urandom, issue #27278 )
2016-06-14 16:33:17 +02:00