225 lines
9.1 KiB
Diff
225 lines
9.1 KiB
Diff
From 67d735aa5c6e4d048175700e89cb267d82db8d37 Mon Sep 17 00:00:00 2001
|
|
From: Vladislav Dronov <vdronov@redhat.com>
|
|
Date: Sun, 7 Jun 2026 23:27:48 +0200
|
|
Subject: [PATCH] crypto: tegra - Add missing CRYPTO_ALG_ASYNC
|
|
|
|
JIRA: https://redhat.atlassian.net/browse/RHEL-182565
|
|
Upstream Status: merged into the upstream linux.git
|
|
CVE: CVE-2026-31739
|
|
|
|
commit 4b56770d345524fc2acc143a2b85539cf7d74bc1
|
|
Author: Eric Biggers <ebiggers@kernel.org>
|
|
Date: Mon Mar 16 13:21:19 2026 -0700
|
|
|
|
crypto: tegra - Add missing CRYPTO_ALG_ASYNC
|
|
|
|
The tegra crypto driver failed to set the CRYPTO_ALG_ASYNC on its
|
|
asynchronous algorithms, causing the crypto API to select them for users
|
|
that request only synchronous algorithms. This causes crashes (at
|
|
least). Fix this by adding the flag like what the other drivers do.
|
|
Also remove the unnecessary CRYPTO_ALG_TYPE_* flags, since those just
|
|
get ignored and overridden by the registration function anyway.
|
|
|
|
Reported-by: Zorro Lang <zlang@redhat.com>
|
|
Closes: https://lore.kernel.org/r/20260314080937.pghb4aa7d4je3mhh@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com
|
|
Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
|
|
Cc: stable@vger.kernel.org
|
|
Cc: Akhil R <akhilrajeev@nvidia.com>
|
|
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
|
|
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
Signed-off-by: Vladislav Dronov <vdronov@redhat.com>
|
|
|
|
diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c
|
|
index 8b91f00b9c31..30c78afe3dea 100644
|
|
--- a/drivers/crypto/tegra/tegra-se-aes.c
|
|
+++ b/drivers/crypto/tegra/tegra-se-aes.c
|
|
@@ -532,7 +532,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
|
.cra_name = "cbc(aes)",
|
|
.cra_driver_name = "cbc-aes-tegra",
|
|
.cra_priority = 500,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_ASYNC,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = AES_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
|
.cra_alignmask = 0xf,
|
|
@@ -553,7 +553,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
|
.cra_name = "ecb(aes)",
|
|
.cra_driver_name = "ecb-aes-tegra",
|
|
.cra_priority = 500,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_ASYNC,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = AES_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
|
.cra_alignmask = 0xf,
|
|
@@ -575,7 +575,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
|
.cra_name = "ctr(aes)",
|
|
.cra_driver_name = "ctr-aes-tegra",
|
|
.cra_priority = 500,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_ASYNC,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = 1,
|
|
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
|
.cra_alignmask = 0xf,
|
|
@@ -597,6 +597,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
|
.cra_name = "xts(aes)",
|
|
.cra_driver_name = "xts-aes-tegra",
|
|
.cra_priority = 500,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = AES_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
|
.cra_alignmask = (__alignof__(u64) - 1),
|
|
@@ -1931,6 +1932,7 @@ static struct tegra_se_alg tegra_aead_algs[] = {
|
|
.cra_name = "gcm(aes)",
|
|
.cra_driver_name = "gcm-aes-tegra",
|
|
.cra_priority = 500,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = 1,
|
|
.cra_ctxsize = sizeof(struct tegra_aead_ctx),
|
|
.cra_alignmask = 0xf,
|
|
@@ -1953,6 +1955,7 @@ static struct tegra_se_alg tegra_aead_algs[] = {
|
|
.cra_name = "ccm(aes)",
|
|
.cra_driver_name = "ccm-aes-tegra",
|
|
.cra_priority = 500,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = 1,
|
|
.cra_ctxsize = sizeof(struct tegra_aead_ctx),
|
|
.cra_alignmask = 0xf,
|
|
@@ -1980,7 +1983,7 @@ static struct tegra_se_alg tegra_cmac_algs[] = {
|
|
.cra_name = "cmac(aes)",
|
|
.cra_driver_name = "tegra-se-cmac",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = AES_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_cmac_ctx),
|
|
.cra_alignmask = 0,
|
|
diff --git a/drivers/crypto/tegra/tegra-se-hash.c b/drivers/crypto/tegra/tegra-se-hash.c
|
|
index 79f1e5c9b729..23d549801612 100644
|
|
--- a/drivers/crypto/tegra/tegra-se-hash.c
|
|
+++ b/drivers/crypto/tegra/tegra-se-hash.c
|
|
@@ -764,7 +764,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha1",
|
|
.cra_driver_name = "tegra-se-sha1",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA1_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -789,7 +789,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha224",
|
|
.cra_driver_name = "tegra-se-sha224",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA224_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -814,7 +814,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha256",
|
|
.cra_driver_name = "tegra-se-sha256",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA256_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -839,7 +839,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha384",
|
|
.cra_driver_name = "tegra-se-sha384",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA384_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -864,7 +864,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha512",
|
|
.cra_driver_name = "tegra-se-sha512",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA512_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -889,7 +889,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha3-224",
|
|
.cra_driver_name = "tegra-se-sha3-224",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA3_224_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -914,7 +914,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha3-256",
|
|
.cra_driver_name = "tegra-se-sha3-256",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA3_256_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -939,7 +939,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha3-384",
|
|
.cra_driver_name = "tegra-se-sha3-384",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA3_384_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -964,7 +964,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "sha3-512",
|
|
.cra_driver_name = "tegra-se-sha3-512",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC,
|
|
.cra_blocksize = SHA3_512_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -991,7 +991,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "hmac(sha224)",
|
|
.cra_driver_name = "tegra-se-hmac-sha224",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
|
+ CRYPTO_ALG_NEED_FALLBACK,
|
|
.cra_blocksize = SHA224_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -1018,7 +1019,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "hmac(sha256)",
|
|
.cra_driver_name = "tegra-se-hmac-sha256",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
|
+ CRYPTO_ALG_NEED_FALLBACK,
|
|
.cra_blocksize = SHA256_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -1045,7 +1047,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "hmac(sha384)",
|
|
.cra_driver_name = "tegra-se-hmac-sha384",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
|
+ CRYPTO_ALG_NEED_FALLBACK,
|
|
.cra_blocksize = SHA384_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
@@ -1072,7 +1075,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
|
.cra_name = "hmac(sha512)",
|
|
.cra_driver_name = "tegra-se-hmac-sha512",
|
|
.cra_priority = 300,
|
|
- .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
|
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
|
+ CRYPTO_ALG_NEED_FALLBACK,
|
|
.cra_blocksize = SHA512_BLOCK_SIZE,
|
|
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
|
.cra_alignmask = 0,
|
|
--
|
|
2.50.1 (Apple Git-155)
|
|
|