Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93676 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55978 invoked from network); 1 Jun 2016 13:53:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2016 13:53:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=scott@paragonie.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=scott@paragonie.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain paragonie.com designates 209.85.218.49 as permitted sender) X-PHP-List-Original-Sender: scott@paragonie.com X-Host-Fingerprint: 209.85.218.49 mail-oi0-f49.google.com Received: from [209.85.218.49] ([209.85.218.49:35143] helo=mail-oi0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/B5-11325-1C8EE475 for ; Wed, 01 Jun 2016 09:53:05 -0400 Received: by mail-oi0-f49.google.com with SMTP id w184so28029418oiw.2 for ; Wed, 01 Jun 2016 06:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragonie-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=gFjTQgIq+ZnvigD80xiWs/tDQGdCNJtFHZlO6xBlBq8=; b=U3rkMEidqj8BNAF5S1TO426Mssl1DcgP4ZbzHJIwWE7sMY//zJNPDW+7u6+qImQ9Kj IclTxsvvt1uU+osdxi8xtWCH1tLuqpy+26Isy76h1a6qEGpHoGguQvz+JFbR5tv8AbM+ xDfcMVFe7Lv9vOpO2NIhy133dK0IhySZhmmIe+pzbRel+fkioIgcom+FIYTZzDbQQwc/ luPHOelOQZOVyv1DQ05sfIRFZb/x4Kw4fLFvLYypGbsAMWdneNemyY4rGGh786zizMHf VdlvBhj8K9/HZErcRsIiaEmHeSP18mWbSAF8RjIb+g4ibaue4X3c7fFHwUZNLwhCiH/F AetA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=gFjTQgIq+ZnvigD80xiWs/tDQGdCNJtFHZlO6xBlBq8=; b=N5+tpuSGfq3ugoJVQaGQH5NpovgzQy6h8+zGKJ5qPq1YEf+osGtTJ7SD/UMZ3tJmwt 9vEgOJ5aJg6AVBHWngaxC+nTRarxjY7Nmc+WORSno2FVOrXIoXIeC0GAPEMLz6KVSPhQ 5hsgtqbWlrmMZ0CMso1hAT+/ojXJ8EdCQTAtJfODkQTKml2nyfb02x1XupiW3oEwl2Cq ABkoIeRImciPFYdEBqpOAwtwBVUj94+agjykA8Tf6Age/cfyAokRI/wjuBc81WZh8Stp 8QD5cpeLPH9Gf/sZX3F0z1dv3OZZYZTM75f/0ZE/yROdkWr+JZ/+CSf8sfVvto8XLSed wZLg== X-Gm-Message-State: ALyK8tIXNFBoC8EiaAkGtY2H4sUfWWTer9PvbDr2B6xgWaqSvCDJceViYo8Khd9Slgc+w5eiPy97x8b2PnRCtA== MIME-Version: 1.0 X-Received: by 10.157.14.131 with SMTP id 3mr2140483otj.83.1464789182196; Wed, 01 Jun 2016 06:53:02 -0700 (PDT) Received: by 10.157.26.106 with HTTP; Wed, 1 Jun 2016 06:53:01 -0700 (PDT) In-Reply-To: References: Date: Wed, 1 Jun 2016 09:53:01 -0400 Message-ID: To: Marco Pivetta Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11352d74e04572053437ce78 Subject: Re: [PHP-DEV] [RFC] Libsodium - Discussion From: scott@paragonie.com (Scott Arciszewski) --001a11352d74e04572053437ce78 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 1, 2016 at 9:46 AM, Marco Pivetta wrote: > On 1 June 2016 at 15:45, Scott Arciszewski wrote: > >> On Wed, Jun 1, 2016 at 6:48 AM, Marco Pivetta wrote= : >> >>> Hey Scott, >>> >>> On 1 June 2016 at 09:49, Scott Arciszewski wrote: >>> >>>> Hi PHP Internals Team, >>>> >>>> Let's begin discussing the prospect of adding libsodium as a core >>>> extension >>>> in PHP 7.1. I've updated the RFC to explain why this would be a good >>>> idea >>>> and the benefits it offers. >>>> >>>> https://wiki.php.net/rfc/libsodium >>>> >>>> If the subsequent discussion goes smoothly, I would like to open votin= g >>>> on >>>> June 15. >>>> >>>> Together, let's make PHP cryptography so safe that it becomes boring. >>>> >>> >>> First, thanks for providing better alternatives to crypto in PHP! >>> >>> I also agree with Remi on naming: let's avoid calling the extension >>> `libsodium`. >>> >>> I have some concerns that are just about code quality, not about >>> functionality. Consider that I didn't look at the underlying library (a= nd I >>> really care little about it, from a consumer perspective). >>> >>> 1. is there a particular reason why abbreviations are used? For >>> instance, why `sodium_randombytes_buf()` instead of >>> `sodium_random_bytes_buffer()`? >>> 2. from a naming perspective, I'd expect `sodium_randombytes_buf()` to >>> give me a buffer of random bytes (probably as a stream), but it returns= the >>> actual string of random bytes. Again: confusing naming >>> 3. can we avoid using "themed" naming? For example, instead of >>> `sodium_crypto_secretbox()`, it would be best to express what it actual= ly >>> does, like `sodium_encrypt_and_sign()`. While the naming may be emergin= g >>> from lower layers, I still (like I did with other RFCs) disagree with >>> inheriting confusing naming. This will just cause users to look up the >>> naming up when reading or writing code, and ultimately add up to silly >>> bugs. I can already foresee that people will use the API incorrectly ju= st >>> because of the naming. >>> 4. can't we just keep it namespaced under `Sodium`, instead of adding >>> more stuff to the root level namespace? Does anyone have a reference to= the >>> coding standards that would cause the rename? >>> >>> Cheers, >>> >>> Marco Pivetta >>> >>> http://twitter.com/Ocramius >>> >>> http://ocramius.github.com/ >>> >>> >> =E2=80=8BI'd love to just keep the namespace personally >> =E2=80=8B ( >> Ke >> =E2=80=8Beping \Sodium\foo() and \SODIUM\FOO means code I've written tod= ay will >> work in 7.1 for non-PECL users >> =E2=80=8B, and less work we thrust on Frank Denis)=E2=80=8B >> =E2=80=8B >> but it was previously expressed that doing so violates the coding >> standard. >> =E2=80=8B Changing to sodium_* would mean less bikeshedding and automati= c "No" >> votes. >> > > Weird... I guess we could add a subsection to the vote? > > >> As for the function names, that's what they were called in NaCl. >> https://nacl.cr.yp.to/secretbox.html >> >> I believe randombytes_buf() was named in a similar spirit to OpenBSD's >> arc4random_buf(). >> > > Yeh, that is software archaeology though, not software design ;-) > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > Strictly speaking, =E2=80=8B our=E2=80=8B random_bytes()=E2=80=8B =E2=80=8B is every bit good enough without \Sodium\randombytes_buf(), for t= he PHP use case. We might be able to trim some redundant features (however, unless we make all the PHP encoding functions cache-timing-safe, will insist on keeping \Sodium\bin2hex and \Sodium\hex2bin). Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises --001a11352d74e04572053437ce78--