Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp304234imm; Wed, 12 Sep 2018 23:40:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZSMmZ0ik9fmLanB+ediVzVdyQ2f5F43VS6XVjB7s5MY5ASyOzeRKrW8vtKcVAly0Xni8J7 X-Received: by 2002:a65:6654:: with SMTP id z20-v6mr5644305pgv.186.1536820829995; Wed, 12 Sep 2018 23:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536820829; cv=none; d=google.com; s=arc-20160816; b=b1tGJ7ckxbsZi3u/FKsjYeDlfjnh4lfMUftqyGu25phTNthUEa6T0Z7S7SHudIcWpS QwD63VYds9ADp+klMYicR/T3T0JssqIgauMrDiC5dhjezHFW3yi/vZQRjw3eH6WTjMYz bdlJISWYCYRmXNnF8gwQMo/FPuMuS+BqvU1/2td45Iq882VEQMX1iw2E9AYjumsFg53m ZOyz1+6FrFeYNP+CJmX8IQ0qTdFNBWiTvyEB5J1kPebssrqIpT1De5AM/y7cudOoLPXP ARqMRqQgB+Enr65Kzj2xZhoSRD6xPTn7G5mTz16eom2t3ZWFS6USr4Cj7QPMJ93NcQHm W4mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=FOwpzXDx+6vLnMI1/h5r9swnGVpnPIU6gUBRO54kikA=; b=y2o/XRLVJz/coNYF0u/ROL7dsH2KsKtzoNScb/5OdzTaiV+H5+8flw6p3UtK+49kyu 64o4+JyQ/KBlmCIMch/3IDRdWmxhV3CrBVrD+32OQGLUHGuaUL7vUrqtTw4QyBl9nH9U E4BuHF7hWbvpRYC0DChY3gh3blezQoBH58msiypgm+yT7zgjg0Z97/KhnYYPCpBl6g/3 uVVTeBPFvjdQk19lnhYq7wuVfouua/QqE/hCsPiYPgmnIWtTQdlM8wJuYiku8eEiVj8C Hys9y8sfhaEkcUc14AWzyjEa8oKLviexPPhuCfZ6S+z5tJCdnVn6cQ5LTFDZQJgozVf9 97Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MrARDw6e; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z7-v6si3300054pgj.466.2018.09.12.23.40.15; Wed, 12 Sep 2018 23:40:29 -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=@gmail.com header.s=20161025 header.b=MrARDw6e; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbeIMLsE (ORCPT + 99 others); Thu, 13 Sep 2018 07:48:04 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39804 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbeIMLsD (ORCPT ); Thu, 13 Sep 2018 07:48:03 -0400 Received: by mail-wm0-f67.google.com with SMTP id q8-v6so4857527wmq.4; Wed, 12 Sep 2018 23:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FOwpzXDx+6vLnMI1/h5r9swnGVpnPIU6gUBRO54kikA=; b=MrARDw6eKB58FJDp3EXvpI6k+2KD/KTTwvtDetwvltBhHTrtpJpkT797a96RbC6B6/ U8LMAUc93TQ27pBBJ9kIWafI2OYs0oD72rBl87bBrg1Nksjw3TU5DAkj4y8JmdRAXmXO R6GjDFuu21/GFpTc7OjW7qCy9+80lHm1s7YhFBSSPmBWrRBPKsKQo5F654RxIXzI6L77 Tp/SFI6d2AHu0TNkecqsDaoXwCF4g7l/nwzeuJyWcNCiHmYFcKePVijFjk71bpLG3Tud 2vrf+a35HTbIyyFvJ0gOkMYrKXR2e7a6UZl5rmJ+Im8RRO6dD5Wg4s6ec3Y52+UuMMqz ovlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=FOwpzXDx+6vLnMI1/h5r9swnGVpnPIU6gUBRO54kikA=; b=HznA50bVCPdXDX20yazugiM3L2xkNb1uI0WB+RwmzshwaW8QAGnybwFd3EXYytoR39 H2GBVCv4vVXV0LzKvRthSwbbLoA4TSDFd3KfZtwFSoM+UntqpEmjsOUeMi1buLmo7VHV 7VZY1g0sOSQ9mRr7QAurZKRAANB42EvNtKA6pVU4eoo4G005a71+hJx4n5Tprf6S5RHG otBWUn6lFDJpUy4W5g/Gl0fpwR0czakYTGK61PMzlPfMun1TzyBuyYNbyoRFhT68llS3 k050bCaUnsMOQq9lL+v6yZ0pdGy9znJ77VvXaZorxmtgJKNq0yFScsCvj93jyjLov1wd toug== X-Gm-Message-State: APzg51ADshSSJS/L2H6q5Dnl0o1dJnB1FLI2f10y8V2ri2+Ydyk4dIFI VttyOeeiwj838GxZL7wUHIyBjH6662Y= X-Received: by 2002:a1c:5f82:: with SMTP id t124-v6mr4238256wmb.14.1536820796383; Wed, 12 Sep 2018 23:39:56 -0700 (PDT) Received: from [172.22.36.62] (redhat-nat.vtp.fi.muni.cz. [78.128.215.6]) by smtp.gmail.com with ESMTPSA id 1-v6sm4848751wmf.47.2018.09.12.23.39.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 23:39:55 -0700 (PDT) Subject: Re: [PATCH net-next v3 02/17] zinc: introduce minimal cryptography library To: Andy Lutomirski , Ard Biesheuvel Cc: "Jason A. Donenfeld" , LKML , Netdev , David Miller , Greg Kroah-Hartman , Samuel Neves , Jean-Philippe Aumasson , Linux Crypto Mailing List References: <20180911010838.8818-1-Jason@zx2c4.com> <20180911010838.8818-3-Jason@zx2c4.com> From: Milan Broz Openpgp: preference=signencrypt Autocrypt: addr=gmazyland@gmail.com; prefer-encrypt=mutual; keydata= mQINBE94p38BEADZRET8y1gVxlfDk44/XwBbFjC7eM6EanyCuivUPMmPwYDo9qRey0JdOGhW hAZeutGGxsKliozmeTL25Z6wWICu2oeY+ZfbgJQYHFeQ01NVwoYy57hhytZw/6IMLFRcIaWS Hd7oNdneQg6mVJcGdA/BOX68uo3RKSHj6Q8GoQ54F/NpCotzVcP1ORpVJ5ptyG0x6OZm5Esn 61pKE979wcHsz7EzcDYl+3MS63gZm+O3D1u80bUMmBUlxyEiC5jo5ksTFheA8m/5CAPQtxzY vgezYlLLS3nkxaq2ERK5DhvMv0NktXSutfWQsOI5WLjG7UWStwAnO2W+CVZLcnZV0K6OKDaF bCj4ovg5HV0FyQZknN2O5QbxesNlNWkMOJAnnX6c/zowO7jq8GCpa3oJl3xxmwFbCZtH4z3f EVw0wAFc2JlnufR4dhaax9fhNoUJ4OSVTi9zqstxhEyywkazakEvAYwOlC5+1FKoc9UIvApA GvgcTJGTOp7MuHptHGwWvGZEaJqcsqoy7rsYPxtDQ7bJuJJblzGIUxWAl8qsUsF8M4ISxBkf fcUYiR0wh1luUhXFo2rRTKT+Ic/nJDE66Ee4Ecn9+BPlNODhlEG1vk62rhiYSnyzy5M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xs4el0j8FRaCqLvEZS4rKLNxb8EY3Z4LC61QfyAbg5P114muVZ4ro8dzhZ0zwk ZLGeEsYPsQpLo6XPT/32PP8aHn/KKX+KM7ouCEhVeWszR20BMK6sxTBR+4aNqSKCdgr42jrt vzRmJp4= Message-ID: Date: Thu, 13 Sep 2018 08:39:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/09/18 01:45, Andy Lutomirski wrote: > On Wed, Sep 12, 2018 at 3:56 PM, Ard Biesheuvel ... > 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. Please note, that dm-crypt now uses not only block ciphers and modes, but also authenticated encryption and hashes (for ESSIV and HMAC in authenticated composed modes) and RNG (for random IV). We use crypto API, including async variants (I hope correctly :) There is a long time battle to move initialization vectors generators from dm-crypt to crypto API. If there are any plans to use a new library, this issue should be discussed as well. (Some dm-crypt IV generators are disk encryption specific, some do more that just IV so porting is not straightforward etc). Related problem here is an optimization of chain of sectors encryption - if we have new crypto API, it would be nice if can take chain of sectors so possible implementation can process this chain in one batch (every sector need to be tweaked by differently generated IV - and we are back in problem above). I think filesystem encryption uses the same pattern. And btw, we use the same algorithms through AF_ALG in userspace (cryptsetup). So please, if you mention dm-crypt, note that it is very complex crypto API consumer :) And everything is dynamic, configurable through dm-crypt options. That said, I would be more than happy to help in experiments to porting dm-crypt to any other crypto library, but if it doesn't not help with problems mentioned above, I do not see any compelling reason for the new library for dm-crypt... Milan