Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Gert Robben <t2@gert.gr>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, linux-crypto@vger.kernel.org
Cc: jelledejong@powercraft.nl, ebiggers@kernel.org,
	florian@bezdeka.de, herbert@gondor.apana.org.au
Subject: Re: [PATCH v2] crypto: geode-aes - switch to skcipher for cbc(aes) fallback
Date: Sat, 5 Oct 2019 18:15:16 +0200	[thread overview]
Message-ID: <b18ff289-ceca-d934-6583-caf8d2916bcb@gert.gr> (raw)
In-Reply-To: <20191005091110.12556-1-ard.biesheuvel@linaro.org>

Op 05-10-2019 om 11:11 schreef Ard Biesheuvel:
> Commit 79c65d179a40e145 ("crypto: cbc - Convert to skcipher") updated
> the generic CBC template wrapper from a blkcipher to a skcipher algo,
> to get away from the deprecated blkcipher interface. However, as a side
> effect, drivers that instantiate CBC transforms using the blkcipher as
> a fallback no longer work, since skciphers can wrap blkciphers but not
> the other way around. This broke the geode-aes driver.
> 
> So let's fix it by moving to the sync skcipher interface when allocating
> the fallback. At the same time, align with the generic API for ECB and
> CBC by rejecting inputs that are not a multiple of the AES block size.
> 
> Fixes: 79c65d179a40e145 ("crypto: cbc - Convert to skcipher")
> Cc: <stable@vger.kernel.org> # v4.20+ ONLY
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> v2: pass dst and src scatterlist in the right order
>      reject inputs that are not a multiple of the block size

Yes, with this patch, the CRYPTO_MANAGER_EXTRA_TESTS output nothing 
(apart from "extra crypto tests enabled").
All items in /proc/crypto have "selftest: passed" mentioned.
"openssl speed -evp aes-128-cbc -elapsed -engine afalg" reaches the 
proper speed.
And nginx (correctly) transfers files about 40% faster than without 
geode-aes.

I didn't think about testing ecb before, because I don't use it.
Now that I did, I tried the same openssl benchmark for ecb.
But that only reaches software AES speed, and "time" also shows the work 
is being done in "user" instead of "sys" (see below).
Yet I see no errors.
(Maybe this is normal/expected, so I didn't look much further into it).

Thank you,
Gert

# time openssl speed -evp aes-128-cbc -elapsed -engine afalg
- - - 8< - - -
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 
bytes  16384 bytes
aes-128-cbc        135.82k      539.29k     2087.90k     7491.16k 
29221.69k    34943.67k

real	0m18.081s
user	0m0.516s
sys	0m17.541s

# time openssl speed -evp aes-128-ecb -elapsed -engine afalg
- - - 8< - - -
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 
bytes  16384 bytes
aes-128-ecb       4480.65k     5137.66k     5336.94k     5410.19k 
5409.91k     5409.91k

real	0m18.084s
user	0m18.046s
sys	0m0.012s


  parent reply	other threads:[~2019-10-05 16:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05  9:11 [PATCH v2] crypto: geode-aes - switch to skcipher for cbc(aes) fallback Ard Biesheuvel
2019-10-05 12:22 ` Florian Bezdeka
2019-10-08 11:36   ` Ard Biesheuvel
2020-01-19 10:02     ` Florian Bezdeka
2020-01-19 13:51       ` Ard Biesheuvel
2019-10-05 16:15 ` Gert Robben [this message]
2019-10-08 11:38   ` Ard Biesheuvel
2019-10-10 12:58 ` 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=b18ff289-ceca-d934-6583-caf8d2916bcb@gert.gr \
    --to=t2@gert.gr \
    --cc=ard.biesheuvel@linaro.org \
    --cc=ebiggers@kernel.org \
    --cc=florian@bezdeka.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=jelledejong@powercraft.nl \
    --cc=linux-crypto@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