Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4031017ybh; Tue, 6 Aug 2019 05:18:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMDK/m2EITSTL6/rYLNtJxPgEzdq/4gg/DPzhqJPZAsG9BJEWO3AB/udBeDv6HYs8Dx8g6 X-Received: by 2002:a63:de07:: with SMTP id f7mr2855357pgg.213.1565093895833; Tue, 06 Aug 2019 05:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565093895; cv=none; d=google.com; s=arc-20160816; b=TN9sImZKe2yuGETCMuHcgJHaYzU/n5Kr1X9xomDB3YWWukNNAR9KUDTdcuQwLtENbk 3CTrhnwG27Hrs0sLCRmei0qkkYskHzmgPAIh85Q8XYxghUjIXThiwFDAaFKQxvcNXyl1 mKPfh1PmHwUEnNlO+ZMLc4jRyk/rwXYBhLpCDEEVLLbvDRgG/tz9LZICr3cGx7cDqiOV L0tIIvex198Q6AHjhKzsVZQAuyVaYOWrV4nKLb+sjMHu/RPeR5s/UX8s0+MeDJ4iYjm6 HZlbwjSTYA77G0fuX3sFRz2AQwnEIlaRZ3uSpzvJLdh/568+SYpbIfWtr6+s+H4W3XhF AR0w== 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=E45FnivbPqKcsfGpty7g0LI8JR/YbnVdWPgdzzyZ8l0=; b=HRhiVCxhcDcAnQr3/fRYc73JmcXFDWPZsngIgP91oZybFoJ9z25awPKrTYcY7HZEtf QEqxVics8Jnf4aQFALiOpQLtu0xEfmTTyS6h+X68hvE5kqBJAi8YCNPaKk+0ID6E1YUV buV5ejPgk6wwjcX3ytV8Mkygb0J+0ll1NiDJaL+gzuDQ2kYhAEwY8ZNvN3tCoJ11dmDY tQrhVqjUC0g5hJsH761joQpW0TdXgDw5fUZnPNCFgU8MxNRgOCARH/lgsewAGIp8yJe7 ZGRIi78WKriEilrDkP/CR5vpXtI7/r3bso8Z06Qmj37q6sqRqCCzg7vs7kpOh49VuYWI l4cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zhsryLY5; 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 z185si45451875pfz.248.2019.08.06.05.17.56; Tue, 06 Aug 2019 05:18:15 -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=zhsryLY5; 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 S1726092AbfHFMRt (ORCPT + 99 others); Tue, 6 Aug 2019 08:17:49 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:33544 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfHFMRt (ORCPT ); Tue, 6 Aug 2019 08:17:49 -0400 Received: by mail-wm1-f68.google.com with SMTP id h19so8825639wme.0 for ; Tue, 06 Aug 2019 05:17:48 -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=E45FnivbPqKcsfGpty7g0LI8JR/YbnVdWPgdzzyZ8l0=; b=zhsryLY5ezEpM2wJSrHlUJ2yOPeDDT8X9D/yM9kU0zwraM1GOWynxFvK+Rg9phJMna QSdb0HGiAdgRVHUC7oImVgjvA01Aq0eDYXKXZmHqruI/vKBdNW7/wmnKhNKgxI3LmE7K mDBL+nk01XdDrOj60gf/jAN5OICJJsLWbk04y4OUD2UrqtWux/6yyXoLl9AWWr91IA8V BdgvRikMKffqzrke0xFGSWNg2wNPGy3Dc7VyBc5qHMQE2YiFHDI/cjKtBWcX2uXVI4cY lL7uEc6SnT9fZZc9ZF3yUMFvSHZq5uOFbYvJzG4EJcsQA8R+PCQo8IejwfOuf58ge5e1 k68w== 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=E45FnivbPqKcsfGpty7g0LI8JR/YbnVdWPgdzzyZ8l0=; b=ahTofHszHtH4kap6bAYNkUCHsmNhumdUX819ZYRbBK3CRtQx5WqaM+Yx1dA9JCTqBg DUQycCVN8s5ooWI3l/cUJxlcBt6cbfe+tK3spQpyqPG0EhQhNWXj65jM14J491uwcdnd ZU5FnOymwpgye0V5cM/tj5LD2omUa3oA3+cze6dXMiEyGsnYt+WGguOPGjlICpdzGtP4 fGI8ReWC8T7SPHG81iqDizdAPNXM9KLV1BDJ58oyiRrgyrlddm5pSkiB2nJitzusGRrw clPUnYnduD4q96O8OmYmZ1PTmbVIo58xCVVPZA7Jb6GZV18vVvrNdGsRy7UNWdsK0oIw 04fw== X-Gm-Message-State: APjAAAU3kHV9/wOeV6tLMOC9P0L2VCxCkE69RphODlkg2R4/T+TsBNsc CnTKkck1XiU5pHWGN7fHaUooWi2cbFYL03xIgTvBbA== X-Received: by 2002:a1c:b706:: with SMTP id h6mr4506053wmf.119.1565093867280; Tue, 06 Aug 2019 05:17:47 -0700 (PDT) MIME-Version: 1.0 References: <20190806080234.27998-1-ard.biesheuvel@linaro.org> <20190806080234.27998-3-ard.biesheuvel@linaro.org> <22f5bfd5-7563-b85b-925e-6d46e7584966@gmail.com> In-Reply-To: <22f5bfd5-7563-b85b-925e-6d46e7584966@gmail.com> From: Ard Biesheuvel Date: Tue, 6 Aug 2019 15:17:36 +0300 Message-ID: Subject: Re: [RFC PATCH 2/2] md/dm-crypt - switch to AES library for EBOIV To: Milan Broz Cc: "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Herbert Xu , Eric Biggers , "Alasdair G. Kergon" , Mike Snitzer , device-mapper development 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 Tue, 6 Aug 2019 at 13:43, Milan Broz wrote: > > On 06/08/2019 10:02, Ard Biesheuvel wrote: > > The EBOIV IV mode reuses the same AES encryption key that is used for > > encrypting the data, and uses it to perform a single block encryption > > of the byte offset to produce the IV. > > > > Since table-based AES is known to be susceptible to known-plaintext > > attacks on the key, and given that the same key is used to encrypt > > the byte offset (which is known to an attacker), we should be > > careful not to permit arbitrary instantiations where the allocated > > AES cipher is provided by aes-generic or other table-based drivers > > that are known to be time variant and thus susceptible to this kind > > of attack. > > > > Instead, let's switch to the new AES library, which has a D-cache > > footprint that is only 1/32th of the generic AES driver, and which > > contains some mitigations to reduce the timing variance even further. > > NACK. > > We discussed here that we will not limit combinations inside dm-crypt. > For generic crypto API, this policy should be different, but I really > do not want these IVs to be visible outside of dm-crypt. > > Allowing arbitrary combinations of a cipher, mode, and IV is how dm-crypt > works since the beginning, and I really do not see the reason to change it. > > This IV mode is intended to be used for accessing old BitLocker images, > so I do not care about performance much. > Apologies for being blunt, but you are basically driving home the point I made before about why the cipher API should become internal to the crypto subsystem. Even though EBOIV is explicitly only intended for accessing old BitLocker images, you prioritize non-functional properties like API symmetry and tradition over sound cryptographic engineering practice, even after I pointed out to you that a) the way EBOIV uses the same symmetric key for two different purposes is a bad idea in general, and b) table based AES in particular is a hazard for this mode, since the way the IV is generated is susceptible to exactly the attack that table based AES is most criticized for. So if you insist on supporting EBOIV in combination with arbitrary skciphers or AEADs (or AES on systems where crypto_alloc_cipher() produces a table based AES driver), how do you intend to mitigate these issues?