]> granicus.if.org Git - python/commit
Issue #29157: Prefer getrandom() over getentropy()
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 6 Jan 2017 23:07:45 +0000 (00:07 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 6 Jan 2017 23:07:45 +0000 (00:07 +0100)
commitff558f5aba40bd173f336503def886a12f8db016
treee9b56854a7f08f4ab52757fab037cbe171e1d497
parent84b6fb0eea29b3b28a1a11124526b01ec0c9d17a
Issue #29157: Prefer getrandom() over getentropy()

* dev_urandom() now calls py_getentropy(). Prepare the fallback to support
  getentropy() failure and falls back on reading from /dev/urandom.
* Simplify dev_urandom(). pyurandom() is now responsible to call getentropy()
  or getrandom(). Enhance also dev_urandom() and pyurandom() documentation.
* getrandom() is now preferred over getentropy(). The glibc 2.24 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)"
* Enhance py_getrandom() documentation. py_getentropy() now supports ENOSYS,
  EPERM & EINTR
Python/random.c