Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72368 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53995 invoked from network); 7 Feb 2014 07:15:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2014 07:15:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.169 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.169 mail-qc0-f169.google.com Received: from [209.85.216.169] ([209.85.216.169:44398] helo=mail-qc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/23-34013-D0884F25 for ; Fri, 07 Feb 2014 02:15:25 -0500 Received: by mail-qc0-f169.google.com with SMTP id w7so5280323qcr.0 for ; Thu, 06 Feb 2014 23:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tqg6mHZumtyzo79IUsskcqaKIbFFx/BEsKO1PC/ZlDU=; b=ZQZsSbFl3hBQbnfxduOtBr0ccgL+AlB8t2th2sWq6UPZoBuH9zHbpU7VYdsuhzRexc z+6kKGUlCeso8iXMwWhvkHiBSXld2QpAOxzyZDgr7ZjKq2SJUo8dr4aE4O5p+bwK9EFD 5h+GIodcVFZCQWjePbZI/LAaoHnpaiNZ5QNwNPTgjyFm1sbXb5dcpm4XszIkWjaPNm8N AGgUyA6M4hu4GXNaMJlI3jcg9VvlHvniTe1Fo3wwQczIH0zYd+etG2MLv0qdwAu+m1Gj AEWAkuKHLW0kpH0TQLD9esx2yFjI2vtgeMXaKik/1mPd7YPJ4LP8P1LrCnrTs5WhNldW 7+iQ== MIME-Version: 1.0 X-Received: by 10.140.100.196 with SMTP id s62mr10535458qge.115.1391757323277; Thu, 06 Feb 2014 23:15:23 -0800 (PST) Received: by 10.140.18.145 with HTTP; Thu, 6 Feb 2014 23:15:23 -0800 (PST) In-Reply-To: References: <52F485C1.4010208@cubiclesoft.com> Date: Fri, 7 Feb 2014 08:15:23 +0100 Message-ID: To: Tjerk Meesters Cc: Thomas Hruska , PHP Development Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Make mcrypt_create_iv() an alias and move the code into /ext/standard From: pierre.php@gmail.com (Pierre Joye) On Fri, Feb 7, 2014 at 8:10 AM, Tjerk Meesters wrote: > Hi Thomas, > > On Fri, Feb 7, 2014 at 3:05 PM, Thomas Hruska wrote: > >> mcrypt_create_iv() is the cleanest access to a universal system-level >> primitive that supports both /dev/urandom and php_win32_get_random_bytes() >> under the hood. Unfortunately, it resides in /ext/mcrypt and the mcrypt >> extension isn't always enabled/available (nor should it be). At any rate, >> it is quite odd that the function php_win32_get_random_bytes() is compiled >> into the core of PHP by default under Windows but there's currently no way >> to get at it except through an extension. There's good code in >> mcrypt_create_iv() that is significantly useful outside of the rest of that >> extension and it isn't actually dependent upon libmcrypt for proper >> operation. >> > > We already have something similar to that in password.c: > > http://lxr.php.net/xref/PHP_5_6/ext/standard/password.c#111 > > It shouldn't be hard to turn this into an API function so that other code > written against php can use it for their own purposes. While reading this code portion, I wonder if anyone has tested it on system where there is no urandom available but other names. I think it should use the entropy source ini setting instead of hard coded urandom. Thoughts? Cheers, -- Pierre @pierrejoye | http://www.libgd.org