tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getrandom and getentropy

> Date: Sun, 10 May 2020 00:10:49 +0000
> From:
> On Sat, May 09, 2020 at 10:56:51PM +0000, Taylor R Campbell wrote:
> > Given that, I think it is reasonable to implement getentropy(...)  as
> > an alias for getrandom(..., GRND_INSECURE) == read from /dev/urandom
> > == sysctl kern.arandom (as nia@ just committed the other day), which
> > is consistent with the somewhat nuanced interpretation of the
> > semantics above, and to provide getrandom(...,0) as I originally
> > suggested alongside it.
> Given that getentropy as KERN_ARND is good enough for everyone, why not
> stick #define getrandom(a,b,c) getentropy(a,b) In some header?

That does not correctly implement the semantics, even aside from
blocking or pool state or any of the interesting stuff -- getentropy
is limited to 256 bytes and returns 0 or -1; getrandom is not so
limited and returns the number of bytes generated or -1.

Home | Main Index | Thread Index | Old Index