summaryrefslogtreecommitdiff
path: root/lib/crypto/x86/blake2s.h
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2025-10-17 21:30:59 -0700
committerEric Biggers <ebiggers@kernel.org>2025-10-29 22:04:24 -0700
commit5385bcbffe5a76a74d6bb135af1c88fb235f8134 (patch)
tree7d566184060e8a336d415eaff6f3cd84a13c6195 /lib/crypto/x86/blake2s.h
parent5e0ec8e46d4d6488242bb39a4ce5c0276afa5f32 (diff)
lib/crypto: blake2s: Drop excessive const & rename block => data
A couple more small cleanups to the BLAKE2s code before these things get propagated into the BLAKE2b code: - Drop 'const' from some non-pointer function parameters. It was a bit excessive and not conventional. - Rename 'block' argument of blake2s_compress*() to 'data'. This is for consistency with the SHA-* code, and also to avoid the implication that it points to a singular "block". No functional changes. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20251018043106.375964-4-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'lib/crypto/x86/blake2s.h')
-rw-r--r--lib/crypto/x86/blake2s.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/crypto/x86/blake2s.h b/lib/crypto/x86/blake2s.h
index de360935b820..f8eed6cb042e 100644
--- a/lib/crypto/x86/blake2s.h
+++ b/lib/crypto/x86/blake2s.h
@@ -12,23 +12,21 @@
#include <linux/sizes.h>
asmlinkage void blake2s_compress_ssse3(struct blake2s_ctx *ctx,
- const u8 *block, const size_t nblocks,
- const u32 inc);
+ const u8 *data, size_t nblocks, u32 inc);
asmlinkage void blake2s_compress_avx512(struct blake2s_ctx *ctx,
- const u8 *block, const size_t nblocks,
- const u32 inc);
+ const u8 *data, size_t nblocks, u32 inc);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(blake2s_use_ssse3);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(blake2s_use_avx512);
-static void blake2s_compress(struct blake2s_ctx *ctx, const u8 *block,
- size_t nblocks, const u32 inc)
+static void blake2s_compress(struct blake2s_ctx *ctx,
+ const u8 *data, size_t nblocks, u32 inc)
{
/* SIMD disables preemption, so relax after processing each page. */
BUILD_BUG_ON(SZ_4K / BLAKE2S_BLOCK_SIZE < 8);
if (!static_branch_likely(&blake2s_use_ssse3) || !may_use_simd()) {
- blake2s_compress_generic(ctx, block, nblocks, inc);
+ blake2s_compress_generic(ctx, data, nblocks, inc);
return;
}
@@ -38,13 +36,13 @@ static void blake2s_compress(struct blake2s_ctx *ctx, const u8 *block,
kernel_fpu_begin();
if (static_branch_likely(&blake2s_use_avx512))
- blake2s_compress_avx512(ctx, block, blocks, inc);
+ blake2s_compress_avx512(ctx, data, blocks, inc);
else
- blake2s_compress_ssse3(ctx, block, blocks, inc);
+ blake2s_compress_ssse3(ctx, data, blocks, inc);
kernel_fpu_end();
+ data += blocks * BLAKE2S_BLOCK_SIZE;
nblocks -= blocks;
- block += blocks * BLAKE2S_BLOCK_SIZE;
} while (nblocks);
}