original_kernel/include/crypto
Jason A. Donenfeld 1c08a10436 crypto: poly1305 - add new 32 and 64-bit generic versions
These two C implementations from Zinc -- a 32x32 one and a 64x64 one,
depending on the platform -- come from Andrew Moon's public domain
poly1305-donna portable code, modified for usage in the kernel. The
precomputation in the 32-bit version and the use of 64x64 multiplies in
the 64-bit version make these perform better than the code it replaces.
Moon's code is also very widespread and has received many eyeballs of
scrutiny.

There's a bit of interference between the x86 implementation, which
relies on internal details of the old scalar implementation. In the next
commit, the x86 implementation will be replaced with a faster one that
doesn't rely on this, so none of this matters much. But for now, to keep
this passing the tests, we inline the bits of the old implementation
that the x86 implementation relied on. Also, since we now support a
slightly larger key space, via the union, some offsets had to be fixed
up.

Nonce calculation was folded in with the emit function, to take
advantage of 64x64 arithmetic. However, Adiantum appeared to rely on no
nonce handling in emit, so this path was conditionalized. We also
introduced a new struct, poly1305_core_key, to represent the precise
amount of space that particular implementation uses.

Testing with kbench9000, depending on the CPU, the update function for
the 32x32 version has been improved by 4%-7%, and for the 64x64 by
19%-30%. The 32x32 gains are small, but I think there's great value in
having a parallel implementation to the 64x64 one so that the two can be
compared side-by-side as nice stand-alone units.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-01-16 15:18:12 +08:00
..
internal crypto: poly1305 - add new 32 and 64-bit generic versions 2020-01-16 15:18:12 +08:00
acompress.h
aead.h crypto: aead - move crypto_aead_maxauthsize() to <crypto/aead.h> 2019-12-11 16:37:00 +08:00
aes.h
akcipher.h
algapi.h crypto: algapi - remove crypto_template::{alloc,free}() 2020-01-09 11:30:58 +08:00
arc4.h
asym_tpm_subtype.h
authenc.h
b128ops.h
blake2s.h
blowfish.h
cast5.h
cast6.h crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
cast_common.h
cbc.h
chacha.h
chacha20poly1305.h
cryptd.h
ctr.h
curve25519.h
des.h
dh.h
drbg.h
ecdh.h
engine.h
gcm.h
gf128mul.h
ghash.h
hash.h crypto: shash - Add init_tfm/exit_tfm and verify descsize 2019-12-11 16:48:39 +08:00
hash_info.h
hmac.h
if_alg.h
kpp.h
md5.h
nhpoly1305.h crypto: poly1305 - add new 32 and 64-bit generic versions 2020-01-16 15:18:12 +08:00
null.h
padlock.h
pcrypt.h
pkcs7.h
poly1305.h crypto: poly1305 - add new 32 and 64-bit generic versions 2020-01-16 15:18:12 +08:00
public_key.h
rng.h
scatterwalk.h
serpent.h
sha.h
sha1_base.h
sha3.h
sha256_base.h
sha512_base.h
skcipher.h crypto: skcipher - add crypto_skcipher_min_keysize() 2019-12-11 16:37:00 +08:00
sm3.h
sm3_base.h
sm4.h
streebog.h
twofish.h crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
xts.h crypto: remove CRYPTO_TFM_RES_WEAK_KEY 2020-01-09 11:30:53 +08:00