mailing list of musl libc
 help / color / mirror / code / Atom feed
* arc4random/csprng
@ 2018-07-02 20:39 Rich Felker
  2018-07-03 13:36 ` arc4random/csprng Florian Weimer
  2018-07-03 14:18 ` arc4random/csprng Luca Barbato
  0 siblings, 2 replies; 9+ messages in thread
From: Rich Felker @ 2018-07-02 20:39 UTC (permalink / raw)
  To: musl

I haven't followed what's been happening with posix_random lately, but
glibc has adding the arc4random interfaces and it seems reasonable
that we should too, with the easy option to add the posix_random name
for it and whatever interface details POSIX decides on.

The glibc implementation looks like it's essentially CTR mode AES.
This is probably a pretty good choice, but unless there are strong
reasons not to I'd probably rather go with Hash-DRBG or HMAC-DRBG
utilizing the existing SHA-256 code we already have. That would avoid
the need to write or import any new cryptographic code (and the
associated risks) and keep the size cost minimal. This seems better
for forward-secrecy too, but I'd like to better understand the
conditions under which Hash-DRBG and HMAC-DRBG provide
forward-secrecy.

One topic I thought was a huge bikeshed was the whole fork-detection
or fork-safety thing, but apparently it's not for glibc and perhaps
other implementations because they've opted to make their csprng
lock-free and incurred a lot of complexity with safely replacing
pseudo-immutable state. I want to avoid most or all of this issue by
just using a proper lock, but it might still be necessary to do some
nasty hack for the case where fork is called from a signal handler
interrupting the csprng. The only way to avoid that entirely is to
block signals while the csprng runs, which is probably unjustifiably
slow.

Rich


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-07-04 15:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-02 20:39 arc4random/csprng Rich Felker
2018-07-03 13:36 ` arc4random/csprng Florian Weimer
2018-07-03 14:47   ` arc4random/csprng Rich Felker
2018-07-03 15:08     ` arc4random/csprng Florian Weimer
2018-07-03 15:17       ` arc4random/csprng Rich Felker
2018-07-04 11:36         ` arc4random/csprng Florian Weimer
2018-07-04 15:13           ` arc4random/csprng Rich Felker
2018-07-03 14:18 ` arc4random/csprng Luca Barbato
2018-07-03 14:49   ` arc4random/csprng Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).