Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp749807yba; Sun, 31 Mar 2019 11:43:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqw80f5IFSM5tZhD4ZgETU1Z6gVOL7x9R9IKjRcu5aXFlFL6ojzlnqz9qW5veESF30KO2xps X-Received: by 2002:a17:902:9688:: with SMTP id n8mr60762467plp.133.1554057822394; Sun, 31 Mar 2019 11:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554057822; cv=none; d=google.com; s=arc-20160816; b=XxQTK6ftOGOPUyQVNdiDOitEv8/8y15QcyWN4ABQs5LJakPDPx1UaPn36P1kmV4taO UOB7Hi98963Kr62b0mF0B79cmrx7VrY80PQ6qapssH1BB3Qrd4HeRM9Es6HKqA/tbh3S PkDz6tL6n46hILQ3x+/tudKD9yVhKmGRXN2s3jgspxigWQFUwdHmO4tB0ER1ZbnExoy9 AkbhKw9GOCElzitg/kpFn98YcQoV+45TGHNgasQsA6BmGWIxThnM4e943uXkLbQ/FHIm 2V8Bx6fXwr+sOQcM2Ht6CVGDKjYY0nqum8F54u3tAP3EL6QpDdX8EfQNATJF+UgG7sRn HMfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XxhlY0zxCmNRRgdpunApfGyP4PjIJXjT9ehS4hV1fIk=; b=y7tace5PGm6o1HUc6FSHq6Jr9ffxCCAmQ4wyQZ4D17v8q4JZ8NB9HLA14s5okFSGVr 7XhEk7DMXcT4xC5B9j/454gYJm82HlVafRjQS/cQGT7U2rFgZDnnv77SznBvroFEnA+D yOQ7BMZ09vzlDxXmZX5vJAiJaUClVNFNmtsS1pmb19eSNFb6jbwT+Y28ZPC6QJwDpiNm FFeDj5V+AMqIaQ5+qF8VmzEFwagHFQnEP3RftCuI1QhZv4+WrmnUc4rG9+NRcyLH9ZAY mDLRsjos3pcwZDFTUiDC9rIdY7AGzKvtxvEhnijxQ7MeLnsqG3PqYUJLUget57ZxBeeM 87Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PE6DPbJO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si7256569pgb.412.2019.03.31.11.43.26; Sun, 31 Mar 2019 11:43:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PE6DPbJO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731391AbfCaSmt (ORCPT + 99 others); Sun, 31 Mar 2019 14:42:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:47124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727459AbfCaSms (ORCPT ); Sun, 31 Mar 2019 14:42:48 -0400 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C4A620882; Sun, 31 Mar 2019 18:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554057767; bh=rjjtmntnms3fEb/NXZwocY6kJ1asFY7ljJalC3VpySE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PE6DPbJOoyxXsqeIG6IPLu1qBSMnl9gg8SERBHu22q0rTAKajhxfs9KT6XC4FQWsq D65uRyo8z4vrrXB4QmfHdTlaao6tPUGA3mI9hPJ8KRV5UH2JkQcvpBEYBBDAMI1T36 l553dAhXs3jb4SBF0vsomMxsjKzuocWBpLHUXlco= Date: Sun, 31 Mar 2019 11:42:45 -0700 From: Eric Biggers To: "Jason A. Donenfeld" Cc: Herbert Xu , Linux Crypto Mailing List , LKML , Netdev , Linus Torvalds , David Miller , Greg Kroah-Hartman , Ard Biesheuvel , Samuel Neves Subject: Re: [PATCH net-next v9 00/19] WireGuard: Secure Network Tunnel Message-ID: <20190331184244.GA723@sol.localdomain> References: <20190322071122.6677-1-Jason@zx2c4.com> <20190325115156.wj4verbfdd2rspo5@gondor.apana.org.au> <20190330055307.GA8001@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 31, 2019 at 08:18:13PM +0200, Jason A. Donenfeld wrote: > On Sat, Mar 30, 2019 at 6:53 AM Eric Biggers wrote: > > poly1305-simd is among the failing algorithms because it loses carry bits when > > handling long "all 0xff bytes" inputs. poly1305-avx2-x86_64.S is definitely > > broken, and poly1305-sse2-x86_64.S *might* be too. I am working on a patch... > > Yea.... yikes. I'm kind of souring on this plan of having to deal with > that code in Zinc, versus the extensively studied, fuzzed, and > scrutinized code from Andy. Subtle carry bugs like that are kind of a > testament to my overall plan of preferring formally verified or > heavily used implementations to bespoke ones. This stuff is hard to > get right. > > Jason I agree that Andy's Poly1305 code is better and we should probably switch to it, but to be fair it's also longer and more complex, and I think you overestimate the extent to which it's actually been "studied, fuzzed, and scrutinized". Andy previously made essentially the same mistake in three of his Poly1305 implementations as well, which he had to fix: https://mta.openssl.org/pipermail/openssl-commits/2016-April/006639.html Also OpenSSL's PowerPC implementation of AES-CTR that was incorporated into the kernel was incorrect, as was recently fixed by commit dcf7b48212c0fab7df69e84fab22d6cb7c8c0fb9 Author: Daniel Axtens Date: Fri Mar 15 13:09:01 2019 +1100 crypto: vmx - fix copy-paste error in CTR mode The original assembly imported from OpenSSL has two copy-paste errors in handling CTR mode. When dealing with a 2 or 3 block tail, the code branches to the CBC decryption exit path, rather than to the CTR exit path. and by https://github.com/openssl/openssl/pull/8510. This took almost 5 years. I also still think the extent that you keep emphasizing the phrase "formally verified" when discussing Zinc is somewhat misleading, because the only implementation that is actually formally verified is Curve25519 in C. No other algorithms or implementations are formally verified. E.g. none of the Poly1305 implementations under discussion are formally verified. That needs to be made very clear, and as one consequence of that we really need good tests. - Eric