summaryrefslogtreecommitdiff
path: root/lib/crypto/x86
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2026-03-18 23:17:03 -0700
committerEric Biggers <ebiggers@kernel.org>2026-03-23 13:15:13 -0700
commitb3b6e8f9b38911e9b30a5abe845541ade0797327 (patch)
tree5df620d67e2a820b1c9eb2847967ae64753d061a /lib/crypto/x86
parent61f66c5216a961784b12307be60a25204525605c (diff)
downloadlwn-b3b6e8f9b38911e9b30a5abe845541ade0797327.tar.gz
lwn-b3b6e8f9b38911e9b30a5abe845541ade0797327.zip
lib/crypto: gf128hash: Support GF128HASH_ARCH without all POLYVAL functions
Currently, some architectures (arm64 and x86) have optimized code for both GHASH and POLYVAL. Others (arm, powerpc, riscv, and s390) have optimized code only for GHASH. While POLYVAL support could be implemented on these other architectures, until then we need to support the case where arch-optimized functions are present only for GHASH. Therefore, update the support for arch-optimized POLYVAL functions to allow architectures to opt into supporting these functions individually. The new meaning of CONFIG_CRYPTO_LIB_GF128HASH_ARCH is that some level of GHASH and/or POLYVAL acceleration is provided. Also provide an implementation of polyval_mul() based on polyval_blocks_arch(), for when polyval_mul_arch() isn't implemented. Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20260319061723.1140720-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'lib/crypto/x86')
-rw-r--r--lib/crypto/x86/gf128hash.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/crypto/x86/gf128hash.h b/lib/crypto/x86/gf128hash.h
index fe506cf6431b..adf6147ea677 100644
--- a/lib/crypto/x86/gf128hash.h
+++ b/lib/crypto/x86/gf128hash.h
@@ -17,6 +17,7 @@ asmlinkage void polyval_blocks_pclmul_avx(struct polyval_elem *acc,
const struct polyval_key *key,
const u8 *data, size_t nblocks);
+#define polyval_preparekey_arch polyval_preparekey_arch
static void polyval_preparekey_arch(struct polyval_key *key,
const u8 raw_key[POLYVAL_BLOCK_SIZE])
{
@@ -40,6 +41,7 @@ static void polyval_preparekey_arch(struct polyval_key *key,
}
}
+#define polyval_mul_arch polyval_mul_arch
static void polyval_mul_arch(struct polyval_elem *acc,
const struct polyval_key *key)
{
@@ -52,6 +54,7 @@ static void polyval_mul_arch(struct polyval_elem *acc,
}
}
+#define polyval_blocks_arch polyval_blocks_arch
static void polyval_blocks_arch(struct polyval_elem *acc,
const struct polyval_key *key,
const u8 *data, size_t nblocks)