aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJohannes Goetzfried <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>2012-07-11 13:38:57 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-08-01 05:47:30 -0400
commit4ea1277d301eb776e321684cd4ea95116b4e8847 (patch)
tree675ef40d239946bc3232861cdf5a84259da09dc6 /crypto
parent9b8b04051d0df1e2c7c31206caff05673a2c685f (diff)
crypto: cast6 - add x86_64/avx assembler implementation
This patch adds a x86_64/avx assembler implementation of the Cast6 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 functions from the generic 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) cast6-avx-x86_64 vs. cast6-generic 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.97x 1.00x 1.01x 1.01x 0.99x 0.97x 0.98x 1.01x 0.96x 0.98x 64B 0.98x 0.99x 1.02x 1.01x 0.99x 1.00x 1.01x 0.99x 1.00x 0.99x 256B 1.77x 1.84x 0.99x 1.85x 1.77x 1.77x 1.70x 1.74x 1.69x 1.72x 1024B 1.93x 1.95x 0.99x 1.96x 1.93x 1.93x 1.84x 1.85x 1.89x 1.87x 8192B 1.91x 1.95x 0.99x 1.97x 1.95x 1.91x 1.86x 1.87x 1.93x 1.90x 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.97x 0.99x 1.02x 1.01x 0.98x 0.99x 1.00x 1.00x 0.98x 0.98x 64B 0.98x 0.99x 1.01x 1.00x 1.00x 1.00x 1.01x 1.01x 0.97x 1.00x 256B 1.77x 1.83x 1.00x 1.86x 1.79x 1.78x 1.70x 1.76x 1.71x 1.69x 1024B 1.92x 1.95x 0.99x 1.96x 1.93x 1.93x 1.83x 1.86x 1.89x 1.87x 8192B 1.94x 1.95x 0.99x 1.97x 1.95x 1.95x 1.87x 1.87x 1.93x 1.91x Signed-off-by: Johannes Goetzfried <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 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 cda97fcaa822..fe8ed62efe2f 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -713,6 +713,23 @@ config CRYPTO_CAST6
713 The CAST6 encryption algorithm (synonymous with CAST-256) is 713 The CAST6 encryption algorithm (synonymous with CAST-256) is
714 described in RFC2612. 714 described in RFC2612.
715 715
716config CRYPTO_CAST6_AVX_X86_64
717 tristate "CAST6 (CAST-256) cipher algorithm (x86_64/AVX)"
718 depends on X86 && 64BIT
719 select CRYPTO_ALGAPI
720 select CRYPTO_CRYPTD
721 select CRYPTO_ABLK_HELPER_X86
722 select CRYPTO_GLUE_HELPER_X86
723 select CRYPTO_CAST6
724 select CRYPTO_LRW
725 select CRYPTO_XTS
726 help
727 The CAST6 encryption algorithm (synonymous with CAST-256) is
728 described in RFC2612.
729
730 This module provides the Cast6 cipher algorithm that processes
731 eight blocks parallel using the AVX instruction set.
732
716config CRYPTO_DES 733config CRYPTO_DES
717 tristate "DES and Triple DES EDE cipher algorithms" 734 tristate "DES and Triple DES EDE cipher algorithms"
718 select CRYPTO_ALGAPI 735 select CRYPTO_ALGAPI
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index cff3c1c3f83c..575b57c3244b 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1549,6 +1549,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1549 } 1549 }
1550 } 1550 }
1551 }, { 1551 }, {
1552 .alg = "__cbc-cast6-avx",
1553 .test = alg_test_null,
1554 .suite = {
1555 .cipher = {
1556 .enc = {
1557 .vecs = NULL,
1558 .count = 0
1559 },
1560 .dec = {
1561 .vecs = NULL,
1562 .count = 0
1563 }
1564 }
1565 }
1566 }, {
1552 .alg = "__cbc-serpent-avx", 1567 .alg = "__cbc-serpent-avx",
1553 .test = alg_test_null, 1568 .test = alg_test_null,
1554 .suite = { 1569 .suite = {
@@ -1625,6 +1640,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1625 } 1640 }
1626 } 1641 }
1627 }, { 1642 }, {
1643 .alg = "__driver-cbc-cast6-avx",
1644 .test = alg_test_null,
1645 .suite = {
1646 .cipher = {
1647 .enc = {
1648 .vecs = NULL,
1649 .count = 0
1650 },
1651 .dec = {
1652 .vecs = NULL,
1653 .count = 0
1654 }
1655 }
1656 }
1657 }, {
1628 .alg = "__driver-cbc-serpent-avx", 1658 .alg = "__driver-cbc-serpent-avx",
1629 .test = alg_test_null, 1659 .test = alg_test_null,
1630 .suite = { 1660 .suite = {
@@ -1701,6 +1731,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1701 } 1731 }
1702 } 1732 }
1703 }, { 1733 }, {
1734 .alg = "__driver-ecb-cast6-avx",
1735 .test = alg_test_null,
1736 .suite = {
1737 .cipher = {
1738 .enc = {
1739 .vecs = NULL,
1740 .count = 0
1741 },
1742 .dec = {
1743 .vecs = NULL,
1744 .count = 0
1745 }
1746 }
1747 }
1748 }, {
1704 .alg = "__driver-ecb-serpent-avx", 1749 .alg = "__driver-ecb-serpent-avx",
1705 .test = alg_test_null, 1750 .test = alg_test_null,
1706 .suite = { 1751 .suite = {
@@ -2027,6 +2072,21 @@ static const struct alg_test_desc alg_test_descs[] = {
2027 } 2072 }
2028 } 2073 }
2029 }, { 2074 }, {
2075 .alg = "cryptd(__driver-ecb-cast6-avx)",
2076 .test = alg_test_null,
2077 .suite = {
2078 .cipher = {
2079 .enc = {
2080 .vecs = NULL,
2081 .count = 0
2082 },
2083 .dec = {
2084 .vecs = NULL,
2085 .count = 0
2086 }
2087 }
2088 }
2089 }, {
2030 .alg = "cryptd(__driver-ecb-serpent-avx)", 2090 .alg = "cryptd(__driver-ecb-serpent-avx)",
2031 .test = alg_test_null, 2091 .test = alg_test_null,
2032 .suite = { 2092 .suite = {