Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72366 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50782 invoked from network); 7 Feb 2014 07:10:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2014 07:10:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.54 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.212.54 mail-vb0-f54.google.com Received: from [209.85.212.54] ([209.85.212.54:41661] helo=mail-vb0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/52-34013-7E684F25 for ; Fri, 07 Feb 2014 02:10:31 -0500 Received: by mail-vb0-f54.google.com with SMTP id w20so2325046vbb.13 for ; Thu, 06 Feb 2014 23:10:29 -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=h5DJ0mQjtpHJ3lq4dghU7Vt15lwwdkbln2Zwodh/5tY=; b=XeH4ZTECLUWBCJN+MGh414RAImetwnaUNvG86SKFPK1pEJatcnZyLXYrmi4cVnzr4g OaX8cyDsAynhZzICTvKVoCM6jjn3fHAOhsezRyb9d05+CUuo3RGOiY5PnNXxiHt/Lg2L gMTXA0gtCxuCWVy1nHrDKUAOAJzGpdvJ+8BmWWU+2HsRmN33K5Kn+10msEaVM2gPwlhd m2rab7VIVc1w6j9k9HLkViMyGy+RN4h8PRx0eBFjl3IW9eEwD8iZoU+7IWZKtRoOV3sF MMUFuaVS/fgbLnGm8ghYBwTy1cedDXsXr7dop9cJF7Zj//dkwl2KxFScvPBBUVMonPb6 v0Kw== MIME-Version: 1.0 X-Received: by 10.52.171.68 with SMTP id as4mr7617322vdc.0.1391757029169; Thu, 06 Feb 2014 23:10:29 -0800 (PST) Received: by 10.58.133.229 with HTTP; Thu, 6 Feb 2014 23:10:29 -0800 (PST) In-Reply-To: <52F485C1.4010208@cubiclesoft.com> References: <52F485C1.4010208@cubiclesoft.com> Date: Fri, 7 Feb 2014 15:10:29 +0800 Message-ID: To: Thomas Hruska Cc: PHP Development Content-Type: multipart/alternative; boundary=047d7b6dbd9a56606204f1cbaf58 Subject: Re: [PHP-DEV] Make mcrypt_create_iv() an alias and move the code into /ext/standard From: tjerk.meesters@gmail.com (Tjerk Meesters) --047d7b6dbd9a56606204f1cbaf58 Content-Type: text/plain; charset=ISO-8859-1 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. > Moving the guts of this non-dependent function into the core would allow > mcrypt_create_iv() to just become an alias. The new userland function > could be located in /ext/standard/rand.c and have an uncreative name like > rand_bytes(). > > -- > Thomas Hruska > CubicleSoft President > > I've got great, time saving software that you will find useful. > > http://cubiclesoft.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -- Tjerk --047d7b6dbd9a56606204f1cbaf58--