Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5564197imm; Tue, 18 Sep 2018 11:31:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZIhVL0jGKK/pRjeATANXiWmtOh5ahCwORoJP5mvljczvrINf9jSsR/x0+nqPqk93ijqFYV X-Received: by 2002:a17:902:1001:: with SMTP id b1-v6mr30799240pla.155.1537295518289; Tue, 18 Sep 2018 11:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537295518; cv=none; d=google.com; s=arc-20160816; b=sJgWtCu776USD13t2BhmwBTYV2ncLGuexcu15Ua1JXXj8E1MJBCzhIENBAkYEwhB6r ArmE0YW0UE5TmmAHDNT8H26EANRkwV0Hw9zfST3jGMOHFk6UbIZNuGE7EcwnMDO5bIwe ZtENhUfi06EkWbgkkZE05bUVTOWbyxST9jfGHGiD+dWFZbwGdH9ZCtKEhTnDGqdQZuss jeWg37eNG5ro77TqlGsQ6SV+FFUVmGbhLnqfved1sSb5HQpdhmgi+bRsAaN/LWNGmfbe VtMdMcamZbO5guUvJoDOTwRGlKzIwHgMoN8zjetkGG3cLH8wkXtbFKnQmJ8Ts0WLvu5I VL+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=u66qutQ6tD80qdjjbHVikkBezrMRhJw3DiD9PLTFHg0=; b=M5w2LJ3dcV0rjNA3prjanmahSuj41Tjl4aXADa5CBYwEkCmr4eYDohGrastHZ0L4Rv xBDuvTYSCGDj3fg0lZZq7sJfJifGfTiDvOd2PZxyVA2JlvK8QDi6LpzHrbiQnvQp/r9R GCutJBFyKYauE9iBx866mgywC2cMk8mdrEg0m64XDj9BLZzqwbbMz4whtjrxQcimTkWa 428PVRcqvfndx+zYIBmm+BkCfJQ6GRp88I3V1B1xW/B6Mj4NTKDyoKBPRadnZgX/QFgR uz6FHyEftWflzLJ8bjSw3uQi669oAbAznl/C9kyNEHum5lyOU5ZgTvhk3V3cmdBUQGfm vnBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B5KnYulF; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70-v6si17534180pgd.296.2018.09.18.11.31.41; Tue, 18 Sep 2018 11:31:58 -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=@linaro.org header.s=google header.b=B5KnYulF; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730252AbeISACm (ORCPT + 99 others); Tue, 18 Sep 2018 20:02:42 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:53515 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730206AbeISACm (ORCPT ); Tue, 18 Sep 2018 20:02:42 -0400 Received: by mail-it0-f68.google.com with SMTP id p79-v6so4686152itp.3 for ; Tue, 18 Sep 2018 11:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=u66qutQ6tD80qdjjbHVikkBezrMRhJw3DiD9PLTFHg0=; b=B5KnYulFxGkJFqUCw1Ga+8gMXUzM2BjEUDVabSPKcFw0C4v2QcFKgHNbAZ6wBKgRBT m+vx0c9Ecwhv/7XknqLJj3en+SJZ2ofVHBZdDpuOPcdpaCnkuZX0LSLCvqC4iV3GGQYv xbl9Iut7bc0zNYvuyv3YccoAHXz7cOgevmeLg= 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=u66qutQ6tD80qdjjbHVikkBezrMRhJw3DiD9PLTFHg0=; b=IU2UhQ7vmer4Uw84e60MV+b8P+04mFSdlJ4LmodCnv34ZlvPKpsh1BrDEc8X4Oxz6b DAQy+1gWt/zuUG8S5gNqYNB1zc0K/5kBjFHmzHtr/kqcx6uzKMDIb64h9THEmfSFiAqF nq70gfgGzRMR8E3/gel2l2yTvc8yDZfKW4g83Jn7B+TIfHdMtSoRH5t8No8ZlVF0u+oD VsKbYNAvGcZf2toHS+YtbHtnTvG5Q7NIKZn1EyC14qIv2i0tuorT0M471HRiswF83jIf O/nvLU7ZqAJQXUH2oDrb7cuxw76cLIseO9fHjPjMGRzaui8a9teV3fn9b5NBrUZOXtHq 0ydA== X-Gm-Message-State: APzg51Do5E4trcK5SvsCC5mE5hYY1aItxedJ2/MiXjPXQ/74VFUdHiGy RTUxnV64UVSwPkCcOjDEwzZmL0BhbPDF7CCZa9QWqA== X-Received: by 2002:a24:57cb:: with SMTP id u194-v6mr17810280ita.148.1537295331276; Tue, 18 Sep 2018 11:28:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:2848:0:0:0:0:0 with HTTP; Tue, 18 Sep 2018 11:28:50 -0700 (PDT) In-Reply-To: <20180918161646.19105-1-Jason@zx2c4.com> References: <20180918161646.19105-1-Jason@zx2c4.com> From: Ard Biesheuvel Date: Tue, 18 Sep 2018 11:28:50 -0700 Message-ID: Subject: Re: [PATCH net-next v5 00/20] WireGuard: Secure Network Tunnel To: "Jason A. Donenfeld" Cc: Linux Kernel Mailing List , "" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "David S. Miller" , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18 September 2018 at 09:16, Jason A. Donenfeld wrote: > v5 has the most comprehensive set of changes yet, and I think should > finally address all of the relevant issues brought up on the mailing > list. In particular, this feedback has come from: > > - Andy Lutomirski > - Eric Biggers > - Ard Biesheuvel > - Kevin Easton > - Andrew Lunn > - Martin Willi > > Changes v4->v5: > --------------- > - Use fewer inlines, except when measured as necessary. > - Reduce size of scattergather array to fit within stack on > small systems. > - Account for larger stack frames with KASAN. > - The x86_64 implementations are selected according to input length. > - Avoid using simd for small blocks on x86_64. > - The simd_get/put API is now pass by reference, so that the user > can lazily use the context based on whether or not it's needed. > See the description again in the first commit for this. > - Add cycle counts for different sizes for x86_64 commit messages. > - Relax simd during chapoly sg loop. > - Replace -include with #if defined(...) > - Saner and simpler Kconfig. > - Split into separate modules instead of one monolithic zinc. > - The combination of these three last items means that there no > longer are any conditionals in our Makefile. > - Martin showed a performance regression using tcrypt in v4. This > has been triaged and fixed, and now the Zinc code runs faster > than the previous code. > - While I initially wasn't going to do this for the initial > patchset, it was just so simple to do: now there's a nosimd > module parameter that can be used to disable simd instructions > for debugging and testing, or on weird systems. > I was going to respond in the other thread but it is probably better to move the discussion here. My concern about the monolithic nature of each algo module is not only about SIMD, and it has nothing to do with weird systems. It has to do with micro-architectural differences which are more common on ARM than on other architectures *, I suppose. But generalizing from that, it has to do with policy which is currently owned by userland and not by the kernel. This will also be important for choosing between the time variant but less safe table based scalar AES and the much slower time invariant version (which is substantially slower, especially on decryption) once we move AES into this library. So a command line option for the kernel is not the solution here. If we can't have separate modules, could we at least have per-module options that put the policy decisions back into userland? * as an example, the SHA256 NEON code I collaborated on with Andy Polyakov 2 years ago is significantly faster on some cores and not on others > ----------------------------------------------------------- > > This patchset is available on git.kernel.org in this branch, where it may be > pulled directly for inclusion into net-next: > > * https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux.git/log/?h=jd/wireguard > > ----------------------------------------------------------- > > WireGuard is a secure network tunnel written especially for Linux, which > has faced around three years of serious development, deployment, and > scrutiny. It delivers excellent performance and is extremely easy to > use and configure. It has been designed with the primary goal of being > both easy to audit by virtue of being small and highly secure from a > cryptography and systems security perspective. WireGuard is used by some > massive companies pushing enormous amounts of traffic, and likely > already today you've consumed bytes that at some point transited through > a WireGuard tunnel. Even as an out-of-tree module, WireGuard has been > integrated into various userspace tools, Linux distributions, mobile > phones, and data centers. There are ports in several languages to > several operating systems, and even commercial hardware and services > sold integrating WireGuard. It is time, therefore, for WireGuard to be > properly integrated into Linux. > > Ample information, including documentation, installation instructions, > and project details, is available at: > > * https://www.wireguard.com/ > * https://www.wireguard.com/papers/wireguard.pdf > > As it is currently an out-of-tree module, it lives in its own git repo > and has its own mailing list, and every commit for the module is tested > against every stable kernel since 3.10 on a variety of architectures > using an extensive test suite: > > * https://git.zx2c4.com/WireGuard > https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/WireGuard.git/ > * https://lists.zx2c4.com/mailman/listinfo/wireguard > * https://www.wireguard.com/build-status/ > > The project has been broadly discussed at conferences, and was presented > to the Netdev developers in Seoul last November, where a paper was > released detailing some interesting aspects of the project. Dave asked > me after the talk if I would consider sending in a v1 "sooner rather > than later", hence this patchset. A decision is still waiting from the > Linux Plumbers Conference, but an update on these topics may be presented > in Vancouver in a few months. Prior presentations: > > * https://www.wireguard.com/presentations/ > * https://www.wireguard.com/papers/wireguard-netdev22.pdf > > The cryptography in the protocol itself has been formally verified by > several independent academic teams with positive results, and I know of > two additional efforts on their way to further corroborate those > findings. The version 1 protocol is "complete", and so the purpose of > this review is to assess the implementation of the protocol. However, it > still may be of interest to know that the thing you're reviewing uses a > protocol with various nice security properties: > > * https://www.wireguard.com/formal-verification/ > > This patchset is divided into four segments. The first introduces a very > simple helper for working with the FPU state for the purposes of amortizing > SIMD operations. The second segment is a small collection of cryptographic > primitives, split up into several commits by primitive and by hardware. The > third shows usage of Zinc within the existing crypto API and as a replacement > to the existing crypto API. The last is WireGuard itself, presented as an > unintrusive and self-contained virtual network driver. > > It is intended that this entire patch series enter the kernel through > DaveM's net-next tree. Subsequently, WireGuard patches will go through > DaveM's net-next tree, while Zinc patches will go through Greg KH's tree. > > Enjoy, > Jason