diff options
author | Nathan Huckleberry <nhuck@google.com> | 2022-05-20 18:14:59 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-06-10 16:40:17 +0800 |
commit | 34f7f6c3011276313383099156be287ac745bcea (patch) | |
tree | 54cceaf783df3b379afd1b6c52a699c5ed8301c4 /include/crypto | |
parent | c0eb7591c1ed9cbdb0ad796bb56aed13748b55fa (diff) | |
download | linux-stable-34f7f6c3011276313383099156be287ac745bcea.tar.gz linux-stable-34f7f6c3011276313383099156be287ac745bcea.tar.bz2 linux-stable-34f7f6c3011276313383099156be287ac745bcea.zip |
crypto: x86/polyval - Add PCLMULQDQ accelerated implementation of POLYVAL
Add hardware accelerated version of POLYVAL for x86-64 CPUs with
PCLMULQDQ support.
This implementation is accelerated using PCLMULQDQ instructions to
perform the finite field computations. For added efficiency, 8 blocks
of the message are processed simultaneously by precomputing the first
8 powers of the key.
Schoolbook multiplication is used instead of Karatsuba multiplication
because it was found to be slightly faster on x86-64 machines.
Montgomery reduction must be used instead of Barrett reduction due to
the difference in modulus between POLYVAL's field and other finite
fields.
More information on POLYVAL can be found in the HCTR2 paper:
"Length-preserving encryption with HCTR2":
https://eprint.iacr.org/2021/1441.pdf
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r-- | include/crypto/polyval.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/crypto/polyval.h b/include/crypto/polyval.h index b14c38aa9166..1d630f371f77 100644 --- a/include/crypto/polyval.h +++ b/include/crypto/polyval.h @@ -14,4 +14,9 @@ #define POLYVAL_BLOCK_SIZE 16 #define POLYVAL_DIGEST_SIZE 16 +void polyval_mul_non4k(u8 *op1, const u8 *op2); + +void polyval_update_non4k(const u8 *key, const u8 *in, + size_t nblocks, u8 *accumulator); + #endif |