Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753560AbcL3K2R (ORCPT ); Fri, 30 Dec 2016 05:28:17 -0500 Received: from helcar.hengli.com.au ([209.40.204.226]:54177 "EHLO helcar.apana.org.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752297AbcL3K2P (ORCPT ); Fri, 30 Dec 2016 05:28:15 -0500 Date: Fri, 30 Dec 2016 18:27:23 +0800 From: Herbert Xu To: Binoy Jayan Cc: Milan Broz , Oded , Ofir , "David S. Miller" , linux-crypto@vger.kernel.org, Mark Brown , Arnd Bergmann , Linux kernel mailing list , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Shaohua Li , linux-raid@vger.kernel.org, Rajendra Subject: Re: [RFC PATCH v2] crypto: Add IV generation algorithms Message-ID: <20161230102723.GA15713@gondor.apana.org.au> References: <1481618949-20086-1-git-send-email-binoy.jayan@linaro.org> <1481618949-20086-2-git-send-email-binoy.jayan@linaro.org> <20161222085509.GA2160@gondor.apana.org.au> <20161223075114.GA3580@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1201 Lines: 28 On Thu, Dec 29, 2016 at 02:53:25PM +0530, Binoy Jayan wrote: > > When we keep these in dm-crypt and if more than one key is used > (it is actually more than one parts of the original key), > there are more than one cipher instance created - one for each > unique part of the key. Since the crypto requests are modelled > to go through the template ciphers in the order: > > "essiv -> cbc -> aes" > > a particular cipher instance of the IV (essiv in this example) is > responsible to encrypt an entire bigger block. If this bigger block > is to be later split into 512 bytes blocks and then encrypted using > the other cipher instance depending on the following formula: > > key_index = sector & (key_count - 1) This is just a matter of structuring the key for the IV generator. The IV generator's key in this case should be a combination of the key to the underlying CBC plus the set of all keys for the IV generator itself. It should then allocate the required number of tfms as is currently done by crypt_alloc_tfms in dm-crypt. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt