aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2013-04-13 06:46:55 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2013-04-25 09:09:07 -0400
commit56d76c96a9f3e39ab733c5643b3ce5a1d4be242a (patch)
tree7922fedc46cba8320671d4eefebf7a4f27adcc77 /crypto
parentcf1521a1a5e21fd1e79a458605c4282fbfbbeee2 (diff)
crypto: serpent - add AVX2/x86_64 assembler implementation of serpent cipher
Patch adds AVX2/x86-64 implementation of Serpent cipher, requiring 16 parallel blocks for input (256 bytes). Implementation is based on the AVX implementation and extends to use the 256-bit wide YMM registers. Since serpent does not use table look-ups, this implementation should be close to two times faster than 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/Kconfig23
-rw-r--r--crypto/testmgr.c15
2 files changed, 38 insertions, 0 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 1ba48ddd4da1..9ad3d78c1075 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1131,6 +1131,29 @@ config CRYPTO_SERPENT_AVX_X86_64
1131 See also: 1131 See also:
1132 <http://www.cl.cam.ac.uk/~rja14/serpent.html> 1132 <http://www.cl.cam.ac.uk/~rja14/serpent.html>
1133 1133
1134config CRYPTO_SERPENT_AVX2_X86_64
1135 tristate "Serpent cipher algorithm (x86_64/AVX2)"
1136 depends on X86 && 64BIT
1137 select CRYPTO_ALGAPI
1138 select CRYPTO_CRYPTD
1139 select CRYPTO_ABLK_HELPER_X86
1140 select CRYPTO_GLUE_HELPER_X86
1141 select CRYPTO_SERPENT
1142 select CRYPTO_SERPENT_AVX_X86_64
1143 select CRYPTO_LRW
1144 select CRYPTO_XTS
1145 help
1146 Serpent cipher algorithm, by Anderson, Biham & Knudsen.
1147
1148 Keys are allowed to be from 0 to 256 bits in length, in steps
1149 of 8 bits.
1150
1151 This module provides Serpent cipher algorithm that processes 16
1152 blocks parallel using AVX2 instruction set.
1153
1154 See also:
1155 <http://www.cl.cam.ac.uk/~rja14/serpent.html>
1156
1134config CRYPTO_TEA 1157config CRYPTO_TEA
1135 tristate "TEA, XTEA and XETA cipher algorithms" 1158 tristate "TEA, XTEA and XETA cipher algorithms"
1136 select CRYPTO_ALGAPI 1159 select CRYPTO_ALGAPI
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index fea7841dd6f3..f5e13dea8cc9 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1645,6 +1645,9 @@ static const struct alg_test_desc alg_test_descs[] = {
1645 .alg = "__cbc-serpent-avx", 1645 .alg = "__cbc-serpent-avx",
1646 .test = alg_test_null, 1646 .test = alg_test_null,
1647 }, { 1647 }, {
1648 .alg = "__cbc-serpent-avx2",
1649 .test = alg_test_null,
1650 }, {
1648 .alg = "__cbc-serpent-sse2", 1651 .alg = "__cbc-serpent-sse2",
1649 .test = alg_test_null, 1652 .test = alg_test_null,
1650 }, { 1653 }, {
@@ -1673,6 +1676,9 @@ static const struct alg_test_desc alg_test_descs[] = {
1673 .alg = "__driver-cbc-serpent-avx", 1676 .alg = "__driver-cbc-serpent-avx",
1674 .test = alg_test_null, 1677 .test = alg_test_null,
1675 }, { 1678 }, {
1679 .alg = "__driver-cbc-serpent-avx2",
1680 .test = alg_test_null,
1681 }, {
1676 .alg = "__driver-cbc-serpent-sse2", 1682 .alg = "__driver-cbc-serpent-sse2",
1677 .test = alg_test_null, 1683 .test = alg_test_null,
1678 }, { 1684 }, {
@@ -1701,6 +1707,9 @@ static const struct alg_test_desc alg_test_descs[] = {
1701 .alg = "__driver-ecb-serpent-avx", 1707 .alg = "__driver-ecb-serpent-avx",
1702 .test = alg_test_null, 1708 .test = alg_test_null,
1703 }, { 1709 }, {
1710 .alg = "__driver-ecb-serpent-avx2",
1711 .test = alg_test_null,
1712 }, {
1704 .alg = "__driver-ecb-serpent-sse2", 1713 .alg = "__driver-ecb-serpent-sse2",
1705 .test = alg_test_null, 1714 .test = alg_test_null,
1706 }, { 1715 }, {
@@ -1969,6 +1978,9 @@ static const struct alg_test_desc alg_test_descs[] = {
1969 .alg = "cryptd(__driver-cbc-camellia-aesni)", 1978 .alg = "cryptd(__driver-cbc-camellia-aesni)",
1970 .test = alg_test_null, 1979 .test = alg_test_null,
1971 }, { 1980 }, {
1981 .alg = "cryptd(__driver-cbc-serpent-avx2)",
1982 .test = alg_test_null,
1983 }, {
1972 .alg = "cryptd(__driver-ecb-aes-aesni)", 1984 .alg = "cryptd(__driver-ecb-aes-aesni)",
1973 .test = alg_test_null, 1985 .test = alg_test_null,
1974 .fips_allowed = 1, 1986 .fips_allowed = 1,
@@ -1988,6 +2000,9 @@ static const struct alg_test_desc alg_test_descs[] = {
1988 .alg = "cryptd(__driver-ecb-serpent-avx)", 2000 .alg = "cryptd(__driver-ecb-serpent-avx)",
1989 .test = alg_test_null, 2001 .test = alg_test_null,
1990 }, { 2002 }, {
2003 .alg = "cryptd(__driver-ecb-serpent-avx2)",
2004 .test = alg_test_null,
2005 }, {
1991 .alg = "cryptd(__driver-ecb-serpent-sse2)", 2006 .alg = "cryptd(__driver-ecb-serpent-sse2)",
1992 .test = alg_test_null, 2007 .test = alg_test_null,
1993 }, { 2008 }, {