Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2475481ybj; Mon, 23 Sep 2019 04:36:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqmxdNuF2gTt9VFPBCM+sEhNPXMc2vJKGnel2ONE9QYxFS0WuA9IXkoS6ce8N4RRJxxM4n X-Received: by 2002:a50:ab58:: with SMTP id t24mr36104139edc.131.1569238566139; Mon, 23 Sep 2019 04:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569238566; cv=none; d=google.com; s=arc-20160816; b=gpEKALb3KU+nRnr0BpxM2S9vCMCUyfbUhlgO7/btwtCcspIGKtn3VfkNRciBjqBa7h b1vcclRJapjd+c6WBOt7tm/p3Xg5s1p09ICgd7dkntkmc59DRrkoAr9WUGFN2ZxNgw8+ bspzaoLKTdPvIzIqaNXOR6jKAgBgjIfYIh5N8AO+7OHpMPeaaIgdZvic4p3kRzCRrCx2 5lcEto+5lKI2R5FjhusNr5CSHLdw7NA8OQQgM5iPhePepLVVO7p6iLyXy2WWTOdyEM3O K2RwhknbZh3eHHUiB+rsgvZnyBN6ZpuWM93ZrRllgzJn5bDwxunIA25UvuUnqUa5sX69 p7Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=Fpvxu+fKvfQZ/gr8bV9aYOwHIkNKC9NXNcZic4bhThk=; b=RhQpLsY/Ipg2nsPy4TRzSj16GyYyx1JfSlgFktjjW8XrNj7ZYmFJtAczZ3q+0EX22r R4A71/7rtgkMtcbeKOZxKWELrgfa576ybr3URZzTbbKoD8D3NIJlM9FG8lBo6oVWHGcu hFTjH0NC/KICWyOzAVZiUOrAw8mCI1XKCcSGz4I/6OrU8G2WOq5nw3sFf1fCt/lGIqWW F9gx7urG8SJIcTunJHlYUCkHRoWUvolVBo/iwNO+QkVZpn7fr+7kpbxiX1jAwPcGzEVi IOgZnoIhO0eJHNyKM5uwBqe3v3YRghvhyhzvm319F9E+QEHBUbigpuVeBI5W9QgGAJsH iQTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sQ5180kT; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si6432009edf.398.2019.09.23.04.35.42; Mon, 23 Sep 2019 04:36:06 -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=@kernel.org header.s=default header.b=sQ5180kT; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbfITVsC (ORCPT + 99 others); Fri, 20 Sep 2019 17:48:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:43736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726190AbfITVsC (ORCPT ); Fri, 20 Sep 2019 17:48:02 -0400 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06098206C2; Fri, 20 Sep 2019 21:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569016081; bh=OEB9selO6qWOkLDV6zPRfKT8jxShJFah86gtPaMgXLw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sQ5180kTJU8tOgJkw7uiK3T0p+qkq7+9nc3VkAeAHrbAiNr5WR2fGa/EZLW1aF+f/ fXapMq6noAV7C28cDFIkySz4h9qKih8F4SN4uA9OvjVlvhPdXWGCP7vabJXhbf+JET S5sLzYd/Ejy5YkturfUtvDYL7BaFotTLN/7ETF1U= Date: Fri, 20 Sep 2019 14:47:59 -0700 From: Eric Biggers To: Mike Snitzer Cc: Milan Broz , Thibaut Sautereau , dm-devel@redhat.com, Alasdair Kergon , linux-kernel@vger.kernel.org Subject: Re: [dm-devel] dm-crypt error when CONFIG_CRYPTO_AUTHENC is disabled Message-ID: <20190920214758.GA162854@gmail.com> Mail-Followup-To: Mike Snitzer , Milan Broz , Thibaut Sautereau , dm-devel@redhat.com, Alasdair Kergon , linux-kernel@vger.kernel.org References: <20190920154434.GA923@gandi.net> <20190920173707.GA21143@redhat.com> <13e25b01-f344-ea1d-8f6c-9d0a60eb1e0f@gmail.com> <20190920212746.GA22061@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190920212746.GA22061@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 20, 2019 at 05:27:46PM -0400, Mike Snitzer wrote: > On Fri, Sep 20 2019 at 3:21pm -0400, > Milan Broz wrote: > > > On 20/09/2019 19:37, Mike Snitzer wrote: > > > On Fri, Sep 20 2019 at 11:44am -0400, > > > Thibaut Sautereau wrote: > > > > > >> Hi, > > >> > > >> I just got a dm-crypt "crypt: Error allocating crypto tfm" error when > > >> trying to "cryptsetup open" a volume. I found out that it was only > > >> happening when I disabled CONFIG_CRYPTO_AUTHENC. > > >> > > >> drivers/md/dm-crypt.c includes the crypto/authenc.h header and seems to > > >> use some CRYPTO_AUTHENC-related stuff. Therefore, shouldn't > > >> CONFIG_DM_CRYPT select CONFIG_CRYPTO_AUTHENC? > > > > > > Yes, it looks like commit ef43aa38063a6 ("dm crypt: add cryptographic > > > data integrity protection (authenticated encryption)") should've added > > > 'select CRYPTO_AUTHENC' to dm-crypt's Kconfig. I'll let Milan weigh-in > > > but that seems like the right way forward. > > > > No, I don't this so. It is like you use some algorithm that is just not compiled-in, > > or it is disabled in the current state (because of FIPS mode od so) - it fails > > to initialize it. > > > > I think we should not force dm-crypt to depend on AEAD - most users > > do not use authenticated encryption, it is perfectly ok to keep this compiled out. > > > > I do not see any principal difference from disabling any other crypto > > (if you disable XTS mode, it fails to open device that uses it). > > > > IMO the current config dependence is ok. > > That is a good point. I hadn't considered the kernel compiles just fine > without CRYPTO_AUTHENC.. which it clearly does. > > SO I retract the question/thought of updating the Kconfig for dm-crypt > in my previous mail. > > Though in hindsight: wonder whether the dm-integrity based dm-crypt > authenticated encryption support should have been exposed as a proper > CONFIG option within the DM_CRYPT section? Rather than lean on the > crypto subsystem to happily stub out the dm-crypt AEAD and AUTHENC > related code dm-crypt could've established #ifdef boundaries for that > code. > > I'm open to suggestions and/or confirmation that the way things are now > is perfectly fine. But I do see this report as something that should > drive some improvement. > FWIW, I think you're being saved right now by the craziness in the crypto subsystem Kconfig options: CONFIG_DM_CRYPT selects CONFIG_CBC, which selects CONFIG_CRYPTO_MANAGER, which selects CONFIG_CRYPTO_MANAGER2, which selects CONFIG_CRYPTO_AEAD2 (and all the other algorithm types, for that matter). This makes the AEAD API available. If this wasn't the case, dm-crypt's use of crypto_alloc_aead() would be causing a link error in some kernel configurations, since CONFIG_DM_CRYPT doesn't actually select the AEAD API itself. At some point I (or someone else up to the task) might try to fix the crypto subsystem to not make every template select every algorithm type. In that happens, we'll need to update the users like dm-crypt to explicitly select the algorithm types they're using, if they were being implicitly selected before. In any case, allowing users to compile out the AEAD support in dm-crypt would also be nice if it's not too difficult, since not everyone needs it. - Eric