Jelle Zijlstra added the comment:

I'm interested in implementing this for 3.6, but I'm not sure exactly what the 
changes are that were decided upon. Is the following accurate?

1. Nothing changes in os (all the necessary changes were made in 3.5.2 already).
2. On Linux 3.17+ only, we add a new extension module called _secrets that 
provides a wrapper around the getrandom() system call and nothing else. I'll 
have to figure out whether to make the extension module just not exist all on 
non-Linux OSs (are there any existing extension modules that only exist on one 
OS?), or whether to make it empty on non-Linux. _secrets.getrandom() will look 
like def getrandom(buflen: int, flags: int) -> bytes.
3. We change secrets.SystemRandom so that on Linux 3.17+ only, it subclasses 
random.SystemRandom to use _secrets.getrandom() instead of os.urandom(). We 
will not pass in any flags to getrandom() (so we read from /dev/urandom and 
block until there is sufficient entropy). To make the subclassing easier, we 
may want to change random.SystemRandom to have a private method for calling 
os.urandom. (Currently, both of its methods call os.urandom directly.)
4. Similarly, we change secrets.token_bytes to use _secrets.getrandom(). Other 
functions in secrets.py won't need to change since they use 
secrets.SystemRandom or secrets.token_bytes.
5. _secrets and _secrets.getrandom will remain private and undocumented.

----------
nosy: +Jelle Zijlstra

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27288>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to