Re: [PATCH] using arc4random for strong randomness matters. - Mailing list pgsql-hackers

From ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Subject Re: [PATCH] using arc4random for strong randomness matters.
Date
Msg-id d8jmv3e2r5w.fsf@dalvik.ping.uio.no
Whole thread Raw
In response to Re: [PATCH] using arc4random for strong randomness matters.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] using arc4random for strong randomness matters.  (Andres Freund <andres@anarazel.de>)
Re: [PATCH] using arc4random for strong randomness matters.  (Andres Freund <andres@anarazel.de>)
Re: [PATCH] using arc4random for strong randomness matters.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> David CARLIER <devnexen@gmail.com> writes:
>> I m not against as such that depends of the implementation but I ve seen in
>> quick glance it s RC4 ?

arc4random uses ChaCha20 since OpenBSD 5.5 (and libbsd 0.8.0 on Linux).
It uses getentropy(2) to seed itself at regular intervals and at fork().

http://man.openbsd.org/arc4random.3

> More generally, why should we bother with an additional implementation?
> Is this better than /dev/urandom, and if so why?

If what is wanted is something more like /dev/urandom, one can call
getentropy(2) (or on Linux, getrandom(2)) directly, which avoids having
to open the device file each time.

http://man.openbsd.org/getentropy.2
https://manpages.debian.org/stretch/manpages-dev/getrandom.2.en.html

- ilmari
-- 
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live withthe consequences of."
--Skud's Meta-Law
 


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] using arc4random for strong randomness matters.
Next
From: Andres Freund
Date:
Subject: Re: [PATCH] using arc4random for strong randomness matters.