Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2991056ybi; Thu, 4 Jul 2019 23:48:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCtnHBeEDrevGL+DyolMEWIDvrgBSCfB0w1QykICLVG2kdZJKXaD35Lsp1WIk/TdkiC/m5 X-Received: by 2002:a63:a50a:: with SMTP id n10mr3002205pgf.200.1562309337004; Thu, 04 Jul 2019 23:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562309336; cv=none; d=google.com; s=arc-20160816; b=PQcOGL73dgANVUQgAtpS7FUm0YsCsEp0GY6zGaiBbeeqYB1oF0vBU020aO/Qb/Lppq cLDkoIXEUNOaH0uJA+mV+2Mf7uRxwvqv7ddO/+xJ/D0NHTYyXhayiqM8mUiT1kSyR032 10bxLVpchInaf6c4kjP/w3qa8xruoFmG/1yjmqtA7SH/hbBeQOYU+VRgaplsiYSx6WvQ 667qAjY5ku3UY+nHRbHUtILRoPMvbeZarE8xGnBWoMkK/XTSqX9B/hJwcDjAFxgqO6io PsLYdNu0beIDdFA1tmrLFQbGHmmi8K7/zqSawa73fbuVYNySQFWsJO5l+Z1+k4g81s24 d0sg== 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=ovsHUna91hEc0tSDDPGIwh4AWoKdmf0FnMPYL9dLv6w=; b=N/LGIC0GRAgsz+FJPsy3mPGiEAUDWflzfv6PPeiIv+NyfFVRd4E+5xln3nT4xM5NCl eKntWGd/tBpszUpJEuKU9UXa46y9p5da0LVTCze5QCbijEXkMUd6M5a2Gsw3P0FZHbDL dRGbaD2qQK1ZWsqA1clBjhmWX0PD5uWqfVGfYcIWp2nv7bvdpQUSKMw6P/KZjvQB+m95 WbonJGpa0dnLFBn8mosOo+n5cRk/JMm8ro0jA6r74GN1hrvAvqWlU38zG45d3b2HSE9E SmmpMuB3FGzm2jBucKJKHMKEmrymxsRqje1/HC6YWpEkvX2+vSGJCWl6uxQogibw4Dlm SzxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mdY+FRbf; 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 h15si7295100plr.23.2019.07.04.23.48.43; Thu, 04 Jul 2019 23:48:56 -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=mdY+FRbf; 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 S1727430AbfGEGcW (ORCPT + 99 others); Fri, 5 Jul 2019 02:32:22 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35348 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727212AbfGEGcW (ORCPT ); Fri, 5 Jul 2019 02:32:22 -0400 Received: by mail-wr1-f68.google.com with SMTP id y4so50777wrm.2 for ; Thu, 04 Jul 2019 23:32:20 -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=ovsHUna91hEc0tSDDPGIwh4AWoKdmf0FnMPYL9dLv6w=; b=mdY+FRbfsdqRqYPNOtfUlf7FXQtpeXltB2OgJdlnN1tKhoHvyjiEkWrNQI+CqpUoIx O+sosMBjjJIQs0wkN4aL3vLMDGTgatrLzsYOfLwpoN7V4V5Ys1VX7OsBxija0v8dDSbB A7c74jcFMT5FxS5zv10CXJyerpfcNH6L+bhyziDmBNO1fWZi3rJT9KObqJXre7K5tZK6 LR0Tp2B1rRPUX2PyPoyey+gbLahcR6lrITAc2rqte3aGU4oIIE8KHaqxSdbONCZydLiE J619uAj0r52PO2FMLBvE/3L6scNOfZ6Ia+xVCFJCGCDvoI4KvcDLkBhfPks+9IyLqjnp 4BTA== 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=ovsHUna91hEc0tSDDPGIwh4AWoKdmf0FnMPYL9dLv6w=; b=hI4GkaY3w4dFQ7DTv1wLm6cjsPcka7zGbReJIv2/LvSQfGJwwoNtIZpGw9s2T+dgH7 PBZThy0kO7XfbmI0CoqBCalT3c7q6dvL0QusqEaj5KQIs4WF2fsdtVovkUPvyKLz7K35 G4MlyAmJGwnzJlwPhSE8rmKTC3gVAD6LFIHM92nVPCA6S5imJyVngjopHnm7Qkl1oeij 0mhhXCGv0VMYtQpNcYAp6BfaDRlyLgybDqkKgqqLash6L8VZTKzrqXo/ix6K0OnhiePY C8Yur7BK+5BF2odMt7uu4/umxdVTx+pz3Hx4nc7vLWyqrX6I8Zti3eCB2Xa09ZrYwUOn ZVWQ== X-Gm-Message-State: APjAAAWKeJ/2xzveV2CUsidW/8tKXWlXj0YyayfSuz0K0MBlyIv+IrI+ IYEqqwjyRqawCiI6EuUjNme5CmFgbSl4jvoxpPG/Gg== X-Received: by 2002:a5d:6b07:: with SMTP id v7mr2202654wrw.169.1562308339870; Thu, 04 Jul 2019 23:32:19 -0700 (PDT) MIME-Version: 1.0 References: <20190704131033.9919-1-gmazyland@gmail.com> <20190704131033.9919-3-gmazyland@gmail.com> <7a8d13ee-2d3f-5357-48c6-37f56d7eff07@gmail.com> <4286b8f6-03b5-a8b4-4db2-35dda954e518@gmail.com> <20190705030827.k6f7hnhxjsoxdj6b@gondor.apana.org.au> In-Reply-To: <20190705030827.k6f7hnhxjsoxdj6b@gondor.apana.org.au> From: Ard Biesheuvel Date: Fri, 5 Jul 2019 08:32:03 +0200 Message-ID: Subject: Re: [PATCH 3/3] dm-crypt: Implement eboiv - encrypted byte-offset initialization vector. To: Herbert Xu Cc: Milan Broz , Eric Biggers , device-mapper development , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 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 Fri, 5 Jul 2019 at 05:08, Herbert Xu wrote: > > On Thu, Jul 04, 2019 at 08:11:46PM +0200, Ard Biesheuvel wrote: > > > > To be clear, making the cipher API internal only is something that I > > am proposing but hasn't been widely discussed yet. So if you make a > > good argument why it is a terrible idea, I'm sure it will be taken > > into account. > > > > The main issue is that the cipher API is suboptimal if you process > > many blocks in sequence, since SIMD implementations will not be able > > to amortize the cost of kernel_fpu_begin()/end(). This is something > > that we might be able to fix in other ways (and a SIMD get/put > > interface has already been proposed which looks suitable for this as > > well) but that would still involve an API change for something that > > isn't the correct abstraction in the first place in many cases. (There > > are multiple implementations of ccm(aes) using cipher_encrypt_one() in > > a loop, for instance, and these are not able to benefit from, e.g, > > the accelerated implementation that I created for arm64, since it open > > codes the CCM operations) > > I agree with what you guys have concluded so far. But I do have > something I want to say about eboiv's implementation itself. > > AFAICS this is using the same key as the actual data. So why > don't you combine it with the actual data when encrypting/decrypting? > > That is, add a block at the front of the actual data containing > the little-endian byte offset and then use an IV of zero. > That would only work for encryption.