linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: Milan Broz <gmazyland@gmail.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Eric Biggers <ebiggers@google.com>,
	device-mapper development <dm-devel@redhat.com>,
	linux-fscrypt@vger.kernel.org,
	Gilad Ben-Yossef <gilad@benyossef.com>
Subject: Re: [PATCH v3 0/6] crypto: switch to crypto API for ESSIV generation
Date: Thu, 20 Jun 2019 15:14:52 +0200	[thread overview]
Message-ID: <6a45dfa5-e383-d8a3-ebf1-abdc43c95ebd@gmail.com> (raw)
In-Reply-To: <075cddec-1603-4a23-17c4-c766b4bd9086@gmail.com>

On 20/06/2019 14:09, Milan Broz wrote:
> On 20/06/2019 13:54, Ard Biesheuvel wrote:
>> On Thu, 20 Jun 2019 at 13:22, Milan Broz <gmazyland@gmail.com> wrote:
>>>
>>> On 19/06/2019 18:29, Ard Biesheuvel wrote:
>>>> This series creates an ESSIV template that produces a skcipher or AEAD
>>>> transform based on a tuple of the form '<skcipher>,<cipher>,<shash>'
>>>> (or '<aead>,<cipher>,<shash>' for the AEAD case). It exposes the
>>>> encapsulated sync or async skcipher/aead by passing through all operations,
>>>> while using the cipher/shash pair to transform the input IV into an ESSIV
>>>> output IV.
>>>>
>>>> This matches what both users of ESSIV in the kernel do, and so it is proposed
>>>> as a replacement for those, in patches #2 and #4.
>>>>
>>>> This code has been tested using the fscrypt test suggested by Eric
>>>> (generic/549), as well as the mode-test script suggested by Milan for
>>>> the dm-crypt case. I also tested the aead case in a virtual machine,
>>>> but it definitely needs some wider testing from the dm-crypt experts.
>>>>
>>>> Changes since v2:
>>>> - fixed a couple of bugs that snuck in after I'd done the bulk of my
>>>>   testing
>>>> - some cosmetic tweaks to the ESSIV template skcipher setkey function
>>>>   to align it with the aead one
>>>> - add a test case for essiv(cbc(aes),aes,sha256)
>>>> - add an accelerated implementation for arm64 that combines the IV
>>>>   derivation and the actual en/decryption in a single asm routine
>>>
>>> I run tests for the whole patchset, including some older scripts and seems
>>> it works for dm-crypt now.
>>>
>>
>> Thanks Milan, that is really helpful.
>>
>> Does this include configurations that combine authenc with essiv?
> 
> Hm, seems that we are missing these in luks2-integrity-test. I'll add them there.
> 
> I also used this older test
> https://gitlab.com/omos/dm-crypt-test-scripts/blob/master/root/test_dmintegrity.sh
> 
> (just aes-gcm-random need to be commented out, we never supported this format, it was
> written for some devel version)
> 
> But seems ESSIV is there tested only without AEAD composition...
> 
> So yes, this AEAD part need more testing.

And unfortunately it does not work - it returns EIO on sectors where it should not be data corruption.

I added few lines with length-preserving mode with ESSIV + AEAD, please could you run luks2-integrity-test
in cryptsetup upstream?

This patch adds the tests:
https://gitlab.com/cryptsetup/cryptsetup/commit/4c74ff5e5ae328cb61b44bf99f98d08ffee3366a

It is ok on mainline kernel, fails with the patchset:

# ./luks2-integrity-test 
[aes-cbc-essiv:sha256:hmac-sha256:128:512][FORMAT][ACTIVATE]sha256sum: /dev/mapper/dmi_test: Input/output error
[FAIL]
 Expecting ee501705a084cd0ab6f4a28014bcf62b8bfa3434de00b82743c50b3abf06232c got .

FAILED backtrace:
77 ./luks2-integrity-test
112 intformat ./luks2-integrity-test
127 main ./luks2-integrity-test

Milan

  reply	other threads:[~2019-06-20 13:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 16:29 [PATCH v3 0/6] crypto: switch to crypto API for ESSIV generation Ard Biesheuvel
2019-06-19 16:29 ` [PATCH v3 1/6] crypto: essiv - create wrapper template " Ard Biesheuvel
2019-06-20  1:04   ` Eric Biggers
2019-06-20  1:13     ` Herbert Xu
2019-06-20  1:17       ` Herbert Xu
2019-06-20  7:30       ` Ard Biesheuvel
2019-06-20 12:52         ` Herbert Xu
2019-06-20 12:53         ` Herbert Xu
2019-06-20 13:02           ` Ard Biesheuvel
2019-06-20 13:35             ` Ard Biesheuvel
2019-06-20 13:40             ` Herbert Xu
2019-06-20 13:53               ` Ard Biesheuvel
2019-06-21  1:06                 ` Herbert Xu
2019-06-21  5:39                   ` Ard Biesheuvel
2019-06-21  6:44               ` Milan Broz
2019-06-20 18:27         ` Eric Biggers
2019-06-19 16:29 ` [PATCH v3 2/6] fs: crypto: invoke crypto API for ESSIV handling Ard Biesheuvel
2019-06-19 22:45   ` Eric Biggers
2019-06-19 16:29 ` [PATCH v3 3/6] md: dm-crypt: infer ESSIV block cipher from cipher string directly Ard Biesheuvel
2019-06-19 16:29 ` [PATCH v3 4/6] md: dm-crypt: switch to ESSIV crypto API template Ard Biesheuvel
2019-06-19 16:29 ` [PATCH v3 5/6] crypto: essiv - add test vector for essiv(cbc(aes),aes,sha256) Ard Biesheuvel
2019-06-19 16:29 ` [PATCH v3 6/6] crypto: arm64/aes - implement accelerated ESSIV/CBC mode Ard Biesheuvel
2019-06-19 22:37   ` Eric Biggers
2019-06-19 22:43     ` Ard Biesheuvel
2019-06-20 11:29     ` Milan Broz
2019-06-26  4:32   ` Eric Biggers
2019-06-20  7:07 ` [PATCH v3 0/6] crypto: switch to crypto API for ESSIV generation Gilad Ben-Yossef
2019-06-20 11:22 ` Milan Broz
2019-06-20 11:54   ` Ard Biesheuvel
2019-06-20 12:09     ` Milan Broz
2019-06-20 13:14       ` Milan Broz [this message]
2019-06-20 13:52         ` Ard Biesheuvel
2019-06-21  7:01           ` Milan Broz
2019-06-21  7:06             ` Ard Biesheuvel
2019-06-21  7:37               ` Ard Biesheuvel

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=6a45dfa5-e383-d8a3-ebf1-abdc43c95ebd@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=dm-devel@redhat.com \
    --cc=ebiggers@google.com \
    --cc=gilad@benyossef.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).