aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2011-11-09 09:26:25 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2011-11-21 03:13:23 -0500
commit937c30d7f560210b0163035edd42b2aef78fed9e (patch)
treec47348474ca6cdda0a87c95f3a6831c732f27b4d /crypto
parentd19978f58745e586d9385d306d557e7c785abe23 (diff)
crypto: serpent - add 8-way parallel x86_64/SSE2 assembler implementation
Patch adds x86_64/SSE2 assembler implementation of serpent cipher. Assembler functions crypt data in eigth block chunks (two 4 block chunk SSE2 operations in parallel to improve performance on out-of-order CPUs). Glue code is based on one from AES-NI implementation, so requests from irq context are redirected to cryptd. v2: - add missing include of linux/module.h (appearently crypto.h used to include module.h, which changed for 3.2 by commit 7c926402a7e8c9b279968fd94efec8700ba3859e) Patch has been tested with tcrypt and automated filesystem tests. Tcrypt benchmarks results (serpent-sse2/serpent_generic speed ratios): AMD Phenom II 1055T (fam:16, model:10): size ecb-enc ecb-dec cbc-enc cbc-dec ctr-enc ctr-dec 16B 1.03x 1.01x 1.03x 1.05x 1.00x 0.99x 64B 1.00x 1.01x 1.02x 1.04x 1.02x 1.01x 256B 2.34x 2.41x 0.99x 2.43x 2.39x 2.40x 1024B 2.51x 2.57x 1.00x 2.59x 2.56x 2.56x 8192B 2.50x 2.54x 1.00x 2.55x 2.57x 2.57x Intel Celeron T1600 (fam:6, model:15, step:13): size ecb-enc ecb-dec cbc-enc cbc-dec ctr-enc ctr-dec 16B 0.97x 0.97x 1.01x 1.01x 1.01x 1.02x 64B 1.00x 1.00x 1.00x 1.02x 1.01x 1.01x 256B 3.41x 3.35x 1.00x 3.39x 3.42x 3.44x 1024B 3.75x 3.72x 0.99x 3.74x 3.75x 3.75x 8192B 3.70x 3.68x 0.99x 3.68x 3.69x 3.69x Full output: http://koti.mbnet.fi/axh/kernel/crypto/phenom-ii-1055t/serpent-generic.txt http://koti.mbnet.fi/axh/kernel/crypto/phenom-ii-1055t/serpent-sse2.txt http://koti.mbnet.fi/axh/kernel/crypto/celeron-t1600/serpent-generic.txt http://koti.mbnet.fi/axh/kernel/crypto/celeron-t1600/serpent-sse2.txt Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/Kconfig17
-rw-r--r--crypto/testmgr.c60
2 files changed, 77 insertions, 0 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 733208fe0a2d..2df61e458f06 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -766,6 +766,23 @@ config CRYPTO_SERPENT
766 See also: 766 See also:
767 <http://www.cl.cam.ac.uk/~rja14/serpent.html> 767 <http://www.cl.cam.ac.uk/~rja14/serpent.html>
768 768
769config CRYPTO_SERPENT_SSE2_X86_64
770 tristate "Serpent cipher algorithm (x86_64/SSE2)"
771 depends on X86 && 64BIT
772 select CRYPTO_ALGAPI
773 select CRYPTO_SERPENT
774 help
775 Serpent cipher algorithm, by Anderson, Biham & Knudsen.
776
777 Keys are allowed to be from 0 to 256 bits in length, in steps
778 of 8 bits.
779
780 This module provides Serpent cipher algorithm that processes eigth
781 blocks parallel using SSE2 instruction set.
782
783 See also:
784 <http://www.cl.cam.ac.uk/~rja14/serpent.html>
785
769config CRYPTO_TEA 786config CRYPTO_TEA
770 tristate "TEA, XTEA and XETA cipher algorithms" 787 tristate "TEA, XTEA and XETA cipher algorithms"
771 select CRYPTO_ALGAPI 788 select CRYPTO_ALGAPI
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 01553a6754b7..bb54b882d738 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1534,6 +1534,21 @@ static int alg_test_null(const struct alg_test_desc *desc,
1534/* Please keep this list sorted by algorithm name. */ 1534/* Please keep this list sorted by algorithm name. */
1535static const struct alg_test_desc alg_test_descs[] = { 1535static const struct alg_test_desc alg_test_descs[] = {
1536 { 1536 {
1537 .alg = "__cbc-serpent-sse2",
1538 .test = alg_test_null,
1539 .suite = {
1540 .cipher = {
1541 .enc = {
1542 .vecs = NULL,
1543 .count = 0
1544 },
1545 .dec = {
1546 .vecs = NULL,
1547 .count = 0
1548 }
1549 }
1550 }
1551 }, {
1537 .alg = "__driver-cbc-aes-aesni", 1552 .alg = "__driver-cbc-aes-aesni",
1538 .test = alg_test_null, 1553 .test = alg_test_null,
1539 .suite = { 1554 .suite = {
@@ -1549,6 +1564,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1549 } 1564 }
1550 } 1565 }
1551 }, { 1566 }, {
1567 .alg = "__driver-cbc-serpent-sse2",
1568 .test = alg_test_null,
1569 .suite = {
1570 .cipher = {
1571 .enc = {
1572 .vecs = NULL,
1573 .count = 0
1574 },
1575 .dec = {
1576 .vecs = NULL,
1577 .count = 0
1578 }
1579 }
1580 }
1581 }, {
1552 .alg = "__driver-ecb-aes-aesni", 1582 .alg = "__driver-ecb-aes-aesni",
1553 .test = alg_test_null, 1583 .test = alg_test_null,
1554 .suite = { 1584 .suite = {
@@ -1564,6 +1594,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1564 } 1594 }
1565 } 1595 }
1566 }, { 1596 }, {
1597 .alg = "__driver-ecb-serpent-sse2",
1598 .test = alg_test_null,
1599 .suite = {
1600 .cipher = {
1601 .enc = {
1602 .vecs = NULL,
1603 .count = 0
1604 },
1605 .dec = {
1606 .vecs = NULL,
1607 .count = 0
1608 }
1609 }
1610 }
1611 }, {
1567 .alg = "__ghash-pclmulqdqni", 1612 .alg = "__ghash-pclmulqdqni",
1568 .test = alg_test_null, 1613 .test = alg_test_null,
1569 .suite = { 1614 .suite = {
@@ -1746,6 +1791,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1746 } 1791 }
1747 } 1792 }
1748 }, { 1793 }, {
1794 .alg = "cryptd(__driver-ecb-serpent-sse2)",
1795 .test = alg_test_null,
1796 .suite = {
1797 .cipher = {
1798 .enc = {
1799 .vecs = NULL,
1800 .count = 0
1801 },
1802 .dec = {
1803 .vecs = NULL,
1804 .count = 0
1805 }
1806 }
1807 }
1808 }, {
1749 .alg = "cryptd(__ghash-pclmulqdqni)", 1809 .alg = "cryptd(__ghash-pclmulqdqni)",
1750 .test = alg_test_null, 1810 .test = alg_test_null,
1751 .suite = { 1811 .suite = {