> On Jun 11, 2016, at 4:48 PM, Guido van Rossum <gu...@python.org> wrote:
> 
> But I find an os.getrandom() that only exists on those (few?) platforms that 
> support it a nuisance too -- this just encourages cargo cult code that's 
> unnecessarily complicated and believed to be secure without anybody ever 
> verifying.



Well, new enough Linux has getrandom(0), OpenBSD has getentropy(), Solaris has 
getrandom(), Windows has CryptGenRandom which all make it possible (or it’s the 
only way to invoke it) to get cryptographically secure random bytes or block 
and no in-between. So it’d likely be possible to have os.getrandom() with 
blocking semantics and no FD on all of the most popular platforms we support.

If we relax the no FD then FreeBSD and OS X also have /dev/random (or 
/dev/urandom it’s the same thing) which will ensure that you give 
cryptographically secure random bytes.

—
Donald Stufft



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to