Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp812872imm; Thu, 13 Sep 2018 08:07:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaxDgIY7pcv+8ko5amWZYyvsBx1GJtFKPjTOFZI8GjkDOpiIneiEDNw9knZsJpkhZgKRYrb X-Received: by 2002:a63:7f55:: with SMTP id p21-v6mr7581569pgn.285.1536851272788; Thu, 13 Sep 2018 08:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536851272; cv=none; d=google.com; s=arc-20160816; b=X6DgTtrMxhlYR8JF3aYsu8VOUWZ1Uqg/5losql2c5XoRFR+zCfn1MkjHvcx2jm2gYl 1PAVJDcigKl3UXZD02VkrP0uIDEn7NJuV59sPpxfg00af52n6A3N9qiebSDAeFzfysxZ DTQuRh/GDufCdKCz7c050d93SBvNnHqdmi30M6NTGRqtM+zxjoLv6jaz8p9r9ucNTpfC PVm41ZobqOHiOYkHjhW/ba19ENuZBIfkqbx6JD2AJD7N1jWi2ivgXn9/uUt7zkicJZTk lGKArArk301S3ysIeqCiv87bGjABuSUXU8cIvsbHJ4RkWLYWwLgZ7OJWJvCidvuVh9KC xaVg== 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=kvIV91aPNn5SA+AG9Ippjbb3td7Qp9sxqO5jjn7UwEQ=; b=gXoHAJZqiWmZFwG2r53haKG8U1cvaxibK3reK9qDSGES4eLqbPigIkmt96yjklBeXm NC76nzqbrLLp/upmVdvJdp4l1JvXrrX2GeiIBw7zPEYM9rOm0Jvo29xmoSwcKM1QfYwY 32xdSdl6Vq9/Nct80/WH95/3WQQvDhTWeDvuzTq1Zl4tCyBR0zQSHNXN6lg5BAI47M6e 2nL/TFaKNPb/ez/3NQd3ftqmRlQaPM+ttiJMlVHppblpCqOC6e1pr6xWFoiyAdFErur3 wvSXlF1FnCGpTapAfoceeP8dValNJ/AHfpXUPh3TKcUCPmach998uoUNtTw104S2Eln4 OuGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ph1kLtpe; 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 z15-v6si4064015pga.117.2018.09.13.08.07.33; Thu, 13 Sep 2018 08:07:52 -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=Ph1kLtpe; 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 S1728309AbeIMURF (ORCPT + 99 others); Thu, 13 Sep 2018 16:17:05 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:39752 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727865AbeIMURF (ORCPT ); Thu, 13 Sep 2018 16:17:05 -0400 Received: by mail-it0-f65.google.com with SMTP id h1-v6so8139806itj.4 for ; Thu, 13 Sep 2018 08:07:10 -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=kvIV91aPNn5SA+AG9Ippjbb3td7Qp9sxqO5jjn7UwEQ=; b=Ph1kLtpecTHq4+pHUwQRTs7YaMYxMRatrij1EO4QlYBtFBFesrcpbn3x+qOvGq3UzT XLVuktgaToihj1kdJE1ZtxC3kYlT9hTpRJOi2EITaA5Jyi6KZrJKJbzzyW9TGNrrHXMH aaWeRVcFNVseZG3rNTx7JczXa+X6blXWllpQ8= 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=kvIV91aPNn5SA+AG9Ippjbb3td7Qp9sxqO5jjn7UwEQ=; b=QNdlTSiQ8DOpx56wDS3OSZyCoa3qI7C8oL3W3iMZo8paGcbvUsQViszq0iznOacgZ+ tyerZrI9S2d78Q4wkoyt9RP9H5M2xVzT3Q070KGeIfcCaQkGsX5oRWMe5TO5WUKe9mDf f5PEIH27WH/gPFrs9sbReQR24iv5rvSNQZJ6jNj5s37CvprNvwE4i+iN4qbu85LL+pQj gpNZKpXAFwNfa797je+gfVQuHDt7y23xLdVIvflPNeqQtWU5RIrE9aBcHpbSojA9iUWc /bdpa9EKmHXjFLp8lTbRoHB8jj+6I5SwiFhRZmTrJE1ZEa3vLpcr/u40orBAIAK5OyMa 03Ng== X-Gm-Message-State: APzg51DquMSe2+DIKgku8zNzjWrKw3gLJG9HK4eljzAmN+48XWMyuUnY aNZE3Pbb3TF4Ip4QJ4SOq0oeFOM/az4OcxRC3ix5MmQ+FKaHWg== X-Received: by 2002:a02:4d1b:: with SMTP id l27-v6mr6988376jab.86.1536851229511; Thu, 13 Sep 2018 08:07:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:2848:0:0:0:0:0 with HTTP; Thu, 13 Sep 2018 08:07:08 -0700 (PDT) In-Reply-To: References: <20180911010838.8818-1-Jason@zx2c4.com> <20180911010838.8818-3-Jason@zx2c4.com> From: Ard Biesheuvel Date: Thu, 13 Sep 2018 17:07:08 +0200 Message-ID: Subject: Re: [PATCH net-next v3 02/17] zinc: introduce minimal cryptography library To: "Jason A. Donenfeld" Cc: Andrew Lutomirski , LKML , Netdev , David Miller , Greg Kroah-Hartman , Samuel Neves , Jean-Philippe Aumasson , Linux Crypto Mailing List 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 13 September 2018 at 16:18, Jason A. Donenfeld wrote: > On Thu, Sep 13, 2018 at 1:45 AM Andy Lutomirski wrote: >> I'm not convinced that there's any real need for *all* crypto >> algorithms to move into lib/zinc or to move at all. As I see it, >> there are two classes of crypto algorithms in the kernel: >> >> a) Crypto that is used by code that chooses its algorithm statically >> and wants synchronous operations. These include everything in >> drivers/char/random.c, but also a bunch of various networking things >> that are hardcoded and basically everything that uses stack buffers. >> (This means it includes all the code that I broke when I did >> VMAP_STACK. Sign.) > > Right, exactly. This is what will wind up using Zinc. I'm working on > an example usage of this for v4 of the patch submission, which you can > ogle in a preview here if you're curious: > > https://git.zx2c4.com/linux-dev/commit/?h=big_key_rewrite > > 28 insertions, 206 deletions :-D > I must say, that actually looks pretty good. >> b) Crypto that is used dynamically. This includes dm-crypt >> (aes-xts-plain64, aes-cbc-essiv, etc), all the ALG_IF interfaces, a >> lot of IPSEC stuff, possibly KCM, and probably many more. These will >> get comparatively little benefit from being converted to a zinc-like >> interface. For some of these cases, it wouldn't make any sense at all >> to convert them. Certainly the ones that do async hardware crypto >> using DMA engines will never look at all like zinc, even under the >> hood. > > Right, this is what the crypto API will continue to be used for. > > >> I think that, as a short-term goal, it makes a lot of sense to have >> implementations of the crypto that *new* kernel code (like Wireguard) >> wants to use in style (a) that live in /lib, and it obviously makes >> sense to consolidate their implementations with the crypto/ >> implementations in a timely manner. As a medium-term goal, adding >> more algorithms as needed for things that could use the simpler APIs >> (Bluetooth, perhaps) would make sense. > > Agreed 100%. With regards to "consolidate their implementations" -- > I've actually already done this after your urging yesterday, and so > that will be a part of v4. > >> But I see no reason at all that /lib should ever contain a grab-bag of >> crypto implementations just for the heck of it. They should have real >> in-kernel users IMO. And this means that there will probably always >> be some crypto implementations in crypto/ for things like aes-xts. > > Right, precisely. > > Jason