tech-userlevel archive

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

Re: randomness (crypto?) code example wanted please?

On 25/06/2017 14:28, Kamil Rytarowski wrote:
On 25.06.2017 14:06, Martin Husemann wrote:
You can also read random bytes from /dev/urandom.


Right this is the most portable solution right now. I don't think
RANDOM_BITS or similar is currently useful, it will grow incompatible
extension - better to prompt POSIX to standardize something.

Don't count on that happening soon.

dhcpcd ships with the the original OpenBSD version of arc4random that seeds off urandom if it cannot detect it in libc in configure. It also has arc4random_uniform as well.

All modern BSD's have arc4random (and most have arc4random_uniform) - some use something more modern like ChaCha, so it's just an interface really.

Just like sh, dhcpcd can start very early .... sometimwes before enough entropy has been generated just to pull blindly from /dev/urandom because it can block - or did in the past; it might be fixed now.


Home | Main Index | Thread Index | Old Index