From: Mike Snitzer <snitzer@redhat.com>
To: Milan Broz <gmazyland@gmail.com>
Cc: dm-devel@redhat.com
Subject: Re: [PATCH 1/2] dm-crypt: Properly handle extra key string in initialization
Date: Mon, 28 Oct 2013 11:44:47 -0400 [thread overview]
Message-ID: <20131028154447.GA25212@redhat.com> (raw)
In-Reply-To: <1382275000-10660-1-git-send-email-gmazyland@gmail.com>
On Sun, Oct 20 2013 at 9:16am -0400,
Milan Broz <gmazyland@gmail.com> wrote:
> Some encryption modes use extra keys (e.g. loopAES has IV seed)
> which are not used in block cipher initialization but are part
> of key string in table constructor.
>
> Patch adds additional field which described lengh of this extra
> keys and substracts it before real key encryption setting.
typo, s/lengh/length/
But that aside, an example of the extra keys use with a theoretical
example via ctr input -- documented in patch header -- would be
helpful. As it stands the code is doing some unituitive things (see
below).
> Because extra keys are calculated during IV mode setting,
> key initialization is moved after this step.
>
> For now, this change has no effect to supported modes
> (thanks to ilog2 rounding) but is required by following patch.
>
> Signed-off-by: Milan Broz <gmazyland@gmail.com>
> ---
> drivers/md/dm-crypt.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index 0fce0bc..878bda7 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1497,14 +1495,23 @@ static int crypt_ctr_cipher(struct dm_target *ti,
> * to length of provided multi-key string.
> * If present (version 3), last key is used as IV seed.
> */
> - if (cc->key_size % cc->key_parts)
> + if (cc->key_size % cc->key_parts) {
> cc->key_parts++;
> + cc->key_extra_size = cc->key_size / cc->key_parts;
> + }
This is leveraging existing heuristics of bumping key_parts and then
using it to establish 'key_extra_size' -- but the definition of "extra
size" is eluding me. Say key_size=101, kepyparts=10 -- remainder is 1.
So then key_extra_size = 9.
All a bit opaque to me without a ctr usage example to help document in
the patch header.
next prev parent reply other threads:[~2013-10-28 15:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-20 13:16 [PATCH 1/2] dm-crypt: Properly handle extra key string in initialization Milan Broz
2013-10-20 13:16 ` [PATCH 2/2] dm-crypt: Add TCW IV mode for old CBC TCRYPT containers Milan Broz
2013-10-28 16:08 ` Mike Snitzer
2013-10-28 16:58 ` Milan Broz
2013-10-28 15:44 ` Mike Snitzer [this message]
2013-10-28 16:46 ` [PATCH 1/2] dm-crypt: Properly handle extra key string in initialization Milan Broz
2013-10-28 22:21 ` Milan Broz
2013-10-28 22:21 ` [PATCH 2/2] dm-crypt: Add TCW IV mode for old CBC TCRYPT containers Milan Broz
2013-10-30 0:50 ` Mike Snitzer
2013-10-30 18:12 ` Alasdair G Kergon
2013-11-02 21:24 ` [PATCH 3/4] dm-crypt: Fix code formatting to make agk happy Milan Broz
2013-11-02 21:24 ` [PATCH 4/4] dm-crypt: Fix sparse (different base types) warnings Milan Broz
2013-11-05 13:41 ` Alasdair G Kergon
2013-10-30 0:49 ` [PATCH 1/2] dm-crypt: Properly handle extra key string in initialization Mike Snitzer
2013-10-30 2:48 ` Alasdair G Kergon
2013-10-30 19:30 ` Milan Broz
2013-10-30 3:23 ` Alasdair G Kergon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131028154447.GA25212@redhat.com \
--to=snitzer@redhat.com \
--cc=dm-devel@redhat.com \
--cc=gmazyland@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.