<div dir="ltr"><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Theo de Raadt</b><br>Date: Wed, Sep 9, 2015 at 10:36 AM<br>Subject: Re: getentropy, getrandom, arc4random()<br>To: <a href="mailto:guido@python.org">guido@python.org</a><br><br><br><span class="">> Yet another thing. Where do you see that Go and Swift have secure random as<br>
> a keyword? Searching for "golang random" gives the math/rand package as the<br>
> first hit, which has a note reminding the reader to use crypto/rand for<br>
> security work.<br>
<br>
</span>yes, well, look at the other phrase it uses...<br>
<br>
    that produces a deterministic sequence of values each time a program is run<br>
<br>
it documents itself as being decidely non-random.  that documentation<br>
change happened soon after this event:<br>
<br>
    <a href="https://lwn.net/Articles/625506/" rel="noreferrer" target="_blank">https://lwn.net/Articles/625506/</a><br>
<br>
these days, the one people are using is found using "go secure random"<br>
<br>
    <a href="https://golang.org/pkg/crypto/rand/" rel="noreferrer" target="_blank">https://golang.org/pkg/crypto/rand/</a><br>
<br>
that opens /dev/urandom or uses the getrandom system call depending on<br>
system.  it also has support for the windows entropy API.  it pulls<br>
data into a large buffer, a cache.  then each subsequent call, it<br>
consumes some, until it rus out, and has to do a fresh read.  it<br>
appears to not clean the buffer behind itself, probably for<br>
performance reasons, so the memory is left active.  (forward secrecy<br>
violated)<br>
<br>
i don't think they are doing the best they can...  i think they should<br>
get forward secrecy and higher performance by having an in-process<br>
chacha.  but you can sense the trend.<br>
<br>
here's an example of the fallout..<br>
<br>
<a href="https://github.com/golang/go/issues/9205" rel="noreferrer" target="_blank">https://github.com/golang/go/issues/9205</a><br>
<span class=""><br>
> For Swift it's much the same -- there's an arc4random() in<br>
> the Darwin package but nothing in the core language.<br>
<br>
</span>that is what people are led to use.<br>
</div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>