[PATCH 3/9] lib/crypto: arm64/gf128hash: Remove obsolete chunking logic

Eric Biggers
2026-04-01T00:07:49Z

Simplify the GHASH and POLYVAL code accordingly.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
lib/crypto/arm64/gf128hash.h | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/lib/crypto/arm64/gf128hash.h b/lib/crypto/arm64/gf128hash.h
index b2c85585b758..1d1179f87f8d 100644
--- a/lib/crypto/arm64/gf128hash.h
+++ b/lib/crypto/arm64/gf128hash.h
@@ -87,20 +87,12 @@ static void polyval_mul_arch(struct polyval_elem *acc,
static void ghash_blocks_arch(struct polyval_elem *acc,
const struct ghash_key *key,
const u8 *data, size_t nblocks)
{
if (static_branch_likely(&have_asimd) && may_use_simd()) {
- do {
- /* Allow rescheduling every 4 KiB. */
- size_t n = min_t(size_t, nblocks,
- 4096 / GHASH_BLOCK_SIZE);
-
- scoped_ksimd()
- pmull_ghash_update_p8(n, acc, data, &key->h);
- data += n * GHASH_BLOCK_SIZE;
- nblocks -= n;
- } while (nblocks);
+ scoped_ksimd()
+ pmull_ghash_update_p8(nblocks, acc, data, &key->h);
} else {
ghash_blocks_generic(acc, &key->h, data, nblocks);
}
}

@@ -108,20 +100,12 @@ static void ghash_blocks_arch(struct polyval_elem *acc,
static void polyval_blocks_arch(struct polyval_elem *acc,
const struct polyval_key *key,
const u8 *data, size_t nblocks)
{
if (static_branch_likely(&have_pmull) && may_use_simd()) {
- do {
- /* Allow rescheduling every 4 KiB. */
- size_t n = min_t(size_t, nblocks,
- 4096 / POLYVAL_BLOCK_SIZE);
-
- scoped_ksimd()
- polyval_blocks_pmull(acc, key, data, n);
- data += n * POLYVAL_BLOCK_SIZE;
- nblocks -= n;
- } while (nblocks);
+ scoped_ksimd()
+ polyval_blocks_pmull(acc, key, data, nblocks);
} else {
polyval_blocks_generic(acc, &key->h_powers[NUM_H_POWERS - 1],
data, nblocks);
}
}
--
2.53.0