diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-04-13 06:46:50 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-04-25 09:09:05 -0400 |
commit | cf1521a1a5e21fd1e79a458605c4282fbfbbeee2 (patch) | |
tree | a7c1fb6d047c75170ddadd0dffe40055167e9c02 /crypto | |
parent | 604880107010a1e5794552d184cd5471ea31b973 (diff) |
crypto: twofish - add AVX2/x86_64 assembler implementation of twofish cipher
Patch adds AVX2/x86-64 implementation of Twofish cipher, requiring 16 parallel
blocks for input (256 bytes). Table look-ups are performed using vpgatherdd
instruction directly from vector registers and thus should be faster than
earlier implementations. Implementation also uses 256-bit wide YMM registers,
which should give additional speed up compared to the AVX implementation.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/Kconfig | 24 | ||||
-rw-r--r-- | crypto/testmgr.c | 12 |
2 files changed, 36 insertions, 0 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index 6b9564f91168..1ba48ddd4da1 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -1250,6 +1250,30 @@ config CRYPTO_TWOFISH_AVX_X86_64 | |||
1250 | See also: | 1250 | See also: |
1251 | <http://www.schneier.com/twofish.html> | 1251 | <http://www.schneier.com/twofish.html> |
1252 | 1252 | ||
1253 | config CRYPTO_TWOFISH_AVX2_X86_64 | ||
1254 | tristate "Twofish cipher algorithm (x86_64/AVX2)" | ||
1255 | depends on X86 && 64BIT | ||
1256 | select CRYPTO_ALGAPI | ||
1257 | select CRYPTO_CRYPTD | ||
1258 | select CRYPTO_ABLK_HELPER_X86 | ||
1259 | select CRYPTO_GLUE_HELPER_X86 | ||
1260 | select CRYPTO_TWOFISH_COMMON | ||
1261 | select CRYPTO_TWOFISH_X86_64 | ||
1262 | select CRYPTO_TWOFISH_X86_64_3WAY | ||
1263 | select CRYPTO_TWOFISH_AVX_X86_64 | ||
1264 | select CRYPTO_LRW | ||
1265 | select CRYPTO_XTS | ||
1266 | help | ||
1267 | Twofish cipher algorithm (x86_64/AVX2). | ||
1268 | |||
1269 | Twofish was submitted as an AES (Advanced Encryption Standard) | ||
1270 | candidate cipher by researchers at CounterPane Systems. It is a | ||
1271 | 16 round block cipher supporting key sizes of 128, 192, and 256 | ||
1272 | bits. | ||
1273 | |||
1274 | See also: | ||
1275 | <http://www.schneier.com/twofish.html> | ||
1276 | |||
1253 | comment "Compression" | 1277 | comment "Compression" |
1254 | 1278 | ||
1255 | config CRYPTO_DEFLATE | 1279 | config CRYPTO_DEFLATE |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index f3effb42531e..fea7841dd6f3 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -1651,6 +1651,9 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1651 | .alg = "__cbc-twofish-avx", | 1651 | .alg = "__cbc-twofish-avx", |
1652 | .test = alg_test_null, | 1652 | .test = alg_test_null, |
1653 | }, { | 1653 | }, { |
1654 | .alg = "__cbc-twofish-avx2", | ||
1655 | .test = alg_test_null, | ||
1656 | }, { | ||
1654 | .alg = "__driver-cbc-aes-aesni", | 1657 | .alg = "__driver-cbc-aes-aesni", |
1655 | .test = alg_test_null, | 1658 | .test = alg_test_null, |
1656 | .fips_allowed = 1, | 1659 | .fips_allowed = 1, |
@@ -1676,6 +1679,9 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1676 | .alg = "__driver-cbc-twofish-avx", | 1679 | .alg = "__driver-cbc-twofish-avx", |
1677 | .test = alg_test_null, | 1680 | .test = alg_test_null, |
1678 | }, { | 1681 | }, { |
1682 | .alg = "__driver-cbc-twofish-avx2", | ||
1683 | .test = alg_test_null, | ||
1684 | }, { | ||
1679 | .alg = "__driver-ecb-aes-aesni", | 1685 | .alg = "__driver-ecb-aes-aesni", |
1680 | .test = alg_test_null, | 1686 | .test = alg_test_null, |
1681 | .fips_allowed = 1, | 1687 | .fips_allowed = 1, |
@@ -1701,6 +1707,9 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1701 | .alg = "__driver-ecb-twofish-avx", | 1707 | .alg = "__driver-ecb-twofish-avx", |
1702 | .test = alg_test_null, | 1708 | .test = alg_test_null, |
1703 | }, { | 1709 | }, { |
1710 | .alg = "__driver-ecb-twofish-avx2", | ||
1711 | .test = alg_test_null, | ||
1712 | }, { | ||
1704 | .alg = "__ghash-pclmulqdqni", | 1713 | .alg = "__ghash-pclmulqdqni", |
1705 | .test = alg_test_null, | 1714 | .test = alg_test_null, |
1706 | .fips_allowed = 1, | 1715 | .fips_allowed = 1, |
@@ -1985,6 +1994,9 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1985 | .alg = "cryptd(__driver-ecb-twofish-avx)", | 1994 | .alg = "cryptd(__driver-ecb-twofish-avx)", |
1986 | .test = alg_test_null, | 1995 | .test = alg_test_null, |
1987 | }, { | 1996 | }, { |
1997 | .alg = "cryptd(__driver-ecb-twofish-avx2)", | ||
1998 | .test = alg_test_null, | ||
1999 | }, { | ||
1988 | .alg = "cryptd(__driver-gcm-aes-aesni)", | 2000 | .alg = "cryptd(__driver-gcm-aes-aesni)", |
1989 | .test = alg_test_null, | 2001 | .test = alg_test_null, |
1990 | .fips_allowed = 1, | 2002 | .fips_allowed = 1, |