This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Lukasa, Theodore Tso, christian.heimes, dstufft, larry, lemburg, martin.panter, ncoghlan, vstinner
Date 2016-06-09.08:16:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465460202.92.0.113847940675.issue27266@psf.upfronthosting.co.za>
In-reply-to
Content
Marc-Andre Lemburg:
> I propose to deprecate os.urandom() altogether due to all the issues we've discussed on all those recent tickets.

I'm sorry, but I don't understand the purpose of this change. Usually, when we deprecate something, it is in favor of a new better function. What do you propose?

I read that you proposed to expose getrandom() as os.getrandom(). It would be painful to write portable code if each OS provides its own RNG function.

Python has the habit of helping users by providing portables functions. Recent example: time.monotonic (PEP 418). Somehow related: non inheritable file descriptors by default (PEP 446) and retry system calls failing with EINTR (PEP 475). These changes aim to simplify the life of Python developers to reduce the subtle differences between each operating system.

To me, os.urandom() is well defined. The corner case of not initialized urandom is really a corner case which only occurs in "catastrophic" cases like ("badly configured") VM or embedded devices without hardware RNG (nor RTC).

When it's hard to write a reliable behaviour on all platforms, the simple solution was always to document the subtle differences between each platforms. I started to do with documenting getrandom() and the fallback on /dev/urandom for Linux:
https://docs.python.org/dev/library/os.html#os.urandom

--

If we cannot agree on a technical solution, a PEP is required.

But please give me some time to investigate the different technical solutions before trying to take a decision.

Right now, I'm investigating the options to keep the Python startup "secure" in the "urandom not initialized" case and keep os.urandom() "blocking".
History
Date User Action Args
2016-06-09 08:16:42vstinnersetrecipients: + vstinner, lemburg, ncoghlan, larry, christian.heimes, martin.panter, dstufft, Lukasa, Theodore Tso
2016-06-09 08:16:42vstinnersetmessageid: <1465460202.92.0.113847940675.issue27266@psf.upfronthosting.co.za>
2016-06-09 08:16:42vstinnerlinkissue27266 messages
2016-06-09 08:16:42vstinnercreate