summaryrefslogtreecommitdiffstats
path: root/arch/arm64/crypto/aes-neonbs-glue.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:43:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:43:27 +0000
commit2923512cee3cfb8eaf935324ddc8f6edd8263e93 (patch)
tree2cfe4d9883ebfd5ecede5f13892ee2d6e14c486e /arch/arm64/crypto/aes-neonbs-glue.c
parentAdding upstream version 6.7.7. (diff)
downloadlinux-2923512cee3cfb8eaf935324ddc8f6edd8263e93.tar.xz
linux-2923512cee3cfb8eaf935324ddc8f6edd8263e93.zip
Adding upstream version 6.7.9.upstream/6.7.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'arch/arm64/crypto/aes-neonbs-glue.c')
-rw-r--r--arch/arm64/crypto/aes-neonbs-glue.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm64/crypto/aes-neonbs-glue.c b/arch/arm64/crypto/aes-neonbs-glue.c
index bac4cabef..467ac2f76 100644
--- a/arch/arm64/crypto/aes-neonbs-glue.c
+++ b/arch/arm64/crypto/aes-neonbs-glue.c
@@ -227,8 +227,19 @@ static int ctr_encrypt(struct skcipher_request *req)
src += blocks * AES_BLOCK_SIZE;
}
if (nbytes && walk.nbytes == walk.total) {
+ u8 buf[AES_BLOCK_SIZE];
+ u8 *d = dst;
+
+ if (unlikely(nbytes < AES_BLOCK_SIZE))
+ src = dst = memcpy(buf + sizeof(buf) - nbytes,
+ src, nbytes);
+
neon_aes_ctr_encrypt(dst, src, ctx->enc, ctx->key.rounds,
nbytes, walk.iv);
+
+ if (unlikely(nbytes < AES_BLOCK_SIZE))
+ memcpy(d, dst, nbytes);
+
nbytes = 0;
}
kernel_neon_end();