[issue33528] os.getentropy support

STINNER Victor report at bugs.python.org
Fri May 18 20:30:21 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

I know two main use cases for random numbers:

* security: use os.urandom(), secrets and random.SystemRandom
* not security: use the random module

Exposing os.getentropy() seems like a new non-portable function for the first use case, security. What does it add compared to directly call os.urandom() for example?

I chose to expose os.getrandom() for one very specific use case, described in the PEP 524: check if os.urandom() is going to block.

On OpenBSD, os.urandom() and getentropy() does never block, so os.getentropy() seems useless to me. OpenBSD design is different: the CSRPNG is feeded from the boot loader. Or tell me if I missed something.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33528>
_______________________________________


More information about the Python-bugs-list mailing list