From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Uri Shir <uri.shir@arm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Gilad <gilad@benyossef.com>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@vger.kernel.org>
Subject: Re: [PATCH] crypto: ccree - enable CTS support in AES-XTS
Date: Mon, 9 Sep 2019 13:20:05 +0100 [thread overview]
Message-ID: <CAKv+Gu9tVkES12fA0cauMhUV+EZ6HZZwMopJo47qE6j8hsFv4w@mail.gmail.com> (raw)
In-Reply-To: <1567929866-7089-1-git-send-email-uri.shir@arm.com>
On Sun, 8 Sep 2019 at 09:04, Uri Shir <uri.shir@arm.com> wrote:
>
> In XTS encryption/decryption the plaintext byte size
> can be >= AES_BLOCK_SIZE. This patch enable the AES-XTS ciphertext
> stealing implementation in ccree driver.
>
> Signed-off-by: Uri Shir <uri.shir@arm.com>
> ---
> drivers/crypto/ccree/cc_cipher.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
> index 5b58226..a95d3bd 100644
> --- a/drivers/crypto/ccree/cc_cipher.c
> +++ b/drivers/crypto/ccree/cc_cipher.c
> @@ -116,10 +116,6 @@ static int validate_data_size(struct cc_cipher_ctx *ctx_p,
> case S_DIN_to_AES:
> switch (ctx_p->cipher_mode) {
> case DRV_CIPHER_XTS:
> - if (size >= AES_BLOCK_SIZE &&
> - IS_ALIGNED(size, AES_BLOCK_SIZE))
> - return 0;
> - break;
You should still check for size < block size.
> case DRV_CIPHER_CBC_CTS:
> if (size >= AES_BLOCK_SIZE)
> return 0;
> @@ -945,7 +941,7 @@ static const struct cc_alg_template skcipher_algs[] = {
> {
> .name = "xts(paes)",
> .driver_name = "xts-paes-ccree",
> - .blocksize = AES_BLOCK_SIZE,
> + .blocksize = 1,
No need for these blocksize changes - just keep them as they are.
> .template_skcipher = {
> .setkey = cc_cipher_sethkey,
> .encrypt = cc_cipher_encrypt,
> @@ -963,7 +959,7 @@ static const struct cc_alg_template skcipher_algs[] = {
> {
> .name = "xts512(paes)",
> .driver_name = "xts-paes-du512-ccree",
> - .blocksize = AES_BLOCK_SIZE,
> + .blocksize = 1,
> .template_skcipher = {
> .setkey = cc_cipher_sethkey,
> .encrypt = cc_cipher_encrypt,
> @@ -982,7 +978,7 @@ static const struct cc_alg_template skcipher_algs[] = {
> {
> .name = "xts4096(paes)",
> .driver_name = "xts-paes-du4096-ccree",
> - .blocksize = AES_BLOCK_SIZE,
> + .blocksize = 1,
> .template_skcipher = {
> .setkey = cc_cipher_sethkey,
> .encrypt = cc_cipher_encrypt,
> @@ -1203,7 +1199,7 @@ static const struct cc_alg_template skcipher_algs[] = {
> {
> .name = "xts(aes)",
> .driver_name = "xts-aes-ccree",
> - .blocksize = AES_BLOCK_SIZE,
> + .blocksize = 1,
> .template_skcipher = {
> .setkey = cc_cipher_setkey,
> .encrypt = cc_cipher_encrypt,
> @@ -1220,7 +1216,7 @@ static const struct cc_alg_template skcipher_algs[] = {
> {
> .name = "xts512(aes)",
> .driver_name = "xts-aes-du512-ccree",
> - .blocksize = AES_BLOCK_SIZE,
> + .blocksize = 1,
> .template_skcipher = {
> .setkey = cc_cipher_setkey,
> .encrypt = cc_cipher_encrypt,
> @@ -1238,7 +1234,7 @@ static const struct cc_alg_template skcipher_algs[] = {
> {
> .name = "xts4096(aes)",
> .driver_name = "xts-aes-du4096-ccree",
> - .blocksize = AES_BLOCK_SIZE,
> + .blocksize = 1,
> .template_skcipher = {
> .setkey = cc_cipher_setkey,
> .encrypt = cc_cipher_encrypt,
> --
> 2.7.4
>
next prev parent reply other threads:[~2019-09-09 12:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-08 8:04 [PATCH] crypto: ccree - enable CTS support in AES-XTS Uri Shir
2019-09-08 8:10 ` Gilad Ben-Yossef
2019-09-09 12:20 ` Ard Biesheuvel [this message]
2019-09-09 12:34 ` Gilad Ben-Yossef
2019-09-09 14:38 ` Ard Biesheuvel
2019-09-09 15:27 ` Gilad Ben-Yossef
2019-09-10 1:21 ` Herbert Xu
2019-09-13 11:31 ` Herbert Xu
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=CAKv+Gu9tVkES12fA0cauMhUV+EZ6HZZwMopJo47qE6j8hsFv4w@mail.gmail.com \
--to=ard.biesheuvel@linaro.org \
--cc=davem@davemloft.net \
--cc=gilad@benyossef.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=uri.shir@arm.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;
as well as URLs for NNTP newsgroup(s).