You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
os.urandom() should use getentropy() of OpenBSD 5.6 #66775
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2014-12-21.00:18:41.617>created_at=<Date2014-10-09.09:26:08.769>labels= ['type-security']
title='os.urandom() should use getentropy() of OpenBSD 5.6'updated_at=<Date2015-03-30.09:20:16.729>user='https://github.com/vstinner'
Activity
vstinner commentedon Oct 9, 2014
The future OpenBSD 5.6 (scheduled in november 2014) will have a new getentropy() syscall and a new getentropy() in their C library which avoid the need of a file descriptor:
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2?query=getentropy&sec=2
Note: "The maximum buffer size permitted is 256 bytes. If buflen exceeds this, an error of EIO will be indicated."
The file descriptor of os.urandom() causes perfomance issues and surprising bugs: bpo-18756, bpo-21207.
For Python 2.7, see also the PEP-466 and the issue bpo-21305.
See also issues:
vstinner commentedon Nov 28, 2014
Here is a patch using getentropy() if available. I tested it on OpenBSD 5.6 (the only OS implementing this function...).
The patch prepares also random.c to support Linux getrandom(): issue bpo-22181.
python-dev commentedon Dec 21, 2014
New changeset 75ede5bec8db by Victor Stinner in branch 'default':
Issue bpo-22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(),
https://hg.python.org/cpython/rev/75ede5bec8db
python-dev commentedon Dec 26, 2014
New changeset f11f84902713 by Victor Stinner in branch '3.4':
Issue bpo-22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(),
https://hg.python.org/cpython/rev/f11f84902713
python-dev commentedon Mar 17, 2015
New changeset 371deb4a5fd1 by Ned Deily in branch '3.4':
Issue bpo-22585: make URandomFDTests test case actually run
https://hg.python.org/cpython/rev/371deb4a5fd1
New changeset c89f7c34e356 by Ned Deily in branch 'default':
Issue bpo-22585: null merge
https://hg.python.org/cpython/rev/c89f7c34e356
New changeset 961efafe9497 by Ned Deily in branch '2.7':
Issue bpo-22585, bpo-23115: make URandomFDTests test case actually run
https://hg.python.org/cpython/rev/961efafe9497
python-dev commentedon Mar 30, 2015
New changeset 9d3013a383eb by Victor Stinner in branch '3.4':
Issue bpo-22585: os.urandom() now releases the GIL when the getentropy() is used
https://hg.python.org/cpython/rev/9d3013a383eb
New changeset 7f1015e4277a by Victor Stinner in branch 'default':
(Merge 3.4) Issue bpo-22585: os.urandom() now releases the GIL when the
https://hg.python.org/cpython/rev/7f1015e4277a