linux/crypto
Johannes Goetzfried 107778b592 crypto: twofish - add x86_64/avx assembler implementation
This patch adds a x86_64/avx assembler implementation of the Twofish block
cipher. The implementation processes eight blocks in parallel (two 4 block
chunk AVX operations). The table-lookups are done in general-purpose registers.
For small blocksizes the 3way-parallel functions from the twofish-x86_64-3way
module are called. A good performance increase is provided for blocksizes
greater or equal to 128B.

Patch has been tested with tcrypt and automated filesystem tests.

Tcrypt benchmark results:

Intel Core i5-2500 CPU (fam:6, model:42, step:7)

twofish-avx-x86_64 vs. twofish-x86_64-3way
128bit key:                                             (lrw:256bit)    (xts:256bit)
size    ecb-enc ecb-dec cbc-enc cbc-dec ctr-enc ctr-dec lrw-enc lrw-dec xts-enc xts-dec
16B     0.96x   0.97x   1.00x   0.95x   0.97x   0.97x   0.96x   0.95x   0.95x   0.98x
64B     0.99x   0.99x   1.00x   0.99x   0.98x   0.98x   0.99x   0.98x   0.99x   0.98x
256B    1.20x   1.21x   1.00x   1.19x   1.15x   1.14x   1.19x   1.20x   1.18x   1.19x
1024B   1.29x   1.30x   1.00x   1.28x   1.23x   1.24x   1.26x   1.28x   1.26x   1.27x
8192B   1.31x   1.32x   1.00x   1.31x   1.25x   1.25x   1.28x   1.29x   1.28x   1.30x

256bit key:                                             (lrw:384bit)    (xts:512bit)
size    ecb-enc ecb-dec cbc-enc cbc-dec ctr-enc ctr-dec lrw-enc lrw-dec xts-enc xts-dec
16B     0.96x   0.96x   1.00x   0.96x   0.97x   0.98x   0.95x   0.95x   0.95x   0.96x
64B     1.00x   0.99x   1.00x   0.98x   0.98x   1.01x   0.98x   0.98x   0.98x   0.98x
256B    1.20x   1.21x   1.00x   1.21x   1.15x   1.15x   1.19x   1.20x   1.18x   1.19x
1024B   1.29x   1.30x   1.00x   1.28x   1.23x   1.23x   1.26x   1.27x   1.26x   1.27x
8192B   1.31x   1.33x   1.00x   1.31x   1.26x   1.26x   1.29x   1.29x   1.28x   1.30x

twofish-avx-x86_64 vs aes-asm (8kB block):
         128bit  256bit
ecb-enc  1.19x   1.63x
ecb-dec  1.18x   1.62x
cbc-enc  0.75x   1.03x
cbc-dec  1.23x   1.67x
ctr-enc  1.24x   1.65x
ctr-dec  1.24x   1.65x
lrw-enc  1.15x   1.53x
lrw-dec  1.14x   1.52x
xts-enc  1.16x   1.56x
xts-dec  1.16x   1.56x

Signed-off-by: Johannes Goetzfried <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2012-06-12 16:46:07 +08:00
..
async_tx crypto: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:16 +08:00
Kconfig crypto: twofish - add x86_64/avx assembler implementation 2012-06-12 16:46:07 +08:00
Makefile crypto: camellia - rename camellia.c to camellia_generic.c 2012-03-14 17:25:55 +08:00
ablkcipher.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-04-10 14:30:45 -04:00
aead.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-04-10 14:30:45 -04:00
aes_generic.c
af_alg.c
ahash.c crypto: Stop using NLA_PUT*(). 2012-04-02 04:33:42 -04:00
algapi.c crypto: Add bulk algorithm registration interface 2012-01-26 13:35:49 +11:00
algboss.c
algif_hash.c
algif_skcipher.c
ansi_cprng.c crypto: ansi_cprng - enforce key != seed in fips mode 2011-11-09 12:04:06 +08:00
anubis.c
api.c
arc4.c
authenc.c
authencesn.c
blkcipher.c crypto: Stop using NLA_PUT*(). 2012-04-02 04:33:42 -04:00
blowfish_common.c
blowfish_generic.c
camellia_generic.c crypto: camellia - rename camellia.c to camellia_generic.c 2012-03-14 17:25:55 +08:00
cast5.c
cast6.c
cbc.c
ccm.c crypto: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:16 +08:00
chainiv.c
cipher.c
compress.c
crc32c.c crypto: crc32c should use library implementation 2012-03-23 16:58:38 -07:00
cryptd.c
crypto_null.c
crypto_user.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-04-10 14:30:45 -04:00
crypto_wq.c
ctr.c
cts.c
deflate.c
des_generic.c
ecb.c
eseqiv.c
fcrypt.c
fips.c
gcm.c
gf128mul.c
ghash-generic.c
hmac.c
internal.h
khazad.c
krng.c
lrw.c crypto: lrw - add interface for parallelized cipher implementions 2011-11-09 11:50:31 +08:00
lzo.c
md4.c
md5.c
michael_mic.c
pcbc.c
pcompress.c crypto: Stop using NLA_PUT*(). 2012-04-02 04:33:42 -04:00
pcrypt.c crypto: pcrypt - Use the online cpumask as the default 2012-03-29 19:52:47 +08:00
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c crypto: Stop using NLA_PUT*(). 2012-04-02 04:33:42 -04:00
salsa20_generic.c
scatterwalk.c crypto: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:16 +08:00
seed.c
seqiv.c
serpent_generic.c crypto: serpent - rename serpent.c to serpent_generic.c 2011-11-30 16:12:44 +08:00
sha1_generic.c
sha256_generic.c
sha512_generic.c crypto: sha512 - Fix byte counter overflow in SHA-512 2012-04-05 20:34:20 +08:00
shash.c crypto: Stop using NLA_PUT*(). 2012-04-02 04:33:42 -04:00
tcrypt.c crypto: twofish - add x86_64/avx assembler implementation 2012-06-12 16:46:07 +08:00
tcrypt.h crypto: tcrypt - add xts(serpent) tests 2011-11-09 11:57:56 +08:00
tea.c
testmgr.c crypto: twofish - add x86_64/avx assembler implementation 2012-06-12 16:46:07 +08:00
testmgr.h crypto: testmgr - Add new test cases for Blackfin CRC crypto driver 2012-06-12 16:37:17 +08:00
tgr192.c
twofish_common.c crypto: twofish-x86_64-3way - add lrw support 2011-11-09 11:53:32 +08:00
twofish_generic.c
vmac.c
wp512.c
xcbc.c
xor.c md updates for 3.5 2012-05-23 17:08:40 -07:00
xts.c crypto: xts: add interface for parallelized cipher implementations 2011-11-09 11:56:06 +08:00
zlib.c