summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2026-04-01 03:05:41 +0300
committerEric Biggers <ebiggers@kernel.org>2026-04-01 23:02:09 +0300
commit63fcc765e1a30b7e04d395d7adc440443ae00338 (patch)
tree2d1330d21f49acba24c850095eca6b7ecb3be172 /lib
parent11d6bc70fff310cf0c4bbfa740144b0e350cd706 (diff)
downloadlinux-63fcc765e1a30b7e04d395d7adc440443ae00338.tar.xz
lib/crypto: arm64/chacha: Remove obsolete chunking logic
Since commit aefbab8e77eb ("arm64: fpsimd: Preserve/restore kernel mode NEON at context switch"), kernel-mode NEON sections have been preemptible on arm64. And since commit 7dadeaa6e851 ("sched: Further restrict the preemption modes"), voluntary preemption is no longer supported on arm64 either. Therefore, there's no longer any need to limit the length of kernel-mode NEON sections on arm64. Simplify the ChaCha code accordingly. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20260401000548.133151-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto/arm64/chacha.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/crypto/arm64/chacha.h b/lib/crypto/arm64/chacha.h
index ca8c6a8b0578..c6f8ddf98e2d 100644
--- a/lib/crypto/arm64/chacha.h
+++ b/lib/crypto/arm64/chacha.h
@@ -36,9 +36,9 @@ asmlinkage void hchacha_block_neon(const struct chacha_state *state,
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon);
static void chacha_doneon(struct chacha_state *state, u8 *dst, const u8 *src,
- int bytes, int nrounds)
+ unsigned int bytes, int nrounds)
{
- while (bytes > 0) {
+ while (bytes) {
int l = min(bytes, CHACHA_BLOCK_SIZE * 5);
if (l <= CHACHA_BLOCK_SIZE) {
@@ -76,16 +76,8 @@ static void chacha_crypt_arch(struct chacha_state *state, u8 *dst,
!crypto_simd_usable())
return chacha_crypt_generic(state, dst, src, bytes, nrounds);
- do {
- unsigned int todo = min_t(unsigned int, bytes, SZ_4K);
-
- scoped_ksimd()
- chacha_doneon(state, dst, src, todo, nrounds);
-
- bytes -= todo;
- src += todo;
- dst += todo;
- } while (bytes);
+ scoped_ksimd()
+ chacha_doneon(state, dst, src, bytes, nrounds);
}
#define chacha_mod_init_arch chacha_mod_init_arch