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 dstufft
Recipients alex, benjamin.peterson, christian.heimes, dstufft, giampaolo.rodola, janssen, josh.r, ncoghlan, neologix, tshepang
Date 2014-04-28.12:52:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398689553.1.0.00973656515503.issue21305@psf.upfronthosting.co.za>
In-reply-to
Content
I don't think what you're worrying about here is something that has a high chance of happening, if it even occurs in the wild at all. To be clear in order for that to matter at all in the context of this ticket, some software would need to be reading from /dev/random (which almost zero software should be doing) on a system where you have a high number of threads or async handlers all reading from /dev/urandom at the same time and reading enough data off of it to drop the entropy estimation in the primary pool down below whatever amount of data that the other process is attempting to read from /dev/random. In that case no "trouble" will occur and the process reading from /dev/random will just block waiting on additional entropy to be collected so that the entropy estimation is high enough to fulfill the request.

AFAIK there are zero practical concerns from reading as much as you want off of /dev/urandom as often as you want.

What this change does is make it "safe" to just simply use os.urandom in order to generate random bytes in a Python application. The current situation is such that any use of os.urandom is potentially a place where your application will crash in highly concurrent environments. This will drive people to either:

A) Poorly reimplement the persistent FD option, especially troublesome on Windows because the simple approach to doing so will flat out not work on Windows
B) Use a userspace CSPRNG, this is considered ill advised by most reputable cryptographer's as most of them have had issues at one point in time or another, and they all generally depend on the security of /dev/urandom anyways so if /dev/urandom fall they fall as well.

Using os.urandom is the *right* thing to do for getting random in an application, but the current implementation effectively punishes people who use it if their application is highly concurrent.
History
Date User Action Args
2014-04-28 12:52:33dstufftsetrecipients: + dstufft, ncoghlan, janssen, giampaolo.rodola, christian.heimes, benjamin.peterson, alex, neologix, tshepang, josh.r
2014-04-28 12:52:33dstufftsetmessageid: <1398689553.1.0.00973656515503.issue21305@psf.upfronthosting.co.za>
2014-04-28 12:52:33dstufftlinkissue21305 messages
2014-04-28 12:52:32dstufftcreate