Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98252 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75886 invoked from network); 7 Feb 2017 20:22:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2017 20:22:20 -0000 Authentication-Results: pb1.pair.com header.from=scott@paragonie.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=scott@paragonie.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain paragonie.com designates 74.125.82.178 as permitted sender) X-PHP-List-Original-Sender: scott@paragonie.com X-Host-Fingerprint: 74.125.82.178 mail-ot0-f178.google.com Received: from [74.125.82.178] ([74.125.82.178:34265] helo=mail-ot0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/4D-03389-A7C2A985 for ; Tue, 07 Feb 2017 15:22:19 -0500 Received: by mail-ot0-f178.google.com with SMTP id f9so95268519otd.1 for ; Tue, 07 Feb 2017 12:22:18 -0800 (PST) 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:from:date:message-id:subject:to :cc; bh=DdAZjxzEUMSKSiqUzWM0C9Z5RlhxifEDTZlnUx6IxUc=; b=yUCWhPxo1WwLDfqrHT10hbIlfKZWNfv9UfdOt2EcZ1ul9Km10hJYLn7NjMb5YyFPBN kZhO5k5s/Bvp32Y3+MnFrPBR61Vtq4tSF5dzHdPfKKH+3uuBt+FXAAkCyKZMcqj+EJtD J3B93XZmYB2oWXmVU0p3SZInWDJ6V8B3BPPE0ZwHRxKxvmo27nlZ9On8AlkhVgiEL+CV kmITcqbLJqHn/KC0KaUuH0ZpXOKhtBQra8ChzIMsEv6bWjhh2+wQ8a4wf/3Q8LXRzoFe n0hkwhKpIbukkf2r1D5yY6SyEh2ulTg8VH4WcnfDsU/fGOKM2sJvinPpkEyxVz1NhmmQ l0Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DdAZjxzEUMSKSiqUzWM0C9Z5RlhxifEDTZlnUx6IxUc=; b=Vx+iPc52+K4XBn4cwcUsvmPKwlnUFBBjtdgsDLtRkzTPd1XpW7HkEY5JfNnf0twL9Y 747wAkxbWYHpoMmHMqwf7visEEhhQma27Vt+4H3JqqGg6bF7EI26BiCBH1f8BSeXsYqp Xp5P1n5bjs6KsGkSFShz0LR8npNyU1eZ+16HddAyyDvDMFA+KfUl1w/e51JvyMd1Vwd4 cp9ItMNwc1fFv8Y88A/BtGQByIO/FldoVQyp+tDuqouLSF8eSk8fp6XNWg3oJ+NU95NQ lMdbVNT+excuSVBvj/wKLbxb6jA25NCGO0MXILTJpkhItb4d7yZjD5j3PO5Kxo1tTByw 23IQ== X-Gm-Message-State: AIkVDXK5+b2P74ayhjzNLrnpbsWJWoChGeE+7+WnHzAFrdue9IF+4iU6vXucUSRWhhCFKVdbtZ5FeG/WWlsF0w== X-Received: by 10.157.60.203 with SMTP id t11mr9964423otf.235.1486498935741; Tue, 07 Feb 2017 12:22:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.56.141 with HTTP; Tue, 7 Feb 2017 12:22:15 -0800 (PST) In-Reply-To: References: Date: Tue, 7 Feb 2017 15:22:15 -0500 Message-ID: To: Yasuo Ohgaki Cc: "internals@lists.php.net" , Andrey Andreev , Nikita Popov Content-Type: multipart/alternative; boundary=94eb2c1922160633080547f68153 Subject: Re: [PHP-DEV] hash_hkdf() signature From: scott@paragonie.com (Scott Arciszewski) --94eb2c1922160633080547f68153 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 7, 2017 at 2:35 PM, Yasuo Ohgaki wrote: > Hi Nikita, Andrey and all, =E2=80=8B=E2=80=8B > Regards, > > P.S. I'll be more careful, but I become very sloppy mail reader sometimes= . > I appreciate if you could let know via private email. Thank you! > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > =E2=80=8BHi,=E2=80=8B Although there are HKDF usage without salt, many HKDF applications with PHP > require or are better with salt. e.g. Previous per-session encryption. > Developers > will develop better application if they consider how salt could be used. > Therefore, > salt is better to be required parameter and omit it only when salt cannot be used.=E2=80=8B > > =E2=80=8B---=E2=80=8B One such real-world use case: Defuse v1 used HKDF without a salt. https://github.com/defuse/php-encryption/blob/b87737b2eec06b13f025cabea8473= 38fa203d1b4/Crypto.php#L157-L170 https://github.com/defuse/php-encryption/blob/b87737b2eec06b13f025cabea8473= 38fa203d1b4/Crypto.php#L358 In version 2, we included a 32-byte random salt for each encryption, which was stored next to the AES-256-CTR nonce in the ciphertext. (Both the nonce and HKDF-salt, as well as the version information header, are covered by the HMAC of the ciphertext.) The end result: Instead of having to worry about birthday collisions after you've seen 2^64 AES outputs (because 128-bit randomly generated nonce), now you need 2^192 before you have a useful collision. Although the RFC itself says that salts are optional, the argument to make them required in PHP's implementation has merit. The only downside is: If you're integrating with an implementation that doesn't require salts, and the application doesn't use salts, you're out of luck. Is that enough of a downside to dismiss an argument for better security? Maybe. Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises =E2=80=8B --94eb2c1922160633080547f68153--