From: levent demir <levent.demir@inria.fr>
To: linux-crypto@vger.kernel.org
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: Atmel driver - XTS mode - Alignement issue
Date: Tue, 31 May 2016 09:54:46 +0200 [thread overview]
Message-ID: <1464681286.9080.15.camel@inria.fr> (raw)
Hi all,
I am working on SAMA5D3 board with atmel-aes driver, I have a question
about sg.
This board does not support XTS mode, however we want to add this
functionality.
As a recall XTS mode :
For a 512 bytes block:
1) We encrypt the given IV with the second part of the key [ECB].
2) We compute the 32 tweaks value (with GF multiplication)
3) We Xor the plaintext with the tweaks (called XOR_1)
4) We encrypt the result with ECB and the first half of the key
5) Again we xor the result with tweaks (called XOR_2)
So if I want to add my own XTS mode I need to make all those
operations.
I have seen in the code there is a alignement issue to handle, if source
data is aligned
we can encrypt it directly. If source data is not aligned we call a
function to copy into a buffer :
625 if (!src_aligned) {
626 sg_copy_to_buffer(src, sg_nents(src), dd->buf, len);
...
Moreover we are working with dm-crypt.
My question is : is it possible to make the XOR operation directly on
scatterlist if data is aligned ?
Or I am forced to use the sg_copy_to/from_buffer.
We have tested and here are the results :
1) The easy solution is to copy the src data into the buffer and to xor
it with tweaks for XOR_1 and XOR_2
2) If we xor only the ciphertext [dst] (XOR_2) directly with the
scatterlist and compute the src XOR_1 with the buffer, it is working.
3) If we xor direcly with the scatterlist for XOR_1 and XOR_2 we have an
error at the mount step using dm-crypt :
[269132.780000] EXT4-fs (dm-0): ext4_check_descriptors: Block bitmap for
group 0 not in group
(block 16843203)!
[269132.790000] EXT4-fs (dm-0): group descriptors corrupted!
If you can help me on this point.
Thanks.
reply other threads:[~2016-05-31 7:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1464681286.9080.15.camel@inria.fr \
--to=levent.demir@inria.fr \
--cc=alexandre.belloni@free-electrons.com \
--cc=linux-crypto@vger.kernel.org \
--cc=nicolas.ferre@atmel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox