Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97912 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10329 invoked from network); 21 Jan 2017 14:41:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2017 14:41:02 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.218 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.218 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.218] ([81.169.146.218:21512] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/6E-00729-DF273885 for ; Sat, 21 Jan 2017 09:41:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1485009659; l=2936; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=Qg74/QLLCbz9eJnb0nWzhLeCJGlMHP37AkzpyyX+Ijc=; b=OvXfJe7uzutuPljksdaH2zpON9cZoHdsQblI64Jc5EaSuGXGBjMP5maVmGl1qP+029 bRxbd/bvdUbAldZqHYayLSCh+iiSEzgFchfTbcOU8PjyDcX+G0uVZanSgEGZfPryXIxt vSSixLIvhCyaC0UjaB0Q6YUtjQz3bUc62cZJE= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoBPBqDwsb8= X-RZG-CLASS-ID: mo00 Received: from mail-qk0-f181.google.com ([209.85.220.181]) by smtp.strato.de (RZmta 39.11 AUTH) with ESMTPSA id t07b31t0LEex3g5 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Sat, 21 Jan 2017 15:40:59 +0100 (CET) Received: by mail-qk0-f181.google.com with SMTP id s140so38905451qke.0 for ; Sat, 21 Jan 2017 06:40:59 -0800 (PST) X-Gm-Message-State: AIkVDXJN6UejkSmVbYlGXSO3YIfU7V9rIAdTayCyKN8Bs4np9dw8qgxswR7Ee872d5LQsjURuGcPhpVpxaXS7g== X-Received: by 10.233.237.136 with SMTP id c130mr18090125qkg.160.1485009658579; Sat, 21 Jan 2017 06:40:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.144.132 with HTTP; Sat, 21 Jan 2017 06:40:58 -0800 (PST) In-Reply-To: References: <71c26cd6df6f59e76dafd31647852c2e@koti.fimnet.fi> <142a3537a99809cf23d78e0eaadc3aef@gmail.com> <7a359bb08b0ad8b046534c15492cec91@gmail.com> <8cfe7a3ea5a05fc3e5347e9af848ada0@gmail.com> Date: Sat, 21 Jan 2017 15:40:58 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Yasuo Ohgaki Cc: =?UTF-8?Q?Lauri_Kentt=C3=A4?= , Leigh , Nikita Popov , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=94eb2c09830e3018b105469bc152 Subject: Re: [PHP-DEV] Re: Improving mt_rand() seed From: me@kelunik.com (Niklas Keller) --94eb2c09830e3018b105469bc152 Content-Type: text/plain; charset=UTF-8 > > > Anyway, unusable CSPRNG is very unlikely to happen. I may just use > > UNEXPECTED macro for the if branch. > > > > I changed my mind due to comment for uniqid() CSPRNG usage. > > IMO, there is no benefit for CSPRNG failure fallback. We shouldn't add > fackback for every CSPRNG usage. Right, we absolutely should not. Most usages of a CSPRNG require a CSPRNG, while mt_rand and uniqid do not, so it's a different case here. > It's just does not make sense. Are we > going to add poor fallbacks for every CSPRNG usage? I strongly against it. > > CSPRNG failure is like BUS error, i.e. hardware error. CSPRNG shouldn't > fail with healthy hardware/OS. Therefore, we should not add poor fallback > code for it. A CSPRNG is not necessarily a hardware error. PHP might run on weird platforms, no? Anyway, the "issue" with mt_rand is not the seed being predictable but the internal state being recoverable from the output. But mt_rand is predictable by design, so why should we even seed it with a CSPRNG by default? Regards, Niklas --94eb2c09830e3018b105469bc152--