summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-03-18 15:50:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-03-18 15:50:29 -0700
commit1863b4055b7902de43a1dcc7396805eb631682e5 (patch)
tree7ea64ca6855fa0add866b3916e966b62f4796a60 /arch
parent8a30aeb0d1b4e4aaf7f7bae72f20f2ae75385ccb (diff)
parentd5b66179b0e27c14a9033c4356937506577485e3 (diff)
Merge tag 'libcrypto-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux
Pull crypto library fixes from Eric Biggers: - Disable the "padlock" SHA-1 and SHA-256 driver on Zhaoxin processors, since it does not compute hash values correctly - Make a generated file be removed by 'make clean' - Fix excessive stack usage in some of the arm64 AES code * tag 'libcrypto-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux: lib/crypto: powerpc: Add powerpc/aesp8-ppc.S to clean-files crypto: padlock-sha - Disable for Zhaoxin processor crypto: arm64/aes-neonbs - Move key expansion off the stack
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/crypto/aes-neonbs-glue.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/arch/arm64/crypto/aes-neonbs-glue.c b/arch/arm64/crypto/aes-neonbs-glue.c
index cb87c8fc66b3..00530b291010 100644
--- a/arch/arm64/crypto/aes-neonbs-glue.c
+++ b/arch/arm64/crypto/aes-neonbs-glue.c
@@ -76,19 +76,24 @@ static int aesbs_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
unsigned int key_len)
{
struct aesbs_ctx *ctx = crypto_skcipher_ctx(tfm);
- struct crypto_aes_ctx rk;
+ struct crypto_aes_ctx *rk;
int err;
- err = aes_expandkey(&rk, in_key, key_len);
+ rk = kmalloc(sizeof(*rk), GFP_KERNEL);
+ if (!rk)
+ return -ENOMEM;
+
+ err = aes_expandkey(rk, in_key, key_len);
if (err)
- return err;
+ goto out;
ctx->rounds = 6 + key_len / 4;
scoped_ksimd()
- aesbs_convert_key(ctx->rk, rk.key_enc, ctx->rounds);
-
- return 0;
+ aesbs_convert_key(ctx->rk, rk->key_enc, ctx->rounds);
+out:
+ kfree_sensitive(rk);
+ return err;
}
static int __ecb_crypt(struct skcipher_request *req,
@@ -133,22 +138,26 @@ static int aesbs_cbc_ctr_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
unsigned int key_len)
{
struct aesbs_cbc_ctr_ctx *ctx = crypto_skcipher_ctx(tfm);
- struct crypto_aes_ctx rk;
+ struct crypto_aes_ctx *rk;
int err;
- err = aes_expandkey(&rk, in_key, key_len);
+ rk = kmalloc(sizeof(*rk), GFP_KERNEL);
+ if (!rk)
+ return -ENOMEM;
+
+ err = aes_expandkey(rk, in_key, key_len);
if (err)
- return err;
+ goto out;
ctx->key.rounds = 6 + key_len / 4;
- memcpy(ctx->enc, rk.key_enc, sizeof(ctx->enc));
+ memcpy(ctx->enc, rk->key_enc, sizeof(ctx->enc));
scoped_ksimd()
- aesbs_convert_key(ctx->key.rk, rk.key_enc, ctx->key.rounds);
- memzero_explicit(&rk, sizeof(rk));
-
- return 0;
+ aesbs_convert_key(ctx->key.rk, rk->key_enc, ctx->key.rounds);
+out:
+ kfree_sensitive(rk);
+ return err;
}
static int cbc_encrypt(struct skcipher_request *req)