Page MenuHomeFreeBSD

getrandom(2): Add Linux GRND_INSECURE API flag

Authored by cem on Jan 10 2020, 11:21 PM.



Treat it as a synonym for GRND_NONBLOCK, for reasons argued in the new code
comment. Document in getrandom.2.

Test Plan

See summary of the Linux change :

It adds getentropy(..., GRND_INSECURE). This causes getentropy to always return *something*. There is no guarantee whatsoever that the result will be cryptographically random or even unique, but the kernel will give the best quality random output it can. The name is a big hint: the resulting output is INSECURE.

The purpose of this is to allow programs that genuinely want best-effort entropy to get it without resorting to /dev/urandom. Plenty of programs do this because they need to do *something* during boot and they can't afford to wait. Calling it "INSECURE" is probably the best we can do to discourage using this API for things that need security.

GRND_INSECURE accepted by tytso:

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bcr added a subscriber: bcr.

OK from manpages.

markm added a subscriber: markm.
markm added inline comments.
1 ↗(On Diff #66607)

Aren't we dropping the "All rights reserved" bit as being legally meaningless?

This revision is now accepted and ready to land.Jan 12 2020, 12:21 PM
1 ↗(On Diff #66607)

I'm not a lawyer and I haven't heard that from my lawyer, so I'll just leave it in for now. (This revision just pulls it all on a single line, which is the current guidance -- to clarify which copyright(s) the A.R.R. applies to.)

This revision was automatically updated to reflect the committed changes.