Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2564635ybi; Mon, 17 Jun 2019 06:59:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/iyzwVq9s8Tpt1A26drqmUXW74yEBNAUBMF7Vg3e51wNs0JMTd9k6+Mn2dlYfX3fLgEjB X-Received: by 2002:a63:d705:: with SMTP id d5mr5840945pgg.167.1560779976942; Mon, 17 Jun 2019 06:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560779976; cv=none; d=google.com; s=arc-20160816; b=cEcCchL/LriN9NYpnhx9vh4GyvacEiasKLBXmKjtKSq7wLsSzLAnVM2CCVGlUsk+Sj yR4M6B9nx3yt9eSnikGOHTF7niF3K3pJw0Ul71Rwaojt4S/2TJM4l21Ptcbq/HltD6Eh FN1d2fT0+iDc1zTwAF6QROe24006o2yJqHIxPTQgljTWzEoRJ7OGe2DmNQ/VJXeK71vI 8/YJu7Ycbtj8xf5LVtWPkFAaxjBW3rZCyejGxx3WWPfuC2LCbPuWLdDBC66ZT6mno5ar FpKqMjnXHq10XYkDK1YKFgbN+1q3ww9c7iXI0z1qR0ndNsXIG1dpMcAkC3G2q/W88w0n fiBA== 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 :in-reply-to:references:mime-version:dkim-signature; bh=Ds0uKO2F2VBQKsr2RusLC1lcJKUY+GVXGb2P0niujFc=; b=GySLx6OniAFUdXlx51OfHHl6b8s9ahG9P2XBL034mYer551UMkImlEhFOyLKQgD7TH xr3ZfhJIf3DV1zhqKOPT8+5b/lrs1AWIXVbWhZzNEiUE+kI3xeWGCGBI4/PzhtYnolKq /Zthu6vztztQwzkg0eBFo6GN1uyN/yCfZRtLJ7zj6//AbkwLGogcDD7H5f04UEdztMLj 1CEvOlhtocA34BwIXGWP/cchyGckGj1v5FAlbGMw7qv06nD4Uk7fMYByhXJxMPGYgHSC S/dNKiS2I0SZhWnwnMgEELghso57ithDJwqvXVNjYxFYLSBgjaNm9ZGjorC0BGuQgGPd 7dvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bfmCe5Zv; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 x9si5050185plo.98.2019.06.17.06.59.17; Mon, 17 Jun 2019 06:59:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=bfmCe5Zv; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S1726822AbfFQN7N (ORCPT + 99 others); Mon, 17 Jun 2019 09:59:13 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:45161 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbfFQN7N (ORCPT ); Mon, 17 Jun 2019 09:59:13 -0400 Received: by mail-io1-f65.google.com with SMTP id e3so21240494ioc.12 for ; Mon, 17 Jun 2019 06:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ds0uKO2F2VBQKsr2RusLC1lcJKUY+GVXGb2P0niujFc=; b=bfmCe5ZvpsbrhWXibP60qlo99R0zU6tV2L2MvNrbM4MncYm4LfPSlrM3ayQ5VzFPEz lZiFIdCduTD0iR4PDFOUA6MAbuVQh3ofZ9rToV3LJvfAFGteuaOCPH6MTHR8rTkR3n23 2IHycpR+EErC2r8W8wLritKg/M98M6GQ+9AzMxiFhLXY41cWxfzQ/X6hTCqTaPZNRcma sioi3EDB8jjCW7DPhXK10DUzMLKJQst2Pi8ZXq5lMrrblOUJaDS2+U7Q2zDjfLe9ABNh Jp0W8D98pOVi+V+5MFDFp9YP/aMw1l8+zUPy4Ay7/uBlmSrzuxcqmGbL6mg8XBlMKZAB rYVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ds0uKO2F2VBQKsr2RusLC1lcJKUY+GVXGb2P0niujFc=; b=luM+rBFdX7geDY82yrUBL6AK8lSfWDxL6l7pBPBvC1OdRsNKww1UE1KMZSWJvEdJ6V touxnb7spmspTHyGMoUktk8n0rRTqqWU9z8uZluJT95VDyDzdnmDkcC7HLAgKnMlqHTr cBxpjJkoxNDQsqmzNRG3/Jdt5KFj08Hq3hLYzGFnKM9mfOsRvZp/UdON3YXW/nXqcPMb 9PJyl16lTA/cJ7bAqxpBUROXKQVe5KVkOgx620NcAN2TyOR8tl68H7CYXIyq2tgsj8yW 3wcRf3oLtw0LVkJpWC31uPQEIUbV671DUYILklc94lCcO8sGNTj/XdFaTJcUocbTVzZt pYkw== X-Gm-Message-State: APjAAAXErTu59M4ocbFNGHBd1/u+ZbR+/vxr/QkYj9mtXxwpCmK0cerS zqtZzFunfpLPPxNK4Y1Byx0tVnyS6wsAIErGI5eF8Q== X-Received: by 2002:a6b:7312:: with SMTP id e18mr562668ioh.156.1560779952486; Mon, 17 Jun 2019 06:59:12 -0700 (PDT) MIME-Version: 1.0 References: <20190614083404.20514-1-ard.biesheuvel@linaro.org> <20190616204419.GE923@sol.localdomain> <8e58230a-cf0e-5a81-886b-6aa72a8e5265@gmail.com> In-Reply-To: From: Ard Biesheuvel Date: Mon, 17 Jun 2019 15:59:01 +0200 Message-ID: Subject: Re: [RFC PATCH 0/3] crypto: switch to shash for ESSIV generation To: Milan Broz Cc: Gilad Ben-Yossef , Eric Biggers , device-mapper development , linux-fscrypt@vger.kernel.org, Linux Crypto Mailing List , Herbert Xu Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 17 Jun 2019 at 12:58, Ard Biesheuvel wrote: > > On Mon, 17 Jun 2019 at 12:39, Milan Broz wrote: > > > > On 17/06/2019 11:15, Ard Biesheuvel wrote: > > >> I will also add that going the skcipher route rather than shash will > > >> allow hardware tfm providers like CryptoCell that can do the ESSIV > > >> part in hardware implement that as a single API call and/or hardware > > >> invocation flow. > > >> For those system that benefit from hardware providers this can be beneficial. > > >> > > > > > > Ah yes, thanks for reminding me. There was some debate in the past > > > about this, but I don't remember the details. > > > > > > I think implementing essiv() as a skcipher template is indeed going to > > > be the best approach, I will look into that. > > > > For ESSIV (that is de-facto standard now), I think there is no problem > > to move it to crypto API. > > > > The problem is with some other IV generators in dm-crypt. > > > > Some do a lot of more work than just IV (it is hackish, it can modify data, this applies > > for loop AES "lmk" and compatible TrueCrypt "tcw" IV implementations). > > > > For these I would strongly say it should remain "hacked" inside dm-crypt only > > (it is unusable for anything else than disk encryption and should not be visible outside). > > > > Moreover, it is purely legacy code - we provide it for users can access old systems only. > > > > If you end with rewriting all IVs as templates, I think it is not a good idea. > > > > If it is only about ESSIV, and patch for dm-crypt is simple, it is a reasonable approach. > > > > (The same applies for simple dmcryp IVs like "plain" "plain64", "plain64be and "benbi" that > > are just linear IVs in various encoded variants.) > > > > Agreed. > > I am mostly only interested in ensuring that the bare 'cipher' > interface is no longer used outside of the crypto subsystem itself. > Since ESSIV is the only one using that, ESSIV is the only one I intend > to change. OK, so inferring the block cipher name from the skcipher algo name is a bit finicky, since the dm-crypt code does that *after* allocating the TFMs, and allocating the essiv skcipher happens before. But more importantly, it appears to be allowed currently to use ESSIV with authenticated modes, which means we'd need both a skcipher and a aead essiv template, or do some non-trivial hacking to insert the essiv template in the right place (which I'm not sure is even possible) So my main question/showstopper at the moment is: which modes do we need to support for ESSIV? Only CBC? Any skcipher? Or both skciphers and AEADs?