Skip to content

Commit 9777846

Browse files
ebiggersgregkh
authored andcommitted
arm: crypto: reduce priority of bit-sliced AES cipher
[ Not upstream because this is a minimal fix for a bug where arm32 kernels can use a much slower implementation of AES than is actually available, potentially forcing vendors to disable encryption on their devices.] All the aes-bs (bit-sliced) and aes-ce (cryptographic extensions) algorithms had a priority of 300. This is undesirable because it means an aes-bs algorithm may be used when an aes-ce algorithm is available. The aes-ce algorithms have much better performance (up to 10x faster). Fix it by decreasing the priority of the aes-bs algorithms to 250. This was fixed upstream by commit cc477bf64573 ("crypto: arm/aes - replace bit-sliced OpenSSL NEON code"), but it was just a small part of a complete rewrite. This patch just fixes the priority bug for older kernels. Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
1 parent e455048 commit 9777846

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/arm/crypto/aesbs-glue.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static struct crypto_alg aesbs_algs[] = { {
357357
}, {
358358
.cra_name = "cbc(aes)",
359359
.cra_driver_name = "cbc-aes-neonbs",
360-
.cra_priority = 300,
360+
.cra_priority = 250,
361361
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER|CRYPTO_ALG_ASYNC,
362362
.cra_blocksize = AES_BLOCK_SIZE,
363363
.cra_ctxsize = sizeof(struct async_helper_ctx),
@@ -377,7 +377,7 @@ static struct crypto_alg aesbs_algs[] = { {
377377
}, {
378378
.cra_name = "ctr(aes)",
379379
.cra_driver_name = "ctr-aes-neonbs",
380-
.cra_priority = 300,
380+
.cra_priority = 250,
381381
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER|CRYPTO_ALG_ASYNC,
382382
.cra_blocksize = 1,
383383
.cra_ctxsize = sizeof(struct async_helper_ctx),
@@ -397,7 +397,7 @@ static struct crypto_alg aesbs_algs[] = { {
397397
}, {
398398
.cra_name = "xts(aes)",
399399
.cra_driver_name = "xts-aes-neonbs",
400-
.cra_priority = 300,
400+
.cra_priority = 250,
401401
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER|CRYPTO_ALG_ASYNC,
402402
.cra_blocksize = AES_BLOCK_SIZE,
403403
.cra_ctxsize = sizeof(struct async_helper_ctx),

0 commit comments

Comments
 (0)