linux/include/crypto
Ard Biesheuvel db91af0fbe crypto: algapi - make crypto_xor() and crypto_inc() alignment agnostic
Instead of unconditionally forcing 4 byte alignment for all generic
chaining modes that rely on crypto_xor() or crypto_inc() (which may
result in unnecessary copying of data when the underlying hardware
can perform unaligned accesses efficiently), make those functions
deal with unaligned input explicitly, but only if the Kconfig symbol
HAVE_EFFICIENT_UNALIGNED_ACCESS is set. This will allow us to drop
the alignmasks from the CBC, CMAC, CTR, CTS, PCBC and SEQIV drivers.

For crypto_inc(), this simply involves making the 4-byte stride
conditional on HAVE_EFFICIENT_UNALIGNED_ACCESS being set, given that
it typically operates on 16 byte buffers.

For crypto_xor(), an algorithm is implemented that simply runs through
the input using the largest strides possible if unaligned accesses are
allowed. If they are not, an optimal sequence of memory accesses is
emitted that takes the relative alignment of the input buffers into
account, e.g., if the relative misalignment of dst and src is 4 bytes,
the entire xor operation will be completed using 4 byte loads and stores
(modulo unaligned bits at the start and end). Note that all expressions
involving misalign are simply eliminated by the compiler when
HAVE_EFFICIENT_UNALIGNED_ACCESS is defined.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2017-02-11 17:52:28 +08:00
..
internal crypto: skcipher - introduce walksize attribute for SIMD algos 2016-12-30 19:52:47 +08:00
ablk_helper.h
acompress.h crypto: acomp - add driver-side scomp interface 2016-10-25 11:08:31 +08:00
aead.h crypto: doc - clarify AEAD memory structure 2016-12-13 16:38:06 -07:00
aes.h
akcipher.h
algapi.h crypto: algapi - make crypto_xor() and crypto_inc() alignment agnostic 2017-02-11 17:52:28 +08:00
authenc.h
b128ops.h
blowfish.h
cast5.h
cast6.h
cast_common.h
cbc.h crypto: cbc - Export CBC implementation 2016-11-28 21:23:21 +08:00
chacha20.h crypto: chacha20 - convert generic and x86 versions to skcipher 2016-12-27 17:47:31 +08:00
cryptd.h crypto: cryptd - Add support for skcipher 2016-11-28 21:23:18 +08:00
crypto_wq.h
ctr.h
des.h
dh.h crypto: doc - add KPP documentation 2016-12-13 16:38:06 -07:00
drbg.h crypto: drbg - prevent invalid SG mappings 2016-11-30 19:46:44 +08:00
ecdh.h crypto: doc - add KPP documentation 2016-12-13 16:38:06 -07:00
engine.h crypto: engine - Handle the kthread worker using the new API 2016-10-25 11:08:25 +08:00
gf128mul.h crypto: gf128mul - Zero memory when freeing multiplication table 2016-11-17 23:34:59 +08:00
ghash.h crypto: ghash-generic - move common definitions to a new header file 2016-10-02 22:26:40 +08:00
hash_info.h
hash.h crypto: doc - Fix hash export state information 2017-02-03 18:16:11 +08:00
if_alg.h
kpp.h crypto: doc - add KPP documentation 2016-12-13 16:38:06 -07:00
lrw.h
mcryptd.h crypto: sha1-mb - async implementation for sha1-mb 2016-06-23 18:29:55 +08:00
md5.h
null.h crypto: null - Remove default null blkcipher 2016-07-18 17:35:44 +08:00
padlock.h
pcrypt.h
pkcs7.h
poly1305.h
public_key.h
rng.h
scatterwalk.h crypto: scatterwalk - Inline start/map/done 2016-07-18 17:35:50 +08:00
serpent.h
sha1_base.h
sha3.h crypto: sha3 - Add SHA-3 hash algorithm 2016-06-20 19:25:01 +08:00
sha256_base.h
sha512_base.h
sha.h
skcipher.h crypto: skcipher - introduce walksize attribute for SIMD algos 2016-12-30 19:52:47 +08:00
twofish.h
vmac.h
xts.h crypto: xts - Convert to skcipher 2016-11-28 21:23:18 +08:00