Skip to content

Commit 7116418

Browse files
author
Eric Biggers
committed
lib/crypto: arm64/sha512: 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 SHA-512 code accordingly. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20260401000548.133151-8-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent fe1233c commit 7116418

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

lib/crypto/arm64/sha512-ce-core.S

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@
9393
.endm
9494

9595
/*
96-
* size_t __sha512_ce_transform(struct sha512_block_state *state,
97-
* const u8 *data, size_t nblocks);
96+
* void sha512_ce_transform(struct sha512_block_state *state,
97+
* const u8 *data, size_t nblocks);
9898
*/
9999
.text
100-
SYM_FUNC_START(__sha512_ce_transform)
100+
SYM_FUNC_START(sha512_ce_transform)
101101
/* load state */
102102
ld1 {v8.2d-v11.2d}, [x0]
103103

@@ -186,12 +186,10 @@ CPU_LE( rev64 v19.16b, v19.16b )
186186
add v10.2d, v10.2d, v2.2d
187187
add v11.2d, v11.2d, v3.2d
188188

189-
cond_yield 3f, x4, x5
190189
/* handled all input blocks? */
191190
cbnz x2, 0b
192191

193192
/* store new state */
194-
3: st1 {v8.2d-v11.2d}, [x0]
195-
mov x0, x2
193+
st1 {v8.2d-v11.2d}, [x0]
196194
ret
197-
SYM_FUNC_END(__sha512_ce_transform)
195+
SYM_FUNC_END(sha512_ce_transform)

lib/crypto/arm64/sha512.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,16 @@ static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_sha512_insns);
1212

1313
asmlinkage void sha512_block_data_order(struct sha512_block_state *state,
1414
const u8 *data, size_t nblocks);
15-
asmlinkage size_t __sha512_ce_transform(struct sha512_block_state *state,
16-
const u8 *data, size_t nblocks);
15+
asmlinkage void sha512_ce_transform(struct sha512_block_state *state,
16+
const u8 *data, size_t nblocks);
1717

1818
static void sha512_blocks(struct sha512_block_state *state,
1919
const u8 *data, size_t nblocks)
2020
{
2121
if (static_branch_likely(&have_sha512_insns) &&
2222
likely(may_use_simd())) {
23-
do {
24-
size_t rem;
25-
26-
scoped_ksimd()
27-
rem = __sha512_ce_transform(state, data, nblocks);
28-
29-
data += (nblocks - rem) * SHA512_BLOCK_SIZE;
30-
nblocks = rem;
31-
} while (nblocks);
23+
scoped_ksimd()
24+
sha512_ce_transform(state, data, nblocks);
3225
} else {
3326
sha512_block_data_order(state, data, nblocks);
3427
}

0 commit comments

Comments
 (0)