Re: PHP 7.4 BC break with openssl_random_pseudo_bytes()
| From: | Pierre Joye | Date: | Tue, 24 Sep 2019 04:18:35 +0000 |
| Subject: | Re: PHP 7.4 BC break with openssl_random_pseudo_bytes() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107306@lists.php.net to get a copy of this message | ||
On Mon, Sep 23, 2019 at 10:17 PM Larry Garfield <larry@garfieldtech.com> wrote:
> I cannot speak for OpenSSL, but random_bytes() and random_int() were changed very late in the
> 7.0 cycle to throw exceptions so that they "fail closed". Otherwise if you expect a
> random value back but get a constant value (false or empty string), if you don't remember to
> check it yourself every time then you now have a security hole because you're using a constant
> seed for random-dependent behavior.
>
> That was a good change, and it should be kept that way, IMO.
Fully agree. This is actually pretty the only way to handle errors
with these functions. Anything else creates a risk that we could have
easily prevented.
Best,
--
Pierre
@pierrejoye | http://www.libgd.org