Re: OpenSSL randomness seeding

2020-08-02 Thread Daniel Gustafsson
> On 2 Aug 2020, at 09:05, Michael Paquier wrote: > > On Sat, Aug 01, 2020 at 11:48:23PM -0700, Noah Misch wrote: >> On Thu, Jul 30, 2020 at 11:42:16PM +0200, Daniel Gustafsson wrote: >>> Somewhat on topic though, 1.1.1 adds a RAND_priv_bytes function for random >>> numbers that are supposed to b

Re: OpenSSL randomness seeding

2020-08-02 Thread Michael Paquier
On Sat, Aug 01, 2020 at 11:48:23PM -0700, Noah Misch wrote: > On Thu, Jul 30, 2020 at 11:42:16PM +0200, Daniel Gustafsson wrote: >> Somewhat on topic though, 1.1.1 adds a RAND_priv_bytes function for random >> numbers that are supposed to be private and extra protected via it's own >> DRBG. >> May

Re: OpenSSL randomness seeding

2020-08-01 Thread Noah Misch
On Thu, Jul 30, 2020 at 11:42:16PM +0200, Daniel Gustafsson wrote: > Somewhat on topic though, 1.1.1 adds a RAND_priv_bytes function for random > numbers that are supposed to be private and extra protected via it's own DRBG. > Maybe we should use that for SCRAM salts etc in case we detect 1.1.1? M

Re: OpenSSL randomness seeding

2020-07-30 Thread Daniel Gustafsson
> On 26 Jul 2020, at 09:06, Michael Paquier wrote: > > On Wed, Jul 22, 2020 at 11:31:38PM +0200, Daniel Gustafsson wrote: >> Thanks for picking it up! > > For the archives, the patch set has been applied as ce4939f and > 15e4419 on HEAD. Thanks, Noah. Indeed, thanks! >>> Do you happen to know

Re: OpenSSL randomness seeding

2020-07-26 Thread Michael Paquier
On Wed, Jul 22, 2020 at 11:31:38PM +0200, Daniel Gustafsson wrote: > Thanks for picking it up! For the archives, the patch set has been applied as ce4939f and 15e4419 on HEAD. Thanks, Noah. > That's a good question. I believe that if one actually do use RAND_cleanup as > a re-seeding mechanism

Re: OpenSSL randomness seeding

2020-07-22 Thread Daniel Gustafsson
> On 22 Jul 2020, at 07:00, Noah Misch wrote: > > On Tue, Jul 21, 2020 at 02:13:32PM +0200, Daniel Gustafsson wrote: >> The silver lining here is that while OpenSSL nooped RAND_cleanup, they also >> changed what is mixed into seeding so we are still not sharing a sequence. >> To >> fix this, ch

Re: OpenSSL randomness seeding

2020-07-21 Thread Michael Paquier
On Tue, Jul 21, 2020 at 10:00:20PM -0700, Noah Misch wrote: > These look good. I'll push them on Saturday or later. I wondered whether to > do both RAND_cleanup() and RAND_poll(), to purge all traces of the old seed on > versions supporting both. Since that would strictly (albeit negligibly) > i

Re: OpenSSL randomness seeding

2020-07-21 Thread Noah Misch
On Tue, Jul 21, 2020 at 02:13:32PM +0200, Daniel Gustafsson wrote: > The silver lining here is that while OpenSSL nooped RAND_cleanup, they also > changed what is mixed into seeding so we are still not sharing a sequence. To > fix this, changing the RAND_cleanup call to RAND_poll should be enough

Re: OpenSSL randomness seeding

2020-07-21 Thread Michael Paquier
On Tue, Jul 21, 2020 at 10:36:53PM +0200, Daniel Gustafsson wrote: > I think the original intention was to handle older OpenSSL versions where > multiple successful RAND_poll calls were required for RAND_status to succeed, > the check working as an optimization since a failing RAND_poll would rende

Re: OpenSSL randomness seeding

2020-07-21 Thread Daniel Gustafsson
> On 21 Jul 2020, at 22:00, David Steele wrote: > > On 7/21/20 3:44 PM, Daniel Gustafsson wrote: >>> On 21 Jul 2020, at 17:31, David Steele wrote: >>> On 7/21/20 8:13 AM, Daniel Gustafsson wrote: Another thing that stood out when reviewing this code is that we optimize for RAND_p

Re: OpenSSL randomness seeding

2020-07-21 Thread David Steele
On 7/21/20 3:44 PM, Daniel Gustafsson wrote: On 21 Jul 2020, at 17:31, David Steele wrote: On 7/21/20 8:13 AM, Daniel Gustafsson wrote: Another thing that stood out when reviewing this code is that we optimize for RAND_poll failing in pg_strong_random, when we already have RAND_status checkin

Re: OpenSSL randomness seeding

2020-07-21 Thread Daniel Gustafsson
> On 21 Jul 2020, at 17:31, David Steele wrote: > On 7/21/20 8:13 AM, Daniel Gustafsson wrote: >> Another thing that stood out when reviewing this code is that we optimize for >> RAND_poll failing in pg_strong_random, when we already have RAND_status >> checking for a sufficiently seeded RNG for

Re: OpenSSL randomness seeding

2020-07-21 Thread David Steele
On 7/21/20 8:13 AM, Daniel Gustafsson wrote: After forking we call RAND_cleanup in fork_process.c to force a re-seed to ensure that two backends cannot share sequence. OpenSSL 1.1.0 deprecated RAND_cleanup, and contrary to how they usually leave deprecated APIs working until removed, they decide

OpenSSL randomness seeding

2020-07-21 Thread Daniel Gustafsson
After forking we call RAND_cleanup in fork_process.c to force a re-seed to ensure that two backends cannot share sequence. OpenSSL 1.1.0 deprecated RAND_cleanup, and contrary to how they usually leave deprecated APIs working until removed, they decided to silently make this call a noop like below: