<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 20, 2022 at 3:21 PM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 6/19/22 12:37, enh via Toybox wrote:<br>
> BSD has <sys/random.h> first, but has getentropy() in there. glibc<br>
> has getentropy() in addition to getrandom(), but they keep it in<br>
> <unistd.h> instead. Since both went in in glibc 2.25 I don't think<br>
> this will matter in practice, but if this does cause trouble, we<br>
> can have separate getentropy() and getrandom() implementations for<br>
> the BSDs versus glibc.<br>
<br>
Hmmm... git annotate says<br>
<a href="https://github.com/bminor/glibc/commit/ccb8b7f7d48" rel="noreferrer" target="_blank">https://github.com/bminor/glibc/commit/ccb8b7f7d48</a> from december 27,<br>
2016. No wait, that was inside an #ifdef STALLMAN_FTAGHN which changed<br>
to something realistic in commit<br>
<a href="https://github.com/bminor/glibc/commit/a851999f61a" rel="noreferrer" target="_blank">https://github.com/bminor/glibc/commit/a851999f61a</a> four days later.<br>
<br>
Five and a half years, meaning maybe five in distros. Not the full<br>
seven, but I'll wait for somebody to complain I guess?<br>
<br>
> This does mean that the only valid values for `flags` are now 0 or<br>
> WARN_ONLY, but that was already effectively true anyway because<br>
> GRND_NONBLOCK != O_NONBLOCK so the fallback path was already broken.<br>
<br>
Everything should always be reading from /dev/urandom not /dev/random<br>
these days. Anything else is a denial of service attack waiting to<br>
happen. (Either the pool is properly initialized or it isn't.)<br></blockquote><div><br></div><div>i was just wondering whether `int warn` (treated as a boolean) would be less unclear than `int flags`, since WARN_ONLY is the flag that works.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Rob<br>
</blockquote></div></div>