Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107311 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 56358 invoked from network); 24 Sep 2019 16:47:52 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 24 Sep 2019 16:47:52 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id AE7582D19AB for ; Tue, 24 Sep 2019 07:26:47 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 64.147.123.0/24 X-Spam-Virus: No Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Tue, 24 Sep 2019 07:26:46 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id CDCB34F3 for ; Tue, 24 Sep 2019 10:26:45 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Tue, 24 Sep 2019 10:26:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=XKV0Hy SGjDjqPaTBavC95CWwgO5gXC1kNXB2AhctsVs=; b=YQ8Ri3+kJb3Ifg+2+7BKuF HaEq5fvZSZVfZx6BJzQJuOzK+iWrxHvTmMgfXyi7IbtJ+23X3QIlbN8w+0LkKcS0 Dt2NnDh7G3vLmqZZAPrtW7mPosOQBOc/mEVbvT8+F9qBmWcs/RHgLnQem4akWBI4 e9ynzI3qhQ4PGm7xakkoFmymwQWcun1awJBg/95s2Ia0NqsuW9ssWHRJwJOzIyVm RiLzTdGbXlCJkAfIrTVYxIfXm4Kxaeik+ENzmQnu0/39Pg9/fY7XqMht1NqAnt1f K64ActAw+Wl2a5fBYcxkfgRGx/MqZM5yJin0ZhHUvdEAqR6sjl9Za7RLCSunNLdw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrfedtgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggt hhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 30A3F14200A1; Tue, 24 Sep 2019 10:26:45 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-238-g170a812-fmstable-20190913v1 Mime-Version: 1.0 Message-ID: <11c4fa89-29b3-4639-9dd9-5adff968e437@www.fastmail.com> In-Reply-To: <9479751B-281E-4590-85E7-51EEAF066C73@cschneid.com> References: <696dc114-c2df-40aa-aad6-5b87d4373c0e@www.fastmail.com> <9479751B-281E-4590-85E7-51EEAF066C73@cschneid.com> Date: Tue, 24 Sep 2019 09:26:24 -0500 To: "php internals" Content-Type: text/plain X-Envelope-From: Subject: Re: [PHP-DEV] PHP 7.4 BC break with openssl_random_pseudo_bytes() From: larry@garfieldtech.com ("Larry Garfield") On Mon, Sep 23, 2019, at 11:34 AM, Christian Schneider wrote: > Am 23.09.2019 um 17:16 schrieb Larry Garfield : > > 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. > > I see your point but I'm still not convinced that it is worth the BC. > But whatever is decided for this specific change, I'm more interested > in handling this properly for future RFCs, i.e. people should get the > full picture concerning BC before voting. > > A little side-node: random_int(0, 0) does not throw an exception which > makes random_bytes and random_int inconsistent by your logic ;-) > > - Chris Er. Leaving random_bytes() as is has no BC break, kinda by definition. I was arguing that changing it to return false would be a Very Bad Thing(tm). And no, random_int(0,0) does what it says on the tin: return a random int between 0 and 0. If you call it that way, well, it's your own PEBCAK. But it throws an exception if the underlying sources of entropy are not working for some reason, rather than returning something that can easily be mistaken for a valid integer. random_*() are Doing It Right(tm). Don't change them. :-) --Larry Garfield