Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72782 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48234 invoked from network); 24 Feb 2014 08:13:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2014 08:13:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.160.194 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.160.194 mail-yk0-f194.google.com Received: from [209.85.160.194] ([209.85.160.194:58822] helo=mail-yk0-f194.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/50-46513-23FFA035 for ; Mon, 24 Feb 2014 03:13:39 -0500 Received: by mail-yk0-f194.google.com with SMTP id 9so3368408ykp.1 for ; Mon, 24 Feb 2014 00:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=e4mlCnz8cDDEQtO4JeitiLwqPVXNiYcIRue4gQBXu18=; b=HtqJCknTwOrfWz/w8/Bh9+7Y8s+jEjAK9EzTs7i2CGPlGDcOTQqNivq5HLQuXrBnzY LUeUodf9hxHEbf/LrZ0FV98goJ8j+YR47B8vd27Kbe4rnia4kUoWhhUY/xXnUI7MyXqE 0yEmsQdlNYzsXISJdE3nbmroky8o9jumBMAhQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=e4mlCnz8cDDEQtO4JeitiLwqPVXNiYcIRue4gQBXu18=; b=J6SJvgEe3AGnf09C5zD8zM6FW0JUamUL4t7Gm3EPm46o/mrUuujrEACipfEQPSxpuy q9fTsAE/w2Gc1y9bPajUqHzfvq40b4aRbyV2JOzqGXfOb3bSnLfkTTzE+1cMEKd8Ko8N YvBznK8J1hy7ADWV8Pbtq2Izv87Nl+nZXjV6sAZ4Kk4algUbXLIW93DszQaEs51flQN+ B8jp/sY5Vx41h3SEoNKiNlSerdNYZMWp5jhFmbviW0RdHOYUwse+//hN12jrI0H8D4Ch F2iOKHH34rSAL93FP/hU+WK0oKHMNQScbQWlHDCPd3N0T2Uqfrurf0LvnmD5mSGElKdw XaLQ== X-Gm-Message-State: ALoCoQneioAPXGxh8oQtFhmBrK62lnDDVCjyGz5P+INPFu4k+DKJY1fTC2B2GCvts/YI+iVgABVL MIME-Version: 1.0 X-Received: by 10.236.20.129 with SMTP id p1mr24441241yhp.111.1393229615668; Mon, 24 Feb 2014 00:13:35 -0800 (PST) Received: by 10.170.188.139 with HTTP; Mon, 24 Feb 2014 00:13:35 -0800 (PST) Date: Mon, 24 Feb 2014 10:13:35 +0200 Message-ID: To: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] Timing attack safe string comparison function From: narf@devilix.net (Andrey Andreev) Hey, Rouven We=C3=83=C5=B8ling wrote: > I've updated the patch, taking the following feedback into account: > -Renamed function to hash_equals Why? There were some suggestions to rename it to something more descriptive and generic, but nobody could think of such and IMO, hash_compare() was better. :) Yasuo Ohgaki wrote: > > Rouven We=C3=83=C5=B8ling wrote: > > > I did some experiments. It seems it's good to implement timing safe > > comparison in engine. i.e. We can make =3D=3D/=3D=3D=3D secure by defau= lt like > > Python. It would be much safer get rid of all timing from PHP. > > > > > > We need new RFC to include the change in engine. > > > > > > That's not how I read that discussion (though I might have missed a mai= l). > > Also personally I don't like it. I don't see that the supposed gain in > > security is worth the performance implication. Also if it turns out the= re's > > a bug, and we'd have to make it 100 times slower for some reason, than > > that's not a big deal for a function like hash_equals. It is however if= it > > affects all comparisons. > > > > Since I don't believe in that change, I'm not interested in proposing t= hat > > RFC. > > Understood. This is OK. > > From the experiment, performance implication is not much. > Automatic protection in any place would worth the trade off. IMHO. > Python even uses less efficient hash for comparison. I heard they > use optimized version of SipHash, we may better try it before deciding > algorithm, though. > > Any other comments regarding =3D=3D/=3D=3D=3D timing safety? I also don't like it. The proposed function is just fine. Cheers, Andrey.