TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Myths about /dev/urandom (2014)

201 pointsby Ivoahover 8 years ago

15 comments

technionover 8 years ago
I&#x27;ve given up on the hope that these myths will ever die. Every time it&#x27;s relevant, someone pipes up complaining urandom isn&#x27;t safe for use, or will run out of entropy. Have a look at the bugs for Node, Ruby and Wordpress.<p>And inevitably, the appeal to authority ends up referring to these projects.<p>Serious question, if I submitted a patch for the man page detailing the content of this myths page, is there a chance it might go somewhere and put somewhat of an end to some of this?
评论 #13334459 未加载
评论 #13333990 未加载
评论 #13333675 未加载
评论 #13334435 未加载
评论 #13333878 未加载
评论 #13333614 未加载
评论 #13333610 未加载
schoenover 8 years ago
A useful article, originally from 2014 but updated recently.<p>Previous HN discussions:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7359992" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7359992</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10149019" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10149019</a>
评论 #13334396 未加载
Paul-ishover 8 years ago
While it may be generally better to use &#x2F;dev&#x2F;urandom, what about the Mining Your Ps and Qs paper?[1]. It finds that:<p>&gt; Every software package we examined relies on &#x2F;dev&#x2F;urandom to generate cryptographic keys; however, we find that Linux’s random number generator (RNG) can exhibit a boot-time entropy hole that causes urandom to produce deterministic output under conditions likely to occur in headless and embedded devices. In experiments with OpenSSL and Dropbear SSH, we show how repeated output from the system RNG can lead not only to repeated long-term keys but also to factorable RSA keys and repeated DSA ephemeral keys due to the behavior of application-specific entropy pools.<p>This is mentioned a little at the end of the article. Would it be a breaking change for Linux to block urandom at startup?<p>[1] <a href="https:&#x2F;&#x2F;factorable.net&#x2F;weakkeys12.conference.pdf" rel="nofollow">https:&#x2F;&#x2F;factorable.net&#x2F;weakkeys12.conference.pdf</a>
评论 #13336956 未加载
评论 #13334266 未加载
评论 #13334286 未加载
Bugeover 8 years ago
&#x2F;dev&#x2F;urandom does have a problem with not enough entropy sometimes. Yes it never &quot;runs out&quot; of entropy when it has enough previously. But when a computer first boots up, sometimes it doesn&#x27;t have enough entropy yet, and gives bad output.<p>This causes problems in practice, allowing people to crack RSA private keys. <a href="https:&#x2F;&#x2F;factorable.net&#x2F;weakkeys12.extended.pdf" rel="nofollow">https:&#x2F;&#x2F;factorable.net&#x2F;weakkeys12.extended.pdf</a>
评论 #13334801 未加载
kbakerover 8 years ago
tldr; just use &#x2F;dev&#x2F;urandom --- this should be at the top of the page.<p>Maybe prefix the bold sections with Myth: so it is easier to read. I was really confused as to which side of the argument the author was on at first...
评论 #13334564 未加载
评论 #13333169 未加载
alpbover 8 years ago
Also Filippo Varsaldo has a nice talk about this:<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Q8JAlZ-HJQI" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Q8JAlZ-HJQI</a>
评论 #13333274 未加载
ComodoHackerover 8 years ago
So what are the cases when you should <i>actually</i> use &#x2F;dev&#x2F;random and not &#x2F;dev&#x2F;urandom? The article fails to address this in clear.
评论 #13335406 未加载
haartsover 8 years ago
I am so confused about this all the time. My solution is to go see what Go is using: <a href="https:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;crypto&#x2F;rand&#x2F;rand.go" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;crypto&#x2F;rand&#x2F;rand.go</a> Trusting them to do the Right Thing.<p>Is there a good reason why &#x2F;dev&#x2F;random AND &#x2F;dev&#x2F;urandom exist?
评论 #13335362 未加载
jlgaddisover 8 years ago
I bought a TrueRNG v3 [0] a month or so ago and have been using it with rngd &#x2F; rng-tools.<p>I wish rngd was easier to use with multiple entropy sources, however. Even w&#x2F; RDRAND (times two -- dual CPUs), a TPM, and the TrueRNG, it&#x27;s difficult to (easily) tell which of these are being used and&#x2F;or if more than one is being used.<p>Ideally, I&#x27;d like to be able to tell rngd to use&#x2F;mix the TrueRNG, RDRAND in both CPUs, the TPM, and any other entropy sources I may come up with, such as RTL-SDRs doing funky things [1]. I suppose I could just run multiple instances of rngd, though.<p>Anyway, I&#x27;ve switched to just using &#x2F;dev&#x2F;random for pretty much everything (where it can be configured) since, with the TrueRNG, it never blocks on me now.<p>[0]: <a href="http:&#x2F;&#x2F;ubld.it&#x2F;truerng_v3" rel="nofollow">http:&#x2F;&#x2F;ubld.it&#x2F;truerng_v3</a><p>[1]: <a href="https:&#x2F;&#x2F;www.google.com&#x2F;search?q=rtl-str+entropy" rel="nofollow">https:&#x2F;&#x2F;www.google.com&#x2F;search?q=rtl-str+entropy</a>
评论 #13333833 未加载
评论 #13333529 未加载
评论 #13334194 未加载
wruzaover 8 years ago
What I&#x27;ve got from this thread is that you never touch security-related prngs unless you&#x27;re an expert in security, cryptography and operating systems, <i>all at the same time</i>, and even then you care a lot. Thanks for deeper debunking.
CiPHPerCoderover 8 years ago
The advice on this page is accurate and in line with what cryptography experts will recommend.<p>That said, if you&#x27;re looking for more of the <i>how</i> and less of the <i>why</i>: <a href="https:&#x2F;&#x2F;paragonie.com&#x2F;blog&#x2F;2016&#x2F;05&#x2F;how-generate-secure-random-numbers-in-various-programming-languages" rel="nofollow">https:&#x2F;&#x2F;paragonie.com&#x2F;blog&#x2F;2016&#x2F;05&#x2F;how-generate-secure-rando...</a><p>Contains snippets and recommendations for C&#x2F;C++, Erlang, Go, Java, (Browser) JavaScript, .NET, Node.js, PHP, Python, Ruby, and Rust.
评论 #13337028 未加载
matt_wulfeckover 8 years ago
This is really no problem now that Intel chips ship with RDRAND instructions. Linux should follow BSD&#x2F;Mac&#x27;s footsteps and incorporate a good CSPRNG non-blocking devices (after seed). I believe BSD is moving towards Fortuna, which is perfect for this use-case.<p>With these instructions you&#x27;ll always get a &quot;good&quot;[1] seed for your CSPRNG, and that includes virtual machines and clones.<p>[1] Of course that depends on how much you trust Intel. Don&#x27;t ask the crypto mailing lists whether this is a good idea :-)
评论 #13333403 未加载
评论 #13333533 未加载
bluedinoover 8 years ago
One to add - it&#x27;s not fast at providing a value<p>I remember learning this when I found &#x2F;dev&#x2F;urandom multiple times slower than &#x2F;dev&#x2F;null while writing garbage data to disk.
评论 #13333509 未加载
anon335dtzbvcover 8 years ago
its like aes 128 bit vs aes 256 bit, both are secure but when in doubt me, you and the nsa choose 256 bit
joelbondurantover 8 years ago
&quot;And even if you need that peace of mind, let me tell you a secret: no practical attacks on AES, SHA-3 or other solid ciphers and hashes are known in the “unclassified” literature, either. Are you going to stop using those, as well? Of course not!&quot;<p><a href="http:&#x2F;&#x2F;www.pcworld.com&#x2F;article&#x2F;3117728&#x2F;security&#x2F;why-quantum-computing-has-the-cybersecurity-world-white-knuckled.html" rel="nofollow">http:&#x2F;&#x2F;www.pcworld.com&#x2F;article&#x2F;3117728&#x2F;security&#x2F;why-quantum-...</a><p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Grover&#x27;s_algorithm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Grover&#x27;s_algorithm</a>
评论 #13334836 未加载
评论 #13334140 未加载