Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98013 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80379 invoked from network); 28 Jan 2017 21:33:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2017 21:33:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:43814] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/71-06271-72E0D885 for ; Sat, 28 Jan 2017 16:33:29 -0500 Received: (qmail 109891 invoked by uid 89); 28 Jan 2017 21:33:23 -0000 Received: from unknown (HELO mail-wm0-f42.google.com) (yohgaki@ohgaki.net@74.125.82.42) by 0 with ESMTPA; 28 Jan 2017 21:33:23 -0000 Received: by mail-wm0-f42.google.com with SMTP id r126so163267961wmr.0 for ; Sat, 28 Jan 2017 13:33:22 -0800 (PST) X-Gm-Message-State: AIkVDXIG0HyDcDP3Orqz9D9jIbcCMHbS/Pyrg4kBUHRtigT+J+G6ipgYW6vb1PjUZLAq7jArNjXRfg9PmWzPfw== X-Received: by 10.223.176.142 with SMTP id i14mr15138390wra.4.1485639195848; Sat, 28 Jan 2017 13:33:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.195.12.8 with HTTP; Sat, 28 Jan 2017 13:32:34 -0800 (PST) In-Reply-To: <23aa87eb-4dc6-3773-94b0-02e6c3ba78ef@thefb.org> References: <71c26cd6df6f59e76dafd31647852c2e@koti.fimnet.fi> <142a3537a99809cf23d78e0eaadc3aef@gmail.com> <7a359bb08b0ad8b046534c15492cec91@gmail.com> <8cfe7a3ea5a05fc3e5347e9af848ada0@gmail.com> <23aa87eb-4dc6-3773-94b0-02e6c3ba78ef@thefb.org> Date: Sun, 29 Jan 2017 06:32:34 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Tom Worster Cc: "internals@lists.php.net" , <"Lauri Kenttä"@es-i.jp>, Leigh , Nikita Popov Content-Type: multipart/alternative; boundary=001a11419362887cc505472e54ce Subject: Re: [PHP-DEV] Re: Improving mt_rand() seed From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11419362887cc505472e54ce Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Tom, On Sun, Jan 22, 2017 at 1:26 AM, Tom Worster wrote: > On 1/20/17 9:55 PM, Yasuo Ohgaki wrote: > >> CSPRNG failure is like BUS error, i.e. hardware error. CSPRNG shouldn't >> fail with healthy hardware/OS. >> > > One would like to think so but low entropy environments exist. The problem > may even be getting more widespread as embedded systems become more > widespread. > Could you give some examples? I'm not sure what kind of IoT devices/OS that support PHP do not have CSPRNG. OSes can provide CSPRNG w/o hardware based RNG. Security on IoT matters a lot, especially for IoT that supports PHP. CSPRNG features are in PHP core already. Secure PHP scripts wouldn't work anyway on such devices anyway. e.g. generating nonce or like. > Therefore, we should not add poor fallback >> code for it. >> > > I don't see a need or value in breaking programs that previously worked > properly in the absence of a functioning system CSPRNG. > > mt_rand() and uniqid() were not secure before so seed them securely if you > can otherwise let them work as they did before. > Issues are - Current mt_rand() is not fully exploited. It wastes more than 99% of its random cycle. - Current uniqid()'s entropy is extremely poor and there is fair chances for collisions. Question is - Are we going to keep these poor behaviors as PHP spec/standard forever or not. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11419362887cc505472e54ce--