aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2012-10-26 07:49:01 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-11-09 04:32:32 -0500
commitd9b1d2e7e10d2e926775b1d3da39da0f51491e54 (patch)
tree58da273e600536c041e6962136a6295e6c8cfafe /crypto
parentcf582ccedad02eb9bfdcdb25adfc800dd117b428 (diff)
crypto: camellia - add AES-NI/AVX/x86_64 assembler implementation of camellia cipher
This patch adds AES-NI/AVX/x86_64 assembler implementation of Camellia block cipher. Implementation process data in sixteen block chunks, which are byte-sliced and AES SubBytes is reused for Camellia s-box with help of pre- and post-filtering. Patch has been tested with tcrypt and automated filesystem tests. tcrypt test results: Intel Core i5-2450M: camellia-aesni-avx vs camellia-asm-x86_64-2way: 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.98x 0.96x 0.99x 0.96x 0.96x 0.95x 0.95x 0.94x 0.97x 0.98x 64B 0.99x 0.98x 1.00x 0.98x 0.98x 0.99x 0.98x 0.93x 0.99x 0.98x 256B 2.28x 2.28x 1.01x 2.29x 2.25x 2.24x 1.96x 1.97x 1.91x 1.90x 1024B 2.57x 2.56x 1.00x 2.57x 2.51x 2.53x 2.19x 2.17x 2.19x 2.22x 8192B 2.49x 2.49x 1.00x 2.53x 2.48x 2.49x 2.17x 2.17x 2.22x 2.22x 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.98x 0.99x 0.97x 0.97x 0.96x 0.97x 0.98x 0.98x 0.99x 64B 1.00x 1.00x 1.01x 0.99x 0.98x 0.99x 0.99x 0.99x 0.99x 0.99x 256B 2.37x 2.37x 1.01x 2.39x 2.35x 2.33x 2.10x 2.11x 1.99x 2.02x 1024B 2.58x 2.60x 1.00x 2.58x 2.56x 2.56x 2.28x 2.29x 2.28x 2.29x 8192B 2.50x 2.52x 1.00x 2.56x 2.51x 2.51x 2.24x 2.25x 2.26x 2.29x Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/Kconfig22
-rw-r--r--crypto/testmgr.c62
2 files changed, 84 insertions, 0 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig
index b901b590635f..c226b2c7e47c 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -803,6 +803,28 @@ config CRYPTO_CAMELLIA_X86_64
803 See also: 803 See also:
804 <https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html> 804 <https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html>
805 805
806config CRYPTO_CAMELLIA_AESNI_AVX_X86_64
807 tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX)"
808 depends on X86 && 64BIT
809 depends on CRYPTO
810 select CRYPTO_ALGAPI
811 select CRYPTO_CRYPTD
812 select CRYPTO_ABLK_HELPER_X86
813 select CRYPTO_GLUE_HELPER_X86
814 select CRYPTO_CAMELLIA_X86_64
815 select CRYPTO_LRW
816 select CRYPTO_XTS
817 help
818 Camellia cipher algorithm module (x86_64/AES-NI/AVX).
819
820 Camellia is a symmetric key block cipher developed jointly
821 at NTT and Mitsubishi Electric Corporation.
822
823 The Camellia specifies three key sizes: 128, 192 and 256 bits.
824
825 See also:
826 <https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html>
827
806config CRYPTO_CAMELLIA_SPARC64 828config CRYPTO_CAMELLIA_SPARC64
807 tristate "Camellia cipher algorithm (SPARC64)" 829 tristate "Camellia cipher algorithm (SPARC64)"
808 depends on SPARC64 830 depends on SPARC64
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 879b61d436e9..3933241708c2 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1727,6 +1727,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1727 } 1727 }
1728 } 1728 }
1729 }, { 1729 }, {
1730 .alg = "__driver-cbc-camellia-aesni",
1731 .test = alg_test_null,
1732 .suite = {
1733 .cipher = {
1734 .enc = {
1735 .vecs = NULL,
1736 .count = 0
1737 },
1738 .dec = {
1739 .vecs = NULL,
1740 .count = 0
1741 }
1742 }
1743 }
1744 }, {
1730 .alg = "__driver-cbc-cast5-avx", 1745 .alg = "__driver-cbc-cast5-avx",
1731 .test = alg_test_null, 1746 .test = alg_test_null,
1732 .suite = { 1747 .suite = {
@@ -1818,6 +1833,21 @@ static const struct alg_test_desc alg_test_descs[] = {
1818 } 1833 }
1819 } 1834 }
1820 }, { 1835 }, {
1836 .alg = "__driver-ecb-camellia-aesni",
1837 .test = alg_test_null,
1838 .suite = {
1839 .cipher = {
1840 .enc = {
1841 .vecs = NULL,
1842 .count = 0
1843 },
1844 .dec = {
1845 .vecs = NULL,
1846 .count = 0
1847 }
1848 }
1849 }
1850 }, {
1821 .alg = "__driver-ecb-cast5-avx", 1851 .alg = "__driver-ecb-cast5-avx",
1822 .test = alg_test_null, 1852 .test = alg_test_null,
1823 .suite = { 1853 .suite = {
@@ -2143,6 +2173,22 @@ static const struct alg_test_desc alg_test_descs[] = {
2143 } 2173 }
2144 } 2174 }
2145 }, { 2175 }, {
2176 .alg = "cryptd(__driver-cbc-camellia-aesni)",
2177 .test = alg_test_null,
2178 .fips_allowed = 1,
2179 .suite = {
2180 .cipher = {
2181 .enc = {
2182 .vecs = NULL,
2183 .count = 0
2184 },
2185 .dec = {
2186 .vecs = NULL,
2187 .count = 0
2188 }
2189 }
2190 }
2191 }, {
2146 .alg = "cryptd(__driver-ecb-aes-aesni)", 2192 .alg = "cryptd(__driver-ecb-aes-aesni)",
2147 .test = alg_test_null, 2193 .test = alg_test_null,
2148 .fips_allowed = 1, 2194 .fips_allowed = 1,
@@ -2159,6 +2205,22 @@ static const struct alg_test_desc alg_test_descs[] = {
2159 } 2205 }
2160 } 2206 }
2161 }, { 2207 }, {
2208 .alg = "cryptd(__driver-ecb-camellia-aesni)",
2209 .test = alg_test_null,
2210 .fips_allowed = 1,
2211 .suite = {
2212 .cipher = {
2213 .enc = {
2214 .vecs = NULL,
2215 .count = 0
2216 },
2217 .dec = {
2218 .vecs = NULL,
2219 .count = 0
2220 }
2221 }
2222 }
2223 }, {
2162 .alg = "cryptd(__driver-ecb-cast5-avx)", 2224 .alg = "cryptd(__driver-ecb-cast5-avx)",
2163 .test = alg_test_null, 2225 .test = alg_test_null,
2164 .suite = { 2226 .suite = {