Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2806665imm; Fri, 20 Jul 2018 05:24:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcSN7r58skLTgFCuGb7RyzLOdV/Jg937LNAEYaZrP1A3hCQt+idGPefGkCDcE9bYxWg0wL3 X-Received: by 2002:a63:ef10:: with SMTP id u16-v6mr1913796pgh.269.1532089445010; Fri, 20 Jul 2018 05:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532089444; cv=none; d=google.com; s=arc-20160816; b=sJ8HKXAaPQsb4RAP9kBI3t4sSk31c09iBAYFZBfYhjCR9xz/Z/ZJbQ05Vp1vbQ5CY7 3ZixgOYbSRRaHPoXVytcVKvYTEW1p0SKh9VUtLN3/kVC6PGJvRXidsfCdTgPy0izTmsc Cli/2i7V9wZEpX+jjHL0HHooMxrQkYTylSgW2bUaEE2AD2zmamwrP9D7h0093rLbEKFO aJ836pVFUQ9/y+cDlKCP9nhhUH4eSn8WQrpeAYzJ0YhyXQ390WyndDL3hdWSs/ZlQ/hr Ij1boBxPqpQvI7AS/t0GbqdKkC54VAHFC6wI+9TCIkdL0ww/HPVoh5w4SFsUN+xZifQj zZLw== 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 :arc-authentication-results; bh=n8mrHQPBY5Gw6SwHS5W9CQR1blsNuEO7RNcy69tdUHs=; b=aGFXJKMa4Z/YB66nKK+BPgdiDxswfcvGSvGSDKbd1HH5INQA5/FNp9hxI+zrdLgNT5 lbEDZOp6Ajtdv+d+cDh0jfd+qKzMfxLZzN55g2Bj6hN0KX4abtR0JvyHCGRtE+nl8/Fm 1PNhFVcX8iXdpA77hjokMs6UniKpp0NnzjVfwGfAG7Mpkpnd8/Wxz8rDeSoy9AhMDnI2 XDK7z0DOjCr48Zxe4+R0S3szlQloKXKLbHXafsf8O20lr+04VDOLJjbAdQhWCWbfK0CW A1+wPTh8nFNNH6/40qU/De61n8AsNahk4a8g99G9enaLIsVmnYVzvrw/0l0P+7AEO7Fm jhfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGixs3qL; 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 s199-v6si1888071pfs.255.2018.07.20.05.23.50; Fri, 20 Jul 2018 05:24:04 -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=PGixs3qL; 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 S1730825AbeGTNLP (ORCPT + 99 others); Fri, 20 Jul 2018 09:11:15 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:40195 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729816AbeGTNLP (ORCPT ); Fri, 20 Jul 2018 09:11:15 -0400 Received: by mail-it0-f66.google.com with SMTP id 188-v6so14277495ita.5 for ; Fri, 20 Jul 2018 05:23:16 -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=n8mrHQPBY5Gw6SwHS5W9CQR1blsNuEO7RNcy69tdUHs=; b=PGixs3qLiT5xID0DlRnsQUV+uwnls3vBeKwNMwG9tlyw2YnYU9APHwIoqFOCIyIUtT collODsQzTtKEAX9G5hNEvbIL3U5FlUUt37gjuhnnxeJeBi1bB4X70FfkOIeQg0yK2aF J4m/1RiKPtUB0oeANT+83Q3VI8qwoqffWngk8= 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=n8mrHQPBY5Gw6SwHS5W9CQR1blsNuEO7RNcy69tdUHs=; b=ad977UoT3+PBke3GtLDkPGnNVrszVOxepRWBaYM41I7mQfq8j2U1GHiAEJWaOSOPYd BdgycCzVc0+PRD2XTovA7ZdD8K3g6xH1IS6D2OEulayrRiB2Oeh64EfFol1A5nmYPaWP U3gjBf2GSFYQ8IqAsGW/Vj6GdJ/pxJPH8P8K0zVSjZ4QiA20lYzCvLt6XY/tuQ3gfKn1 k3wP2gqtFuEeLNtpI0KCxR3HxaVSO1RBn+6r9egT23pyUbSJNkVKtb+ypModMWfPD4WV S2hN+hTJJ6J1jPiyS8em0hPwW2dcKt2fkbbPJSVBHLuqtS4ZFfGzWeiQCm/azAdIRDBn oC1A== X-Gm-Message-State: AOUpUlFAb2fcKQVyRcCF8PRxeRV/TOmFGFwIvQO2qPAly6bgyj3dIbaN GVpHGSOTbxAUaclekT6MU5VgZG5ByU/Uvf1qF99tFg== X-Received: by 2002:a02:35a:: with SMTP id y87-v6mr1588357jad.2.1532089395757; Fri, 20 Jul 2018 05:23:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ac05:0:0:0:0:0 with HTTP; Fri, 20 Jul 2018 05:23:15 -0700 (PDT) In-Reply-To: <20180720114509.GA10784@sirena.org.uk> References: <1531899055-29362-1-git-send-email-wangxiongfeng2@huawei.com> <5d0bb72c-862e-63be-3cc5-83ed02b9a575@huawei.com> <20180719155026.GF27938@sirena.org.uk> <20180720114509.GA10784@sirena.org.uk> From: Ard Biesheuvel Date: Fri, 20 Jul 2018 21:23:15 +0900 Message-ID: Subject: Re: [PATCH 0/5] crypto: add IV generation templates To: Mark Brown Cc: Xiongfeng Wang , Arnd Bergmann , Alasdair Kergon , Mike Snitzer , Herbert Xu , dm-devel@redhat.com, Linux Kernel Mailing List , Jonathan Cameron 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 20 July 2018 at 20:45, Mark Brown wrote: > On Fri, Jul 20, 2018 at 10:02:21AM +0900, Ard Biesheuvel wrote: >> On 20 July 2018 at 00:50, Mark Brown wrote: > >> > Existing hardware can definitely do the IV generation and I believe that >> > it can chain multiple sectors together though I'd need to confirm this, >> > as mentioned elsewhere in the thread the ccree driver is for one of >> > the relevant devices. I've poked some relevant people. > >> As far as I can infer from the ccree driver source, IV generation and >> en/decryption are separate operations, and given that each sector >> requires both operations to be applied in sequence, letting the crypto >> layer handle an entire bio does not have any benefit *at the moment*. > > Interesting... they were reporting some benefits from that with their > out of tree driver prior to upstreaming (and there are other > implementations out there, that's the only one I definitely know about). > I have to confess I didn't look at their in tree driver, looking briefly > now it looks awfully like the hardware should be able to chain IV > generation together with encryption without bothering the CPU which > would be good enough. > Indeed interesting. But afaict, that would still mean that the IV generation transform and the payload transform would be expressed as a single crypto algorithm, e.g., 'dm(essiv-foo(aes),gcm(aes)), or the DM layer would still need to be involved in sequencing one operation after the other, and I don't think any of that support is in the current series. But I'm just a drive by reviewer here, so please correct me if I am wrong. >> In fact, it seems to me that the ability to use protected AES keys is >> much more appealing than any performance argument (including 'it may >> be slower but at least it does not load the CPU'), so some background >> on how such a change would enable this use case would be beneficial as >> well to getting this adopted. > > Right, that's another benefit which was on the radar for followup work. > >> So my recommendation would be to focus on moving the IV generation >> into the crypto layer, but conservatively, and not confuse people by >> making additional changes that could theoretically improve >> performance, but only on hardware that does not exist. > > It certainly seems like splitting things up will at least allow things > to progress. Indeed.