tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: getrandom and getentropy
> Date: Sat, 2 May 2020 11:10:44 +0200
> From: Kurt Roeckx <kurt%roeckx.be@localhost>
>
> On Fri, May 01, 2020 at 07:19:09PM +0000, Taylor R Campbell wrote:
> >
> > The alias getentropy(p,n) := getrandom(p,n,GRND_INSECURE)
>
> At several places in your document you imply this. But
> getentropy(p,n) is more like getrandom(p,n,0). That is, it also
> waits until it's seeded, it only blocks a single time.
>
> I hink we've previously talked about it, and you said the OpenBSD
> manpage doesn't mention anything related to it. But it's implied
> behaviour for OpenBSD, they never had an interface where you can
> get random numbers before it's properly seeded.
I reviewed the OpenBSD implementation at
https://cvsweb.openbsd.org/src/sys/dev/rnd.c?rev=1.204&content-type=text/x-cvsweb-markup
and I see no evidence of blocking. Where does it block?
On OpenBSD, /dev/random and /dev/urandom are the same -- they both
never block, according to <https://man.openbsd.org/urandom>.
I reviewed the OpenBSD commit logs, and I don't see any evidence of
any blocking paths since 2010 when /dev/srandom was removed:
https://cvsweb.openbsd.org/src/sys/dev/rnd.c?rev=1.103&content-type=text/x-cvsweb-markup
Generally whether something can block or not is an important part of
the API contract, and it seems to me that from the beginning when
OpenBSD introduced getentropy it has never blocked.
Home |
Main Index |
Thread Index |
Old Index