Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68816 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63321 invoked from network); 1 Sep 2013 13:12:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2013 13:12:35 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.169 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.223.169 mail-ie0-f169.google.com Received: from [209.85.223.169] ([209.85.223.169:43639] helo=mail-ie0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/72-55332-D3D33225 for ; Sun, 01 Sep 2013 09:12:29 -0400 Received: by mail-ie0-f169.google.com with SMTP id tp5so1867018ieb.28 for ; Sun, 01 Sep 2013 06:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=DrjRMTy8AIBXy8fdRbf2tvn4Jd7fkstjH8oadh3cmzs=; b=pXWmOBovRlmfumXKpiqrA0B0fal3W16nucKYb37YbbGFCwHDuKfck8xRzbARr1iVi9 8uOvGnxDkPGs8IoENt57qlArj1mMqDPTxgDA+upQnP66sAhNzKgMEJamYXP5UoTmv1ZP YFZ0T9pfW4V18NFNgygl4bDUiEd+pF0cQarTJkpSwOYDiAn1MJkB05lGJ0pGqlkEYALL 9fYfPjecwtXRzzQMFRTkiK/H6P1kgfuGrRQuvrXBLQIeRfZEcnyI56CptrVXzeGdCXy3 I2YCM4/PqxtD9H091e9EupwJuvO92L0DW7XKKf0ZrVB93ko+jsFW4+V85RkRPD+ktCTD T0rw== MIME-Version: 1.0 X-Received: by 10.50.98.9 with SMTP id ee9mr8600029igb.7.1378041147273; Sun, 01 Sep 2013 06:12:27 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.64.11.7 with HTTP; Sun, 1 Sep 2013 06:12:27 -0700 (PDT) In-Reply-To: <001701cea5e7$e872d030$b9587090$@org> References: <521E64B6.30703@marc-bennewitz.de> <521F37E5.5040203@gmail.com> <5220F973.5000000@marc-bennewitz.de> <001701cea5e7$e872d030$b9587090$@org> Date: Sun, 1 Sep 2013 14:12:27 +0100 X-Google-Sender-Auth: L3i2b8mMCIKV4K8tOSBx4ze_zf0 Message-ID: To: "Bryan C. Geraghty" Cc: Marc Bennewitz , PHP internals list Content-Type: multipart/alternative; boundary=047d7b2e15c511bbbb04e552355d Subject: Re: [PHP-DEV] More powerful (and backward compatible) API of random number generator functions From: bukka@php.net (Jakub Zelenka) --047d7b2e15c511bbbb04e552355d Content-Type: text/plain; charset=ISO-8859-1 Hi, I ask this because the OpenSSL option here is the only CSPRNG; The others > are trivially breakable and should not be used for cryptographic > applications. I could see an argument for wanting to use them in > non-security contexts but I'm wondering if the API should make it clear > when that is being done. > if you mean openssl_random_pseudo_bytes, then it's not CSPRNG because it calls RAND_pseudo_bytes. You would have to use RAND_bytes to have CSPRNG but then you would have to seeded before calling. See http://www.openssl.org/docs/crypto/RAND_bytes.html and OpenSSL sources for more details. I don't think that using OpenSSL here is a good idea. There should be a better framework or new functions for dealing with OpenSSL Rand but that's a bit off topic... The whole proposal is a bit confusing for me. The combination of PRNG algorithm (MT) with libraries (libc, OpenSSL, GMP) that implements one or more PRNG algorithms just doesn't make sense to me. It doesn't say anything about the speed and crypto strength of the algorithms. I think that much better solution would be an extension that implements a couple of algorithms. Then you could select what algorithm you want to use. The good idea would be to have some reasonable default algorithm that would be used if the user doesn't know anything about algorithms. This could be implemented as an extension and if it's good enough then it could be proposed as the core addition. Jakub --047d7b2e15c511bbbb04e552355d--