Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5800887ybi; Sun, 21 Jul 2019 02:57:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFFcKsHeBzbYhkIUaAHUlYM0qP8dPJI/7Nq7JidMFm1af3DwiUn1PWZDh0v/viCntUKPiF X-Received: by 2002:a17:902:8205:: with SMTP id x5mr70064224pln.279.1563703050634; Sun, 21 Jul 2019 02:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563703050; cv=none; d=google.com; s=arc-20160816; b=QaT2tZd//FEtKSrKsdY67CWBFvsqjhpLjJ/12QX2HEL/Yxdq1rtSBjuBT1YV5WWAvX eyVrwuyGwC2goz1eTn513j0DZtg6O4L60N6kxQY4B9HcTfs1KMbMOCz5CAy0Iaa8Wlzk Oici/u+4m29WxLenHHEdIlsL2CVjGcgm0s0QlWIFPhQBwXLootQ9nR11bjzBos6Zh1Oc vKQxrPgswpSI9gvePykLVdJqXoBznuQfZOXwtsQccis1cyRqYn9Lis0cA9uaQ8fuIJCl lJXQ6pUzMTilFc2/SCd2uwOYn35T4My3ZtONHiSa/6xDeDlKIWIzJiH9UhKQYQM4XIM/ OuPQ== 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=RQaXx84yWJDYOO2wjLxF1QV6zoVPN9ZxOOdoAW7u+BM=; b=ZuITB/uovedlNBRNUB08yIYNDv+JIbJOTY81nvt/cS6SD2/3xNZQl6DSm3fs9JNxK6 L2mikwMUcZlH5Kca6x9zkoEgImUJZa/xJVuhzjNZuHnOrwEDWyG01x6OMD7s8sBd2MaR 0TSTgLXc0d0pKX0HrrLymToS0IfRF92wZjZUYslbKDihQQalzFwfBhzOZ5z2l5Rt2LJ4 JJ8v2k8zkBSU4Sr5t18TvXMQmUPrnI1jtY38AbFSn8E2GtKlbrQpNbkzG6GHLzXlOrUh xN/fNtQZKGAbZnk4zQ1x3xaZ8xtMm9AeUKV1ZgRQKU9OMGc6dt1KgGWuaBQfO9hK5uWb HGbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y8XAoLGX; 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 i5si10583321pjk.57.2019.07.21.02.57.03; Sun, 21 Jul 2019 02:57:30 -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=y8XAoLGX; 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 S1725868AbfGUJuV (ORCPT + 99 others); Sun, 21 Jul 2019 05:50:21 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35967 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfGUJuU (ORCPT ); Sun, 21 Jul 2019 05:50:20 -0400 Received: by mail-wm1-f65.google.com with SMTP id g67so28510990wme.1 for ; Sun, 21 Jul 2019 02:50:19 -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=RQaXx84yWJDYOO2wjLxF1QV6zoVPN9ZxOOdoAW7u+BM=; b=y8XAoLGX2iH50XgryNmDwfuWVYGdZdKO60N8llqHSZxaim56KJI6E/96fwVOtTeas8 kmg0ecVjwc7CfZ5CIVqkbYmge0b5w+Y0qbwt21zcU7eOUr9FdXwqa5Ry1vFeH+ULOrSx 7ikSE99Ar0WahmR5qHw2hfP+Cq9nmEywvod0EFfIu/uXMzhRd1LpUmj7rJ6BsIchkndQ YTVR5FcFgzXfN9333I5Pm6/OmmcEWCVFVKYpYBdw5Go3RPtQcDNON9XGJl8sRyBN5STL RdQE5ulvc3wlRC4S8t3OO4b7V7LAws/U52hD9Ru8Ik4TwOfh7oWrH8/5YIhaNcicxrNu NRKg== 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=RQaXx84yWJDYOO2wjLxF1QV6zoVPN9ZxOOdoAW7u+BM=; b=YwrfIv/em2KSa64Ox5HysoXU3oZsSa44BmmC2r7eW/iZaIofjv3s6OFgNYvwiqt2aU WVdMas668H7r6yfqqvrrah9qrkFgKLoKz0haflipJepYVIFLh87YJMGCBjh8nv7+NZ2M Lr3WiLyvySQNNCHEaiatRV/Wy6p9lZ8Gs+C8ggRmBvyYzXY3jlkrGO0NzSqQ6CHa90Zg E8vZsQOXh5wwv6Ia7h4dkqdWYoAlzGR6UtaS3NBf4c4PCa/8uUYFyNU5ldkTHg9KxTwy ptlOuS2d8huZQISvWtssL6vklltqO8crFdcBNTH5/ujHrqOFbNDuuSobijIoZxs/cTSY uDnQ== X-Gm-Message-State: APjAAAWOVevt1WpbJX9BnUvnoXzWbmsHr9K/36rqwp/loPhl39iMsSxj 1/iUFnJX9S2hFejMFkBmaUTAuhk3ZuN0F2IoxeaCeQ== X-Received: by 2002:a05:600c:20c1:: with SMTP id y1mr60152036wmm.10.1563702618401; Sun, 21 Jul 2019 02:50:18 -0700 (PDT) MIME-Version: 1.0 References: <20190716221639.GA44406@gmail.com> <20190717172823.GA205944@gmail.com> <20190718065223.4xaefcwjoxvujntw@gondor.apana.org.au> <20190718072154.m2umem24x4grbf6w@gondor.apana.org.au> <36e78459-1594-6d19-0ab4-95b03a6de036@gmail.com> <20190720065807.GA711@sol.localdomain> <0d4d6387-777c-bfd3-e54a-e7244fde0096@gmail.com> In-Reply-To: <0d4d6387-777c-bfd3-e54a-e7244fde0096@gmail.com> From: Ard Biesheuvel Date: Sun, 21 Jul 2019 12:50:06 +0300 Message-ID: Subject: Re: [dm-devel] xts fuzz testing and lack of ciphertext stealing support To: Milan Broz Cc: Pascal Van Leeuwen , Herbert Xu , "dm-devel@redhat.com" , "linux-crypto@vger.kernel.org" , Horia Geanta 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 Sat, 20 Jul 2019 at 10:35, Milan Broz wrote: > > On 20/07/2019 08:58, Eric Biggers wrote: > > On Thu, Jul 18, 2019 at 01:19:41PM +0200, Milan Broz wrote: > >> Also, I would like to avoid another "just because it is nicer" module dependence (XTS->XEX->ECB). > >> Last time (when XTS was reimplemented using ECB) we have many reports with initramfs > >> missing ECB module preventing boot from AES-XTS encrypted root after kernel upgrade... > >> Just saying. (Despite the last time it was keyring what broke encrypted boot ;-) > >> > > > > Can't the "missing modules in initramfs" issue be solved by using a > > MODULE_SOFTDEP()? Actually, why isn't that being used for xts -> ecb already? > > > > (There was also a bug where CONFIG_CRYPTO_XTS didn't select CONFIG_CRYPTO_ECB, > > but that was simply a bug, which was fixed.) > > Sure, and it is solved now. (Some systems with a hardcoded list of modules > have to be manually updated etc., but that is just bad design). > It can be done properly from the beginning. > > I just want to say that that switching to XEX looks like wasting time to me > for no additional benefit. > > Fully implementing XTS does make much more sense for me, even though it is long-term > the effort and the only user, for now, would be testmgr. > > So, there are no users because it does not work. It makes no sense > to implement it, because there are no users... (sorry, sounds like catch 22 :) > > (Maybe someone can use it for keyslot encryption for keys not aligned to > block size, dunno. Actually, some filesystem encryption could have use for it.) > > > Or "xts" and "xex" could go in the same kernel module xts.ko, which would make > > this a non-issue. > > If it is not available for users, I really see no reason to introduce XEX when > it is just XTS with full blocks. > > If it is visible to users, it needs some work in userspace - XEX (as XTS) need two keys, > people are already confused enough that 256bit key in AES-XTS means AES-128... > So the examples, hints, man pages need to be updated, at least. > OK, consider me persuaded. We are already exposing xts(...) to userland, and since we already implement a proper subset of true XTS, it will be simply a matter of making sure that the existing XTS implementations don't regress in performance on the non-CTS code paths. It would be useful, though, to have some generic helper functions, e.g., like the one we have for CBC, or the one I recently proposed for CTS, so that existing implementations (such as the bit sliced AES) can easily be augmented with a CTS code path (but performance may not be optimal in those cases). For the ARM implementations based on AES instructions, it should be reasonably straight forward to implement it close to optimally by reusing some of the code I added for CBC-CTS (but I won't get around to doing that for a while). If there are any volunteers for looking into the generic or x86/AES-NI implementations, please come forward :-) Also, if any of the publications that were quoted in this thread have suitable test vectors, that would be good to know.