Skip to content

Commit 63fcc76

Browse files
author
Eric Biggers
committed
lib/crypto: arm64/chacha: Remove obsolete chunking logic
Since commit aefbab8 ("arm64: fpsimd: Preserve/restore kernel mode NEON at context switch"), kernel-mode NEON sections have been preemptible on arm64. And since commit 7dadeaa ("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>
1 parent 11d6bc7 commit 63fcc76

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

lib/crypto/arm64/chacha.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ asmlinkage void hchacha_block_neon(const struct chacha_state *state,
3636
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon);
3737

3838
static void chacha_doneon(struct chacha_state *state, u8 *dst, const u8 *src,
39-
int bytes, int nrounds)
39+
unsigned int bytes, int nrounds)
4040
{
41-
while (bytes > 0) {
41+
while (bytes) {
4242
int l = min(bytes, CHACHA_BLOCK_SIZE * 5);
4343

4444
if (l <= CHACHA_BLOCK_SIZE) {
@@ -76,16 +76,8 @@ static void chacha_crypt_arch(struct chacha_state *state, u8 *dst,
7676
!crypto_simd_usable())
7777
return chacha_crypt_generic(state, dst, src, bytes, nrounds);
7878

79-
do {
80-
unsigned int todo = min_t(unsigned int, bytes, SZ_4K);
81-
82-
scoped_ksimd()
83-
chacha_doneon(state, dst, src, todo, nrounds);
84-
85-
bytes -= todo;
86-
src += todo;
87-
dst += todo;
88-
} while (bytes);
79+
scoped_ksimd()
80+
chacha_doneon(state, dst, src, bytes, nrounds);
8981
}
9082

9183
#define chacha_mod_init_arch chacha_mod_init_arch

0 commit comments

Comments
 (0)