Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1049589pxx; Tue, 27 Oct 2020 07:09:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdDfmwNzeHuRe6N8T9Jsh1VzhnUV3QSjTmHJwvcf91QauRMfZCo/ta9Osk1dcQsl7xkSBw X-Received: by 2002:a17:906:14db:: with SMTP id y27mr2753541ejc.148.1603807797531; Tue, 27 Oct 2020 07:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603807797; cv=none; d=google.com; s=arc-20160816; b=fyI6xB5uNJLaYSIONqnZO54zVIo3N+Nx2mIh8oGq3m1pO6fokD7nIkuGPYB1GaoLbl Pl+xFONHvj/j9vkWXJTeGnmaKeSN+I+z664nJC/I5FiuXlHv2lF7rIqcWkPiIma2qQxO VAPsvJfmrjGplRBHn6AsadC2qqISRYaV/TG4DL1LwEjLSUDbhk1eQ592OSA1KwFh8C5n ysEt1dd5PVmkdTUheesegf1fraNzUQ8bf5p6nVb7b+HhUQxnNImjNET4xIPkb75VFrz+ XNPnfj1vdP/F5kR3xdQwVvd8TJTmyc4N1q01W8wjhwU+auQdZpfcYk7VgaKb6sBsVHmS 6mfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=/MJ+UTfnuNYWSl6F6YSIZ4D2DyAhRF8y858D6tasEvw=; b=cowMPSzyiAkzkprqQke3/2Lcdc23X+mU/TC2Fgy/zFCeQAeZm+Y7KHN8OBP+DUjw/g lzg7WQDgothEndfh2Bm03LEnX05Xd0WLMifiGginvBqz1D7c/a5gQoW9wFevPYhdmkXv 3e4PCG+cZovVB4LB/fjbG0iJvLMxNmfegSgdxW6vC2fojM6+4hnCM0Cf++9sN7jivcvK poL2eRTIGJX4Qk0NDOW5IjpS8EKcJW38yGFG0lAU0HgniTG0UBvSgcrTyJKie/I1HTEh kvMLppL7NmlFzOWy+M9/oJLYMYmK4Qo4oFBsXadXsynGcYAYsQZyyfh1kOK+YvwPhIbE SacA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=Ojl6JlAN; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si962613edn.287.2020.10.27.07.09.33; Tue, 27 Oct 2020 07:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=Ojl6JlAN; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388537AbgJ0G7g (ORCPT + 99 others); Tue, 27 Oct 2020 02:59:36 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:37985 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729413AbgJ0G7f (ORCPT ); Tue, 27 Oct 2020 02:59:35 -0400 Received: by mail-yb1-f193.google.com with SMTP id b138so363832yba.5 for ; Mon, 26 Oct 2020 23:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benyossef-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/MJ+UTfnuNYWSl6F6YSIZ4D2DyAhRF8y858D6tasEvw=; b=Ojl6JlAN3zbm1LbCOHvpxKHmr3L5vs2pku5A2tc4RvlhiU4fWtenEdLlujKmeaGUC7 aqlL3W3bCv/Dt56pp+AZ5AHOyb7JkxXmw6wbM1XwxiZgb/6/C2gsf5XhDEdQuyGMHu1u vhfblhEok3wrb0k+5LrnzzO5GPKgypY8HiDrJaGyWfMz3TY5NFWjIWSp3eUOIS2NoSCI TyVuaIjNkYUNTkRvu0tIoctrY2MqgImQWSBodF8ZPCITXRf2L+EUXZQ05EdgP43jUAUM 1KmSuO3DQjCsHBlYwfkzB2mWMxmkgeFELaBURyuXFadqBG0mtb3jPz+KAzp/EriNXiEE Pnmg== 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:content-transfer-encoding; bh=/MJ+UTfnuNYWSl6F6YSIZ4D2DyAhRF8y858D6tasEvw=; b=dHL1Log0Pj1MyxflC9mV0dVQwRj32BbDQiW8Z/+c7WmRAfm3zg82Brx0Co8rBSgEGy wl3Q91StptW1B02M1ZztCp+KzqvsRVQVZ9U2HqAFjr9of/nnKGLykau4HC/ZZXTkDWkE J9V/1LBUxeMY936nN6oWy0huKPIrFmxSFyv3Lh3Exqn2Ut2J+8kl7Ic/vTWlohzSduL/ rDQhZ2vIygpdAd/LNQQdk5SKKpRZWGb4sXooetbDHOETXeKsatEufAEY+RnA7/Z5CSU7 mXQGDi6LcILbV3mN6oZoxhz1weqCZnUPgT8dzGxniQNXoDvoxUg/8xdPE4vWWY4jr1ch I+Vw== X-Gm-Message-State: AOAM532ZZKM7kTSD2G1MrJyTCU918oSQgTt+m4c+cLE67yvTKdb0SpLo cblCN6sTfUfNH65HVPpI8lDAUHlSv9GypK0MCQyG2Q== X-Received: by 2002:a25:6609:: with SMTP id a9mr1102464ybc.375.1603781973236; Mon, 26 Oct 2020 23:59:33 -0700 (PDT) MIME-Version: 1.0 References: <20201026130450.6947-1-gilad@benyossef.com> <20201026130450.6947-4-gilad@benyossef.com> <20201026175231.GG858@sol.localdomain> <20201026183936.GJ858@sol.localdomain> In-Reply-To: From: Gilad Ben-Yossef Date: Tue, 27 Oct 2020 08:59:27 +0200 Message-ID: Subject: Re: [PATCH 3/4] dm crypt: switch to EBOIV crypto API template To: Milan Broz Cc: Eric Biggers , Herbert Xu , "David S. Miller" , Alasdair Kergon , Mike Snitzer , device-mapper development , Song Liu , Ofir Drang , Linux Crypto Mailing List , Linux kernel mailing list , linux-raid@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Oct 26, 2020 at 9:04 PM Milan Broz wrote: > > > > On 26/10/2020 19:39, Eric Biggers wrote: > > On Mon, Oct 26, 2020 at 07:29:57PM +0100, Milan Broz wrote: > >> On 26/10/2020 18:52, Eric Biggers wrote: > >>> On Mon, Oct 26, 2020 at 03:04:46PM +0200, Gilad Ben-Yossef wrote: > >>>> Replace the explicit EBOIV handling in the dm-crypt driver with call= s > >>>> into the crypto API, which now possesses the capability to perform > >>>> this processing within the crypto subsystem. > >>>> > >>>> Signed-off-by: Gilad Ben-Yossef > >>>> > >>>> --- > >>>> drivers/md/Kconfig | 1 + > >>>> drivers/md/dm-crypt.c | 61 ++++++++++++++--------------------------= --- > >>>> 2 files changed, 20 insertions(+), 42 deletions(-) > >>>> > >>>> diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig > >>>> index 30ba3573626c..ca6e56a72281 100644 > >>>> --- a/drivers/md/Kconfig > >>>> +++ b/drivers/md/Kconfig > >>>> @@ -273,6 +273,7 @@ config DM_CRYPT > >>>> select CRYPTO > >>>> select CRYPTO_CBC > >>>> select CRYPTO_ESSIV > >>>> + select CRYPTO_EBOIV > >>>> help > >>>> This device-mapper target allows you to create a device that > >>>> transparently encrypts the data on it. You'll need to activate > >>> > >>> Can CRYPTO_EBOIV please not be selected by default? If someone reall= y wants > >>> Bitlocker compatibility support, they can select this option themselv= es. > >> > >> Please no! Until this move of IV to crypto API, we can rely on > >> support in dm-crypt (if it is not supported, it is just a very old ker= nel). > >> (Actually, this was the first thing I checked in this patchset - if it= is > >> unconditionally enabled for compatibility once dmcrypt is selected.) > >> > >> People already use removable devices with BitLocker. > >> It was the whole point that it works out-of-the-box without enabling a= nything. > >> > >> If you insist on this to be optional, please better keep this IV insid= e dmcrypt. > >> (EBOIV has no other use than for disk encryption anyway.) > >> > >> Or maybe another option would be to introduce option under dm-crypt Kc= onfig that > >> defaults to enabled (like support for foreign/legacy disk encryption s= chemes) and that > >> selects these IVs/modes. > >> But requiring some random switch in crypto API will only confuse users= . > > > > CONFIG_DM_CRYPT can either select every weird combination of algorithms= anyone > > can ever be using, or it can select some defaults and require any other= needed > > algorithms to be explicitly selected. > > > > In reality, dm-crypt has never even selected any particular block ciphe= rs, even > > AES. Nor has it ever selected XTS. So it's actually always made users= (or > > kernel distributors) explicitly select algorithms. Why the Bitlocker s= upport > > suddenly different? > > > > I'd think a lot of dm-crypt users don't want to bloat their kernels wit= h random > > legacy algorithms. > > Yes, but IV is in reality not a cryptographic algorithm, it is kind-of a = configuration > "option" of sector encryption mode here. > > We had all of disk-IV inside dmcrypt before - but once it is partially mo= ved into crypto API > (ESSIV, EBOIV for now), it becomes much more complicated for user to sele= ct what he needs. > > I think we have no way to check that IV is available from userspace - it > will report the same error as if block cipher is not available, not helpi= ng user much > with the error. > > But then I also think we should add abstract dm-crypt options here (Legac= y TrueCrypt modes, > Bitlocker modes) that will select these crypto API configuration switches= . > Otherwise it will be only a complicated matrix of crypto API options... hm... just thinking out loud, but maybe the right say to go is to not have a build dependency, but add some user assistance code in cryptosetup that parses /proc/crypto after failures to try and suggest the user with a way forward? e.g. if eboiv mapping initiation fails, scan /proc/crypto and either warn of a lack of AES or, assuming some instance of AES is found, warn of lack of EBOIV. It's a little messy and heuristic code for sure, but it lives in a user space utility. Does that sound sane? --=20 Gilad Ben-Yossef Chief Coffee Drinker values of =CE=B2 will give rise to dom!