aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/crypto/cast5-avx-x86_64-asm_64.S16
-rw-r--r--arch/x86/crypto/cast6-avx-x86_64-asm_64.S16
-rw-r--r--crypto/Kconfig10
-rw-r--r--crypto/Makefile1
-rw-r--r--crypto/cast5_generic.c277
-rw-r--r--crypto/cast6_generic.c280
-rw-r--r--crypto/cast_common.c290
-rw-r--r--include/crypto/cast5.h6
-rw-r--r--include/crypto/cast6.h6
-rw-r--r--include/crypto/cast_common.h9
10 files changed, 336 insertions, 575 deletions
diff --git a/arch/x86/crypto/cast5-avx-x86_64-asm_64.S b/arch/x86/crypto/cast5-avx-x86_64-asm_64.S
index 12478e47236..15b00ac7cbd 100644
--- a/arch/x86/crypto/cast5-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/cast5-avx-x86_64-asm_64.S
@@ -25,10 +25,10 @@
25 25
26.file "cast5-avx-x86_64-asm_64.S" 26.file "cast5-avx-x86_64-asm_64.S"
27 27
28.extern cast5_s1 28.extern cast_s1
29.extern cast5_s2 29.extern cast_s2
30.extern cast5_s3 30.extern cast_s3
31.extern cast5_s4 31.extern cast_s4
32 32
33/* structure of crypto context */ 33/* structure of crypto context */
34#define km 0 34#define km 0
@@ -36,10 +36,10 @@
36#define rr ((16*4)+16) 36#define rr ((16*4)+16)
37 37
38/* s-boxes */ 38/* s-boxes */
39#define s1 cast5_s1 39#define s1 cast_s1
40#define s2 cast5_s2 40#define s2 cast_s2
41#define s3 cast5_s3 41#define s3 cast_s3
42#define s4 cast5_s4 42#define s4 cast_s4
43 43
44/********************************************************************** 44/**********************************************************************
45 16-way AVX cast5 45 16-way AVX cast5
diff --git a/arch/x86/crypto/cast6-avx-x86_64-asm_64.S b/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
index 83a53818f0a..2569d0da841 100644
--- a/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
@@ -27,20 +27,20 @@
27 27
28.file "cast6-avx-x86_64-asm_64.S" 28.file "cast6-avx-x86_64-asm_64.S"
29 29
30.extern cast6_s1 30.extern cast_s1
31.extern cast6_s2 31.extern cast_s2
32.extern cast6_s3 32.extern cast_s3
33.extern cast6_s4 33.extern cast_s4
34 34
35/* structure of crypto context */ 35/* structure of crypto context */
36#define km 0 36#define km 0
37#define kr (12*4*4) 37#define kr (12*4*4)
38 38
39/* s-boxes */ 39/* s-boxes */
40#define s1 cast6_s1 40#define s1 cast_s1
41#define s2 cast6_s2 41#define s2 cast_s2
42#define s3 cast6_s3 42#define s3 cast_s3
43#define s4 cast6_s4 43#define s4 cast_s4
44 44
45/********************************************************************** 45/**********************************************************************
46 8-way AVX cast6 46 8-way AVX cast6
diff --git a/crypto/Kconfig b/crypto/Kconfig
index c226b2c7e47..4641d95651d 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -841,9 +841,16 @@ config CRYPTO_CAMELLIA_SPARC64
841 See also: 841 See also:
842 <https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html> 842 <https://info.isl.ntt.co.jp/crypt/eng/camellia/index_s.html>
843 843
844config CRYPTO_CAST_COMMON
845 tristate
846 help
847 Common parts of the CAST cipher algorithms shared by the
848 generic c and the assembler implementations.
849
844config CRYPTO_CAST5 850config CRYPTO_CAST5
845 tristate "CAST5 (CAST-128) cipher algorithm" 851 tristate "CAST5 (CAST-128) cipher algorithm"
846 select CRYPTO_ALGAPI 852 select CRYPTO_ALGAPI
853 select CRYPTO_CAST_COMMON
847 help 854 help
848 The CAST5 encryption algorithm (synonymous with CAST-128) is 855 The CAST5 encryption algorithm (synonymous with CAST-128) is
849 described in RFC2144. 856 described in RFC2144.
@@ -854,6 +861,7 @@ config CRYPTO_CAST5_AVX_X86_64
854 select CRYPTO_ALGAPI 861 select CRYPTO_ALGAPI
855 select CRYPTO_CRYPTD 862 select CRYPTO_CRYPTD
856 select CRYPTO_ABLK_HELPER_X86 863 select CRYPTO_ABLK_HELPER_X86
864 select CRYPTO_CAST_COMMON
857 select CRYPTO_CAST5 865 select CRYPTO_CAST5
858 help 866 help
859 The CAST5 encryption algorithm (synonymous with CAST-128) is 867 The CAST5 encryption algorithm (synonymous with CAST-128) is
@@ -865,6 +873,7 @@ config CRYPTO_CAST5_AVX_X86_64
865config CRYPTO_CAST6 873config CRYPTO_CAST6
866 tristate "CAST6 (CAST-256) cipher algorithm" 874 tristate "CAST6 (CAST-256) cipher algorithm"
867 select CRYPTO_ALGAPI 875 select CRYPTO_ALGAPI
876 select CRYPTO_CAST_COMMON
868 help 877 help
869 The CAST6 encryption algorithm (synonymous with CAST-256) is 878 The CAST6 encryption algorithm (synonymous with CAST-256) is
870 described in RFC2612. 879 described in RFC2612.
@@ -876,6 +885,7 @@ config CRYPTO_CAST6_AVX_X86_64
876 select CRYPTO_CRYPTD 885 select CRYPTO_CRYPTD
877 select CRYPTO_ABLK_HELPER_X86 886 select CRYPTO_ABLK_HELPER_X86
878 select CRYPTO_GLUE_HELPER_X86 887 select CRYPTO_GLUE_HELPER_X86
888 select CRYPTO_CAST_COMMON
879 select CRYPTO_CAST6 889 select CRYPTO_CAST6
880 select CRYPTO_LRW 890 select CRYPTO_LRW
881 select CRYPTO_XTS 891 select CRYPTO_XTS
diff --git a/crypto/Makefile b/crypto/Makefile
index 8cf61ffe351..d59dec74980 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -68,6 +68,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
68obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o 68obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
69obj-$(CONFIG_CRYPTO_AES) += aes_generic.o 69obj-$(CONFIG_CRYPTO_AES) += aes_generic.o
70obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o 70obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
71obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
71obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o 72obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o
72obj-$(CONFIG_CRYPTO_CAST6) += cast6_generic.o 73obj-$(CONFIG_CRYPTO_CAST6) += cast6_generic.o
73obj-$(CONFIG_CRYPTO_ARC4) += arc4.o 74obj-$(CONFIG_CRYPTO_ARC4) += arc4.o
diff --git a/crypto/cast5_generic.c b/crypto/cast5_generic.c
index bc525dbd8a4..5558f630a0e 100644
--- a/crypto/cast5_generic.c
+++ b/crypto/cast5_generic.c
@@ -30,275 +30,6 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <crypto/cast5.h> 31#include <crypto/cast5.h>
32 32
33
34const u32 cast5_s1[256] = {
35 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f,
36 0x9c004dd3, 0x6003e540, 0xcf9fc949,
37 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0,
38 0x15c361d2, 0xc2e7661d, 0x22d4ff8e,
39 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3,
40 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d,
41 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1,
42 0xaa54166b, 0x22568e3a, 0xa2d341d0,
43 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac,
44 0x4a97c1d8, 0x527644b7, 0xb5f437a7,
45 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0,
46 0x90ecf52e, 0x22b0c054, 0xbc8e5935,
47 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290,
48 0xe93b159f, 0xb48ee411, 0x4bff345d,
49 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad,
50 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50,
51 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f,
52 0xc59c5319, 0xb949e354, 0xb04669fe,
53 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5,
54 0x6a390493, 0xe63d37e0, 0x2a54f6b3,
55 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5,
56 0xf61b1891, 0xbb72275e, 0xaa508167,
57 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427,
58 0xa2d1936b, 0x2ad286af, 0xaa56d291,
59 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d,
60 0x73e2bb14, 0xa0bebc3c, 0x54623779,
61 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e,
62 0x89fe78e6, 0x3fab0950, 0x325ff6c2,
63 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf,
64 0x380782d5, 0xc7fa5cf6, 0x8ac31511,
65 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241,
66 0x051ef495, 0xaa573b04, 0x4a805d8d,
67 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b,
68 0x50afd341, 0xa7c13275, 0x915a0bf5,
69 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265,
70 0xab85c5f3, 0x1b55db94, 0xaad4e324,
71 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3,
72 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c,
73 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6,
74 0x22513f1e, 0xaa51a79b, 0x2ad344cc,
75 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6,
76 0x032268d4, 0xc9600acc, 0xce387e6d,
77 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da,
78 0x4736f464, 0x5ad328d8, 0xb347cc96,
79 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc,
80 0xbfc5fe4a, 0xa70aec10, 0xac39570a,
81 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f,
82 0x1cacd68d, 0x2ad37c96, 0x0175cb9d,
83 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4,
84 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd,
85 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af,
86 0x51c85f4d, 0x56907596, 0xa5bb15e6,
87 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a,
88 0x3526ffa0, 0xc37b4d09, 0xbc306ed9,
89 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf,
90 0x700b45e1, 0xd5ea50f1, 0x85a92872,
91 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198,
92 0x0cd0ede7, 0x26470db8, 0xf881814c,
93 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db,
94 0xab838653, 0x6e2f1e23, 0x83719c9e,
95 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c,
96 0xe1e696ff, 0xb141ab08, 0x7cca89b9,
97 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c,
98 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf
99};
100EXPORT_SYMBOL_GPL(cast5_s1);
101const u32 cast5_s2[256] = {
102 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a,
103 0xeec5207a, 0x55889c94, 0x72fc0651,
104 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef,
105 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3,
106 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086,
107 0xef944459, 0xba83ccb3, 0xe0c3cdfb,
108 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb,
109 0xe4e7ef5b, 0x25a1ff41, 0xe180f806,
110 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f,
111 0x77e83f4e, 0x79929269, 0x24fa9f7b,
112 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154,
113 0x0d554b63, 0x5d681121, 0xc866c359,
114 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181,
115 0x39f7627f, 0x361e3084, 0xe4eb573b,
116 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c,
117 0x99847ab4, 0xa0e3df79, 0xba6cf38c,
118 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a,
119 0x8f458c74, 0xd9e0a227, 0x4ec73a34,
120 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c,
121 0x1d804366, 0x721d9bfd, 0xa58684bb,
122 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1,
123 0x27e19ba5, 0xd5a6c252, 0xe49754bd,
124 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9,
125 0xe0b56714, 0x21f043b7, 0xe5d05860,
126 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf,
127 0x68561be6, 0x83ca6b94, 0x2d6ed23b,
128 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c,
129 0x397bc8d6, 0x5ee22b95, 0x5f0e5304,
130 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122,
131 0xb96726d1, 0x8049a7e8, 0x22b7da7b,
132 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402,
133 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf,
134 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53,
135 0xe3214517, 0xb4542835, 0x9f63293c,
136 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6,
137 0x30a22c95, 0x31a70850, 0x60930f13,
138 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6,
139 0xa02b1741, 0x7cbad9a2, 0x2180036f,
140 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676,
141 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6,
142 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb,
143 0x846a3bae, 0x8ff77888, 0xee5d60f6,
144 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54,
145 0x157fd7fa, 0xef8579cc, 0xd152de58,
146 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5,
147 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906,
148 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8,
149 0xbec0c560, 0x61a3c9e8, 0xbca8f54d,
150 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc,
151 0x301e16e6, 0x273be979, 0xb0ffeaa6,
152 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a,
153 0xf7e19798, 0x7619b72f, 0x8f1c9ba4,
154 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e,
155 0x1a513742, 0xef6828bc, 0x520365d6,
156 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb,
157 0x5eea29cb, 0x145892f5, 0x91584f7f,
158 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4,
159 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249,
160 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3,
161 0x230eabb0, 0x6438bc87, 0xf0b5b1fa,
162 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589,
163 0xa345415e, 0x5c038323, 0x3e5d3bb9,
164 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539,
165 0x73bfbe70, 0x83877605, 0x4523ecf1
166};
167EXPORT_SYMBOL_GPL(cast5_s2);
168const u32 cast5_s3[256] = {
169 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff,
170 0x369fe44b, 0x8c1fc644, 0xaececa90,
171 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806,
172 0xf0ad0548, 0xe13c8d83, 0x927010d5,
173 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820,
174 0xfade82e0, 0xa067268b, 0x8272792e,
175 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee,
176 0x825b1bfd, 0x9255c5ed, 0x1257a240,
177 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf,
178 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5,
179 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1,
180 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b,
181 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c,
182 0x4a012d6e, 0xc5884a28, 0xccc36f71,
183 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850,
184 0xd7c07f7e, 0x02507fbf, 0x5afb9a04,
185 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e,
186 0x727cc3c4, 0x0a0fb402, 0x0f7fef82,
187 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0,
188 0x1eac5790, 0x796fb449, 0x8252dc15,
189 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403,
190 0xe83ec305, 0x4f91751a, 0x925669c2,
191 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574,
192 0x927985b2, 0x8276dbcb, 0x02778176,
193 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83,
194 0x340ce5c8, 0x96bbb682, 0x93b4b148,
195 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20,
196 0x8437aa88, 0x7d29dc96, 0x2756d3dc,
197 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e,
198 0x3cf8209d, 0x6094d1e3, 0xcd9ca341,
199 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9,
200 0xbda8229c, 0x127dadaa, 0x438a074e,
201 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff,
202 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51,
203 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a,
204 0x76a2e214, 0xb9a40368, 0x925d958f,
205 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623,
206 0x193cbcfa, 0x27627545, 0x825cf47a,
207 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7,
208 0x8272a972, 0x9270c4a8, 0x127de50b,
209 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb,
210 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b,
211 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11,
212 0x236a5cae, 0x12deca4d, 0x2c3f8cc5,
213 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c,
214 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45,
215 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40,
216 0x7c34671c, 0x02717ef6, 0x4feb5536,
217 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1,
218 0x006e1888, 0xa2e53f55, 0xb9e6d4bc,
219 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33,
220 0xabcc4f33, 0x7688c55d, 0x7b00a6b0,
221 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff,
222 0x856302e0, 0x72dbd92b, 0xee971b69,
223 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2,
224 0x61efc8c2, 0xf1ac2571, 0xcc8239c2,
225 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38,
226 0x0ff0443d, 0x606e6dc6, 0x60543a49,
227 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f,
228 0x68458425, 0x99833be5, 0x600d457d,
229 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31,
230 0x9c305a00, 0x52bce688, 0x1b03588a,
231 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636,
232 0xa133c501, 0xe9d3531c, 0xee353783
233};
234EXPORT_SYMBOL_GPL(cast5_s3);
235const u32 cast5_s4[256] = {
236 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb,
237 0x64ad8c57, 0x85510443, 0xfa020ed1,
238 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43,
239 0x6497b7b1, 0xf3641f63, 0x241e4adf,
240 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30,
241 0xc0a5374f, 0x1d2d00d9, 0x24147b15,
242 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f,
243 0x0c13fefe, 0x081b08ca, 0x05170121,
244 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f,
245 0x06df4261, 0xbb9e9b8a, 0x7293ea25,
246 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400,
247 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5,
248 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061,
249 0x11b638e1, 0x72500e03, 0xf80eb2bb,
250 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400,
251 0x6920318f, 0x081dbb99, 0xffc304a5,
252 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea,
253 0x9f926f91, 0x9f46222f, 0x3991467d,
254 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8,
255 0x3fb6180c, 0x18f8931e, 0x281658e6,
256 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25,
257 0x79098b02, 0xe4eabb81, 0x28123b23,
258 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9,
259 0x0014377b, 0x041e8ac8, 0x09114003,
260 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de,
261 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6,
262 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0,
263 0x56c8c391, 0x6b65811c, 0x5e146119,
264 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d,
265 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24,
266 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a,
267 0xeca1d7c7, 0x041afa32, 0x1d16625a,
268 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb,
269 0xc70b8b46, 0xd9e66a48, 0x56e55a79,
270 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3,
271 0xedda04eb, 0x17a9be04, 0x2c18f4df,
272 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254,
273 0xe5b6a035, 0x213d42f6, 0x2c1c7c26,
274 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2,
275 0x0418f2c8, 0x001a96a6, 0x0d1526ab,
276 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86,
277 0x311170a7, 0x3e9b640c, 0xcc3e10d7,
278 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1,
279 0x1f9af36e, 0xcfcbd12f, 0xc1de8417,
280 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca,
281 0xb4be31cd, 0xd8782806, 0x12a3a4e2,
282 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5,
283 0x9711aac5, 0x001d7b95, 0x82e5e7d2,
284 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415,
285 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a,
286 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7,
287 0x0ce454a9, 0xd60acd86, 0x015f1919,
288 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe,
289 0x8b75e387, 0xb3c50651, 0xb8a5c3ef,
290 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb,
291 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876,
292 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8,
293 0x296b299e, 0x492fc295, 0x9266beab,
294 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee,
295 0xf65324e6, 0x6afce36c, 0x0316cc04,
296 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979,
297 0x932bcdf6, 0xb657c34d, 0x4edfd282,
298 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0,
299 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2
300};
301EXPORT_SYMBOL_GPL(cast5_s4);
302static const u32 s5[256] = { 33static const u32 s5[256] = {
303 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff, 34 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff,
304 0x1dd358f5, 0x44dd9d44, 0x1731167f, 35 0x1dd358f5, 0x44dd9d44, 0x1731167f,
@@ -564,10 +295,10 @@ static const u32 sb8[256] = {
564 0xeaee6801, 0x8db2a283, 0xea8bf59e 295 0xeaee6801, 0x8db2a283, 0xea8bf59e
565}; 296};
566 297
567#define s1 cast5_s1 298#define s1 cast_s1
568#define s2 cast5_s2 299#define s2 cast_s2
569#define s3 cast5_s3 300#define s3 cast_s3
570#define s4 cast5_s4 301#define s4 cast_s4
571 302
572#define F1(D, m, r) ((I = ((m) + (D))), (I = rol32(I, (r))), \ 303#define F1(D, m, r) ((I = ((m) + (D))), (I = rol32(I, (r))), \
573 (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff])) 304 (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]))
diff --git a/crypto/cast6_generic.c b/crypto/cast6_generic.c
index 1acd2f1c48f..de732528a43 100644
--- a/crypto/cast6_generic.c
+++ b/crypto/cast6_generic.c
@@ -27,10 +27,10 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <crypto/cast6.h> 28#include <crypto/cast6.h>
29 29
30#define s1 cast6_s1 30#define s1 cast_s1
31#define s2 cast6_s2 31#define s2 cast_s2
32#define s3 cast6_s3 32#define s3 cast_s3
33#define s4 cast6_s4 33#define s4 cast_s4
34 34
35#define F1(D, r, m) ((I = ((m) + (D))), (I = rol32(I, (r))), \ 35#define F1(D, r, m) ((I = ((m) + (D))), (I = rol32(I, (r))), \
36 (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff])) 36 (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]))
@@ -39,278 +39,6 @@
39#define F3(D, r, m) ((I = ((m) - (D))), (I = rol32(I, (r))), \ 39#define F3(D, r, m) ((I = ((m) - (D))), (I = rol32(I, (r))), \
40 (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff])) 40 (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]))
41 41
42const u32 cast6_s1[256] = {
43 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f,
44 0x9c004dd3, 0x6003e540, 0xcf9fc949,
45 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0,
46 0x15c361d2, 0xc2e7661d, 0x22d4ff8e,
47 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3,
48 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d,
49 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1,
50 0xaa54166b, 0x22568e3a, 0xa2d341d0,
51 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac,
52 0x4a97c1d8, 0x527644b7, 0xb5f437a7,
53 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0,
54 0x90ecf52e, 0x22b0c054, 0xbc8e5935,
55 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290,
56 0xe93b159f, 0xb48ee411, 0x4bff345d,
57 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad,
58 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50,
59 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f,
60 0xc59c5319, 0xb949e354, 0xb04669fe,
61 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5,
62 0x6a390493, 0xe63d37e0, 0x2a54f6b3,
63 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5,
64 0xf61b1891, 0xbb72275e, 0xaa508167,
65 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427,
66 0xa2d1936b, 0x2ad286af, 0xaa56d291,
67 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d,
68 0x73e2bb14, 0xa0bebc3c, 0x54623779,
69 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e,
70 0x89fe78e6, 0x3fab0950, 0x325ff6c2,
71 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf,
72 0x380782d5, 0xc7fa5cf6, 0x8ac31511,
73 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241,
74 0x051ef495, 0xaa573b04, 0x4a805d8d,
75 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b,
76 0x50afd341, 0xa7c13275, 0x915a0bf5,
77 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265,
78 0xab85c5f3, 0x1b55db94, 0xaad4e324,
79 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3,
80 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c,
81 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6,
82 0x22513f1e, 0xaa51a79b, 0x2ad344cc,
83 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6,
84 0x032268d4, 0xc9600acc, 0xce387e6d,
85 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da,
86 0x4736f464, 0x5ad328d8, 0xb347cc96,
87 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc,
88 0xbfc5fe4a, 0xa70aec10, 0xac39570a,
89 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f,
90 0x1cacd68d, 0x2ad37c96, 0x0175cb9d,
91 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4,
92 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd,
93 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af,
94 0x51c85f4d, 0x56907596, 0xa5bb15e6,
95 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a,
96 0x3526ffa0, 0xc37b4d09, 0xbc306ed9,
97 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf,
98 0x700b45e1, 0xd5ea50f1, 0x85a92872,
99 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198,
100 0x0cd0ede7, 0x26470db8, 0xf881814c,
101 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db,
102 0xab838653, 0x6e2f1e23, 0x83719c9e,
103 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c,
104 0xe1e696ff, 0xb141ab08, 0x7cca89b9,
105 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c,
106 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf
107};
108EXPORT_SYMBOL_GPL(cast6_s1);
109
110const u32 cast6_s2[256] = {
111 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a,
112 0xeec5207a, 0x55889c94, 0x72fc0651,
113 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef,
114 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3,
115 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086,
116 0xef944459, 0xba83ccb3, 0xe0c3cdfb,
117 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb,
118 0xe4e7ef5b, 0x25a1ff41, 0xe180f806,
119 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f,
120 0x77e83f4e, 0x79929269, 0x24fa9f7b,
121 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154,
122 0x0d554b63, 0x5d681121, 0xc866c359,
123 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181,
124 0x39f7627f, 0x361e3084, 0xe4eb573b,
125 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c,
126 0x99847ab4, 0xa0e3df79, 0xba6cf38c,
127 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a,
128 0x8f458c74, 0xd9e0a227, 0x4ec73a34,
129 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c,
130 0x1d804366, 0x721d9bfd, 0xa58684bb,
131 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1,
132 0x27e19ba5, 0xd5a6c252, 0xe49754bd,
133 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9,
134 0xe0b56714, 0x21f043b7, 0xe5d05860,
135 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf,
136 0x68561be6, 0x83ca6b94, 0x2d6ed23b,
137 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c,
138 0x397bc8d6, 0x5ee22b95, 0x5f0e5304,
139 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122,
140 0xb96726d1, 0x8049a7e8, 0x22b7da7b,
141 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402,
142 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf,
143 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53,
144 0xe3214517, 0xb4542835, 0x9f63293c,
145 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6,
146 0x30a22c95, 0x31a70850, 0x60930f13,
147 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6,
148 0xa02b1741, 0x7cbad9a2, 0x2180036f,
149 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676,
150 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6,
151 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb,
152 0x846a3bae, 0x8ff77888, 0xee5d60f6,
153 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54,
154 0x157fd7fa, 0xef8579cc, 0xd152de58,
155 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5,
156 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906,
157 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8,
158 0xbec0c560, 0x61a3c9e8, 0xbca8f54d,
159 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc,
160 0x301e16e6, 0x273be979, 0xb0ffeaa6,
161 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a,
162 0xf7e19798, 0x7619b72f, 0x8f1c9ba4,
163 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e,
164 0x1a513742, 0xef6828bc, 0x520365d6,
165 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb,
166 0x5eea29cb, 0x145892f5, 0x91584f7f,
167 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4,
168 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249,
169 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3,
170 0x230eabb0, 0x6438bc87, 0xf0b5b1fa,
171 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589,
172 0xa345415e, 0x5c038323, 0x3e5d3bb9,
173 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539,
174 0x73bfbe70, 0x83877605, 0x4523ecf1
175};
176EXPORT_SYMBOL_GPL(cast6_s2);
177
178const u32 cast6_s3[256] = {
179 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff,
180 0x369fe44b, 0x8c1fc644, 0xaececa90,
181 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806,
182 0xf0ad0548, 0xe13c8d83, 0x927010d5,
183 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820,
184 0xfade82e0, 0xa067268b, 0x8272792e,
185 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee,
186 0x825b1bfd, 0x9255c5ed, 0x1257a240,
187 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf,
188 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5,
189 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1,
190 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b,
191 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c,
192 0x4a012d6e, 0xc5884a28, 0xccc36f71,
193 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850,
194 0xd7c07f7e, 0x02507fbf, 0x5afb9a04,
195 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e,
196 0x727cc3c4, 0x0a0fb402, 0x0f7fef82,
197 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0,
198 0x1eac5790, 0x796fb449, 0x8252dc15,
199 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403,
200 0xe83ec305, 0x4f91751a, 0x925669c2,
201 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574,
202 0x927985b2, 0x8276dbcb, 0x02778176,
203 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83,
204 0x340ce5c8, 0x96bbb682, 0x93b4b148,
205 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20,
206 0x8437aa88, 0x7d29dc96, 0x2756d3dc,
207 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e,
208 0x3cf8209d, 0x6094d1e3, 0xcd9ca341,
209 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9,
210 0xbda8229c, 0x127dadaa, 0x438a074e,
211 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff,
212 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51,
213 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a,
214 0x76a2e214, 0xb9a40368, 0x925d958f,
215 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623,
216 0x193cbcfa, 0x27627545, 0x825cf47a,
217 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7,
218 0x8272a972, 0x9270c4a8, 0x127de50b,
219 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb,
220 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b,
221 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11,
222 0x236a5cae, 0x12deca4d, 0x2c3f8cc5,
223 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c,
224 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45,
225 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40,
226 0x7c34671c, 0x02717ef6, 0x4feb5536,
227 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1,
228 0x006e1888, 0xa2e53f55, 0xb9e6d4bc,
229 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33,
230 0xabcc4f33, 0x7688c55d, 0x7b00a6b0,
231 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff,
232 0x856302e0, 0x72dbd92b, 0xee971b69,
233 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2,
234 0x61efc8c2, 0xf1ac2571, 0xcc8239c2,
235 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38,
236 0x0ff0443d, 0x606e6dc6, 0x60543a49,
237 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f,
238 0x68458425, 0x99833be5, 0x600d457d,
239 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31,
240 0x9c305a00, 0x52bce688, 0x1b03588a,
241 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636,
242 0xa133c501, 0xe9d3531c, 0xee353783
243};
244EXPORT_SYMBOL_GPL(cast6_s3);
245
246const u32 cast6_s4[256] = {
247 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb,
248 0x64ad8c57, 0x85510443, 0xfa020ed1,
249 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43,
250 0x6497b7b1, 0xf3641f63, 0x241e4adf,
251 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30,
252 0xc0a5374f, 0x1d2d00d9, 0x24147b15,
253 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f,
254 0x0c13fefe, 0x081b08ca, 0x05170121,
255 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f,
256 0x06df4261, 0xbb9e9b8a, 0x7293ea25,
257 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400,
258 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5,
259 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061,
260 0x11b638e1, 0x72500e03, 0xf80eb2bb,
261 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400,
262 0x6920318f, 0x081dbb99, 0xffc304a5,
263 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea,
264 0x9f926f91, 0x9f46222f, 0x3991467d,
265 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8,
266 0x3fb6180c, 0x18f8931e, 0x281658e6,
267 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25,
268 0x79098b02, 0xe4eabb81, 0x28123b23,
269 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9,
270 0x0014377b, 0x041e8ac8, 0x09114003,
271 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de,
272 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6,
273 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0,
274 0x56c8c391, 0x6b65811c, 0x5e146119,
275 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d,
276 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24,
277 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a,
278 0xeca1d7c7, 0x041afa32, 0x1d16625a,
279 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb,
280 0xc70b8b46, 0xd9e66a48, 0x56e55a79,
281 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3,
282 0xedda04eb, 0x17a9be04, 0x2c18f4df,
283 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254,
284 0xe5b6a035, 0x213d42f6, 0x2c1c7c26,
285 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2,
286 0x0418f2c8, 0x001a96a6, 0x0d1526ab,
287 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86,
288 0x311170a7, 0x3e9b640c, 0xcc3e10d7,
289 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1,
290 0x1f9af36e, 0xcfcbd12f, 0xc1de8417,
291 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca,
292 0xb4be31cd, 0xd8782806, 0x12a3a4e2,
293 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5,
294 0x9711aac5, 0x001d7b95, 0x82e5e7d2,
295 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415,
296 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a,
297 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7,
298 0x0ce454a9, 0xd60acd86, 0x015f1919,
299 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe,
300 0x8b75e387, 0xb3c50651, 0xb8a5c3ef,
301 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb,
302 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876,
303 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8,
304 0x296b299e, 0x492fc295, 0x9266beab,
305 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee,
306 0xf65324e6, 0x6afce36c, 0x0316cc04,
307 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979,
308 0x932bcdf6, 0xb657c34d, 0x4edfd282,
309 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0,
310 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2
311};
312EXPORT_SYMBOL_GPL(cast6_s4);
313
314static const u32 Tm[24][8] = { 42static const u32 Tm[24][8] = {
315 { 0x5a827999, 0xc95c653a, 0x383650db, 0xa7103c7c, 0x15ea281d, 43 { 0x5a827999, 0xc95c653a, 0x383650db, 0xa7103c7c, 0x15ea281d,
316 0x84c413be, 0xf39dff5f, 0x6277eb00 } , 44 0x84c413be, 0xf39dff5f, 0x6277eb00 } ,
diff --git a/crypto/cast_common.c b/crypto/cast_common.c
new file mode 100644
index 00000000000..a15f523d5f5
--- /dev/null
+++ b/crypto/cast_common.c
@@ -0,0 +1,290 @@
1/*
2 * Common lookup tables for CAST-128 (cast5) and CAST-256 (cast6)
3 *
4 * Copyright © 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
5 * Copyright © 2003 Kartikey Mahendra Bhatt <kartik_me@hotmail.com>
6 * Copyright © 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 */
14
15#include <linux/module.h>
16#include <crypto/cast_common.h>
17
18const u32 cast_s1[256] = {
19 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f,
20 0x9c004dd3, 0x6003e540, 0xcf9fc949,
21 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0,
22 0x15c361d2, 0xc2e7661d, 0x22d4ff8e,
23 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3,
24 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d,
25 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1,
26 0xaa54166b, 0x22568e3a, 0xa2d341d0,
27 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac,
28 0x4a97c1d8, 0x527644b7, 0xb5f437a7,
29 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0,
30 0x90ecf52e, 0x22b0c054, 0xbc8e5935,
31 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290,
32 0xe93b159f, 0xb48ee411, 0x4bff345d,
33 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad,
34 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50,
35 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f,
36 0xc59c5319, 0xb949e354, 0xb04669fe,
37 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5,
38 0x6a390493, 0xe63d37e0, 0x2a54f6b3,
39 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5,
40 0xf61b1891, 0xbb72275e, 0xaa508167,
41 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427,
42 0xa2d1936b, 0x2ad286af, 0xaa56d291,
43 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d,
44 0x73e2bb14, 0xa0bebc3c, 0x54623779,
45 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e,
46 0x89fe78e6, 0x3fab0950, 0x325ff6c2,
47 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf,
48 0x380782d5, 0xc7fa5cf6, 0x8ac31511,
49 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241,
50 0x051ef495, 0xaa573b04, 0x4a805d8d,
51 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b,
52 0x50afd341, 0xa7c13275, 0x915a0bf5,
53 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265,
54 0xab85c5f3, 0x1b55db94, 0xaad4e324,
55 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3,
56 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c,
57 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6,
58 0x22513f1e, 0xaa51a79b, 0x2ad344cc,
59 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6,
60 0x032268d4, 0xc9600acc, 0xce387e6d,
61 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da,
62 0x4736f464, 0x5ad328d8, 0xb347cc96,
63 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc,
64 0xbfc5fe4a, 0xa70aec10, 0xac39570a,
65 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f,
66 0x1cacd68d, 0x2ad37c96, 0x0175cb9d,
67 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4,
68 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd,
69 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af,
70 0x51c85f4d, 0x56907596, 0xa5bb15e6,
71 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a,
72 0x3526ffa0, 0xc37b4d09, 0xbc306ed9,
73 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf,
74 0x700b45e1, 0xd5ea50f1, 0x85a92872,
75 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198,
76 0x0cd0ede7, 0x26470db8, 0xf881814c,
77 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db,
78 0xab838653, 0x6e2f1e23, 0x83719c9e,
79 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c,
80 0xe1e696ff, 0xb141ab08, 0x7cca89b9,
81 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c,
82 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf
83};
84EXPORT_SYMBOL_GPL(cast_s1);
85
86const u32 cast_s2[256] = {
87 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a,
88 0xeec5207a, 0x55889c94, 0x72fc0651,
89 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef,
90 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3,
91 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086,
92 0xef944459, 0xba83ccb3, 0xe0c3cdfb,
93 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb,
94 0xe4e7ef5b, 0x25a1ff41, 0xe180f806,
95 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f,
96 0x77e83f4e, 0x79929269, 0x24fa9f7b,
97 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154,
98 0x0d554b63, 0x5d681121, 0xc866c359,
99 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181,
100 0x39f7627f, 0x361e3084, 0xe4eb573b,
101 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c,
102 0x99847ab4, 0xa0e3df79, 0xba6cf38c,
103 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a,
104 0x8f458c74, 0xd9e0a227, 0x4ec73a34,
105 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c,
106 0x1d804366, 0x721d9bfd, 0xa58684bb,
107 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1,
108 0x27e19ba5, 0xd5a6c252, 0xe49754bd,
109 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9,
110 0xe0b56714, 0x21f043b7, 0xe5d05860,
111 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf,
112 0x68561be6, 0x83ca6b94, 0x2d6ed23b,
113 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c,
114 0x397bc8d6, 0x5ee22b95, 0x5f0e5304,
115 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122,
116 0xb96726d1, 0x8049a7e8, 0x22b7da7b,
117 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402,
118 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf,
119 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53,
120 0xe3214517, 0xb4542835, 0x9f63293c,
121 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6,
122 0x30a22c95, 0x31a70850, 0x60930f13,
123 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6,
124 0xa02b1741, 0x7cbad9a2, 0x2180036f,
125 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676,
126 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6,
127 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb,
128 0x846a3bae, 0x8ff77888, 0xee5d60f6,
129 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54,
130 0x157fd7fa, 0xef8579cc, 0xd152de58,
131 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5,
132 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906,
133 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8,
134 0xbec0c560, 0x61a3c9e8, 0xbca8f54d,
135 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc,
136 0x301e16e6, 0x273be979, 0xb0ffeaa6,
137 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a,
138 0xf7e19798, 0x7619b72f, 0x8f1c9ba4,
139 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e,
140 0x1a513742, 0xef6828bc, 0x520365d6,
141 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb,
142 0x5eea29cb, 0x145892f5, 0x91584f7f,
143 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4,
144 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249,
145 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3,
146 0x230eabb0, 0x6438bc87, 0xf0b5b1fa,
147 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589,
148 0xa345415e, 0x5c038323, 0x3e5d3bb9,
149 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539,
150 0x73bfbe70, 0x83877605, 0x4523ecf1
151};
152EXPORT_SYMBOL_GPL(cast_s2);
153
154const u32 cast_s3[256] = {
155 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff,
156 0x369fe44b, 0x8c1fc644, 0xaececa90,
157 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806,
158 0xf0ad0548, 0xe13c8d83, 0x927010d5,
159 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820,
160 0xfade82e0, 0xa067268b, 0x8272792e,
161 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee,
162 0x825b1bfd, 0x9255c5ed, 0x1257a240,
163 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf,
164 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5,
165 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1,
166 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b,
167 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c,
168 0x4a012d6e, 0xc5884a28, 0xccc36f71,
169 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850,
170 0xd7c07f7e, 0x02507fbf, 0x5afb9a04,
171 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e,
172 0x727cc3c4, 0x0a0fb402, 0x0f7fef82,
173 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0,
174 0x1eac5790, 0x796fb449, 0x8252dc15,
175 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403,
176 0xe83ec305, 0x4f91751a, 0x925669c2,
177 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574,
178 0x927985b2, 0x8276dbcb, 0x02778176,
179 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83,
180 0x340ce5c8, 0x96bbb682, 0x93b4b148,
181 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20,
182 0x8437aa88, 0x7d29dc96, 0x2756d3dc,
183 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e,
184 0x3cf8209d, 0x6094d1e3, 0xcd9ca341,
185 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9,
186 0xbda8229c, 0x127dadaa, 0x438a074e,
187 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff,
188 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51,
189 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a,
190 0x76a2e214, 0xb9a40368, 0x925d958f,
191 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623,
192 0x193cbcfa, 0x27627545, 0x825cf47a,
193 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7,
194 0x8272a972, 0x9270c4a8, 0x127de50b,
195 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb,
196 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b,
197 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11,
198 0x236a5cae, 0x12deca4d, 0x2c3f8cc5,
199 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c,
200 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45,
201 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40,
202 0x7c34671c, 0x02717ef6, 0x4feb5536,
203 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1,
204 0x006e1888, 0xa2e53f55, 0xb9e6d4bc,
205 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33,
206 0xabcc4f33, 0x7688c55d, 0x7b00a6b0,
207 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff,
208 0x856302e0, 0x72dbd92b, 0xee971b69,
209 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2,
210 0x61efc8c2, 0xf1ac2571, 0xcc8239c2,
211 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38,
212 0x0ff0443d, 0x606e6dc6, 0x60543a49,
213 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f,
214 0x68458425, 0x99833be5, 0x600d457d,
215 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31,
216 0x9c305a00, 0x52bce688, 0x1b03588a,
217 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636,
218 0xa133c501, 0xe9d3531c, 0xee353783
219};
220EXPORT_SYMBOL_GPL(cast_s3);
221
222const u32 cast_s4[256] = {
223 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb,
224 0x64ad8c57, 0x85510443, 0xfa020ed1,
225 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43,
226 0x6497b7b1, 0xf3641f63, 0x241e4adf,
227 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30,
228 0xc0a5374f, 0x1d2d00d9, 0x24147b15,
229 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f,
230 0x0c13fefe, 0x081b08ca, 0x05170121,
231 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f,
232 0x06df4261, 0xbb9e9b8a, 0x7293ea25,
233 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400,
234 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5,
235 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061,
236 0x11b638e1, 0x72500e03, 0xf80eb2bb,
237 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400,
238 0x6920318f, 0x081dbb99, 0xffc304a5,
239 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea,
240 0x9f926f91, 0x9f46222f, 0x3991467d,
241 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8,
242 0x3fb6180c, 0x18f8931e, 0x281658e6,
243 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25,
244 0x79098b02, 0xe4eabb81, 0x28123b23,
245 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9,
246 0x0014377b, 0x041e8ac8, 0x09114003,
247 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de,
248 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6,
249 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0,
250 0x56c8c391, 0x6b65811c, 0x5e146119,
251 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d,
252 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24,
253 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a,
254 0xeca1d7c7, 0x041afa32, 0x1d16625a,
255 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb,
256 0xc70b8b46, 0xd9e66a48, 0x56e55a79,
257 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3,
258 0xedda04eb, 0x17a9be04, 0x2c18f4df,
259 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254,
260 0xe5b6a035, 0x213d42f6, 0x2c1c7c26,
261 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2,
262 0x0418f2c8, 0x001a96a6, 0x0d1526ab,
263 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86,
264 0x311170a7, 0x3e9b640c, 0xcc3e10d7,
265 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1,
266 0x1f9af36e, 0xcfcbd12f, 0xc1de8417,
267 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca,
268 0xb4be31cd, 0xd8782806, 0x12a3a4e2,
269 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5,
270 0x9711aac5, 0x001d7b95, 0x82e5e7d2,
271 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415,
272 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a,
273 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7,
274 0x0ce454a9, 0xd60acd86, 0x015f1919,
275 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe,
276 0x8b75e387, 0xb3c50651, 0xb8a5c3ef,
277 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb,
278 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876,
279 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8,
280 0x296b299e, 0x492fc295, 0x9266beab,
281 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee,
282 0xf65324e6, 0x6afce36c, 0x0316cc04,
283 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979,
284 0x932bcdf6, 0xb657c34d, 0x4edfd282,
285 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0,
286 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2
287};
288EXPORT_SYMBOL_GPL(cast_s4);
289
290MODULE_LICENSE("GPL");
diff --git a/include/crypto/cast5.h b/include/crypto/cast5.h
index 586183a0406..14fbf39d638 100644
--- a/include/crypto/cast5.h
+++ b/include/crypto/cast5.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/crypto.h> 5#include <linux/crypto.h>
6#include <crypto/cast_common.h>
6 7
7#define CAST5_BLOCK_SIZE 8 8#define CAST5_BLOCK_SIZE 8
8#define CAST5_MIN_KEY_SIZE 5 9#define CAST5_MIN_KEY_SIZE 5
@@ -19,9 +20,4 @@ int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
19void __cast5_encrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src); 20void __cast5_encrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
20void __cast5_decrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src); 21void __cast5_decrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
21 22
22extern const u32 cast5_s1[256];
23extern const u32 cast5_s2[256];
24extern const u32 cast5_s3[256];
25extern const u32 cast5_s4[256];
26
27#endif 23#endif
diff --git a/include/crypto/cast6.h b/include/crypto/cast6.h
index 157af6f342c..32b60eb8bd2 100644
--- a/include/crypto/cast6.h
+++ b/include/crypto/cast6.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/crypto.h> 5#include <linux/crypto.h>
6#include <crypto/cast_common.h>
6 7
7#define CAST6_BLOCK_SIZE 16 8#define CAST6_BLOCK_SIZE 16
8#define CAST6_MIN_KEY_SIZE 16 9#define CAST6_MIN_KEY_SIZE 16
@@ -20,9 +21,4 @@ int cast6_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
20void __cast6_encrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src); 21void __cast6_encrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src);
21void __cast6_decrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src); 22void __cast6_decrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src);
22 23
23extern const u32 cast6_s1[256];
24extern const u32 cast6_s2[256];
25extern const u32 cast6_s3[256];
26extern const u32 cast6_s4[256];
27
28#endif 24#endif
diff --git a/include/crypto/cast_common.h b/include/crypto/cast_common.h
new file mode 100644
index 00000000000..b7df35cd9f0
--- /dev/null
+++ b/include/crypto/cast_common.h
@@ -0,0 +1,9 @@
1#ifndef _CRYPTO_CAST_COMMON_H
2#define _CRYPTO_CAST_COMMON_H
3
4extern const u32 cast_s1[256];
5extern const u32 cast_s2[256];
6extern const u32 cast_s3[256];
7extern const u32 cast_s4[256];
8
9#endif