Re: PG 10: could not generate random cancel key

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: PG 10: could not generate random cancel key
Дата
Msg-id CAEZATCXwi0PC=bVSM457wFqj1WZQFfVb+Bxpy8ywJEKsQ8d4fg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PG 10: could not generate random cancel key  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: PG 10: could not generate random cancel key
Список pgsql-hackers
On 17 July 2018 at 14:04, Michael Paquier <michael@paquier.xyz> wrote:
> On Tue, Jul 17, 2018 at 01:33:11PM +0100, Dean Rasheed wrote:
>> Looking for precedents elsewhere, I found [2] which does exactly that,
>> although I'm slightly dubious about the need for the for-loop there. I
>> also found a thread [3], which recommends simply doing
>>
>> if (RAND_status() == 0)
>>     RAND_poll();
>>
>> which seems preferable. Attached is a patch to do this in pg_strong_random().
>
> Checking for the return result of RAND_poll() would also be good thing
> to do.  From what I read in OpenSSL code it could fail as well, and
> we could combine that with a loop attempted to feed the machinery a
> decided amount of times, just failing after successive failures.

From what I understand from here [1], some parts of OpenSSL call
RAND_poll() once on initialisation, and that's enough to get the PRNG
going. It's not obvious that calling it multiple times would have any
benefit.

They also don't appear to bother checking the return code from
RAND_poll() [2]. If it did fail, there'd not be much you could do
anyway, so you might as well just let it continue and let RAND_bytes()
fail. In fact it may even be possible for RAND_poll() to fail, but
just do enough to cause RAND_bytes() to succeed.

Regards,
Dean


[1] https://wiki.openssl.org/index.php/Random_Numbers
[2] https://github.com/benvanik/openssl/blob/master/openssl/crypto/rand/md_rand.c


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Haribabu Kommi
Дата:
Сообщение: Re: [bug fix] Produce a crash dump before main() on Windows
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [HACKERS] Support for Secure Transport SSL library on macOS asOpenSSL alternative