1919#define CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS 32
2020
2121/* 32-way AVX2/AES-NI parallel cipher functions */
22- asmlinkage void camellia_ecb_enc_32way (struct camellia_ctx * ctx , u8 * dst ,
23- const u8 * src );
24- asmlinkage void camellia_ecb_dec_32way (struct camellia_ctx * ctx , u8 * dst ,
25- const u8 * src );
22+ asmlinkage void camellia_ecb_enc_32way (const void * ctx , u8 * dst , const u8 * src );
23+ asmlinkage void camellia_ecb_dec_32way (const void * ctx , u8 * dst , const u8 * src );
2624
27- asmlinkage void camellia_cbc_dec_32way (struct camellia_ctx * ctx , u8 * dst ,
28- const u8 * src );
29- asmlinkage void camellia_ctr_32way (struct camellia_ctx * ctx , u8 * dst ,
30- const u8 * src , le128 * iv );
25+ asmlinkage void camellia_cbc_dec_32way (const void * ctx , u8 * dst , const u8 * src );
26+ asmlinkage void camellia_ctr_32way (const void * ctx , u8 * dst , const u8 * src ,
27+ le128 * iv );
3128
32- asmlinkage void camellia_xts_enc_32way (struct camellia_ctx * ctx , u8 * dst ,
33- const u8 * src , le128 * iv );
34- asmlinkage void camellia_xts_dec_32way (struct camellia_ctx * ctx , u8 * dst ,
35- const u8 * src , le128 * iv );
29+ asmlinkage void camellia_xts_enc_32way (const void * ctx , u8 * dst , const u8 * src ,
30+ le128 * iv );
31+ asmlinkage void camellia_xts_dec_32way (const void * ctx , u8 * dst , const u8 * src ,
32+ le128 * iv );
3633
3734static const struct common_glue_ctx camellia_enc = {
3835 .num_funcs = 4 ,
3936 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
4037
4138 .funcs = { {
4239 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS ,
43- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_ecb_enc_32way ) }
40+ .fn_u = { .ecb = camellia_ecb_enc_32way }
4441 }, {
4542 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
46- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_ecb_enc_16way ) }
43+ .fn_u = { .ecb = camellia_ecb_enc_16way }
4744 }, {
4845 .num_blocks = 2 ,
49- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_enc_blk_2way ) }
46+ .fn_u = { .ecb = camellia_enc_blk_2way }
5047 }, {
5148 .num_blocks = 1 ,
52- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_enc_blk ) }
49+ .fn_u = { .ecb = camellia_enc_blk }
5350 } }
5451};
5552
@@ -59,16 +56,16 @@ static const struct common_glue_ctx camellia_ctr = {
5956
6057 .funcs = { {
6158 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS ,
62- .fn_u = { .ctr = GLUE_CTR_FUNC_CAST ( camellia_ctr_32way ) }
59+ .fn_u = { .ctr = camellia_ctr_32way }
6360 }, {
6461 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
65- .fn_u = { .ctr = GLUE_CTR_FUNC_CAST ( camellia_ctr_16way ) }
62+ .fn_u = { .ctr = camellia_ctr_16way }
6663 }, {
6764 .num_blocks = 2 ,
68- .fn_u = { .ctr = GLUE_CTR_FUNC_CAST ( camellia_crypt_ctr_2way ) }
65+ .fn_u = { .ctr = camellia_crypt_ctr_2way }
6966 }, {
7067 .num_blocks = 1 ,
71- .fn_u = { .ctr = GLUE_CTR_FUNC_CAST ( camellia_crypt_ctr ) }
68+ .fn_u = { .ctr = camellia_crypt_ctr }
7269 } }
7370};
7471
@@ -78,13 +75,13 @@ static const struct common_glue_ctx camellia_enc_xts = {
7875
7976 .funcs = { {
8077 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS ,
81- .fn_u = { .xts = GLUE_XTS_FUNC_CAST ( camellia_xts_enc_32way ) }
78+ .fn_u = { .xts = camellia_xts_enc_32way }
8279 }, {
8380 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
84- .fn_u = { .xts = GLUE_XTS_FUNC_CAST ( camellia_xts_enc_16way ) }
81+ .fn_u = { .xts = camellia_xts_enc_16way }
8582 }, {
8683 .num_blocks = 1 ,
87- .fn_u = { .xts = GLUE_XTS_FUNC_CAST ( camellia_xts_enc ) }
84+ .fn_u = { .xts = camellia_xts_enc }
8885 } }
8986};
9087
@@ -94,16 +91,16 @@ static const struct common_glue_ctx camellia_dec = {
9491
9592 .funcs = { {
9693 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS ,
97- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_ecb_dec_32way ) }
94+ .fn_u = { .ecb = camellia_ecb_dec_32way }
9895 }, {
9996 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
100- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_ecb_dec_16way ) }
97+ .fn_u = { .ecb = camellia_ecb_dec_16way }
10198 }, {
10299 .num_blocks = 2 ,
103- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_dec_blk_2way ) }
100+ .fn_u = { .ecb = camellia_dec_blk_2way }
104101 }, {
105102 .num_blocks = 1 ,
106- .fn_u = { .ecb = GLUE_FUNC_CAST ( camellia_dec_blk ) }
103+ .fn_u = { .ecb = camellia_dec_blk }
107104 } }
108105};
109106
@@ -113,16 +110,16 @@ static const struct common_glue_ctx camellia_dec_cbc = {
113110
114111 .funcs = { {
115112 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS ,
116- .fn_u = { .cbc = GLUE_CBC_FUNC_CAST ( camellia_cbc_dec_32way ) }
113+ .fn_u = { .cbc = camellia_cbc_dec_32way }
117114 }, {
118115 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
119- .fn_u = { .cbc = GLUE_CBC_FUNC_CAST ( camellia_cbc_dec_16way ) }
116+ .fn_u = { .cbc = camellia_cbc_dec_16way }
120117 }, {
121118 .num_blocks = 2 ,
122- .fn_u = { .cbc = GLUE_CBC_FUNC_CAST ( camellia_decrypt_cbc_2way ) }
119+ .fn_u = { .cbc = camellia_decrypt_cbc_2way }
123120 }, {
124121 .num_blocks = 1 ,
125- .fn_u = { .cbc = GLUE_CBC_FUNC_CAST ( camellia_dec_blk ) }
122+ .fn_u = { .cbc = camellia_dec_blk }
126123 } }
127124};
128125
@@ -132,13 +129,13 @@ static const struct common_glue_ctx camellia_dec_xts = {
132129
133130 .funcs = { {
134131 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS ,
135- .fn_u = { .xts = GLUE_XTS_FUNC_CAST ( camellia_xts_dec_32way ) }
132+ .fn_u = { .xts = camellia_xts_dec_32way }
136133 }, {
137134 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS ,
138- .fn_u = { .xts = GLUE_XTS_FUNC_CAST ( camellia_xts_dec_16way ) }
135+ .fn_u = { .xts = camellia_xts_dec_16way }
139136 }, {
140137 .num_blocks = 1 ,
141- .fn_u = { .xts = GLUE_XTS_FUNC_CAST ( camellia_xts_dec ) }
138+ .fn_u = { .xts = camellia_xts_dec }
142139 } }
143140};
144141
@@ -161,8 +158,7 @@ static int ecb_decrypt(struct skcipher_request *req)
161158
162159static int cbc_encrypt (struct skcipher_request * req )
163160{
164- return glue_cbc_encrypt_req_128bit (GLUE_FUNC_CAST (camellia_enc_blk ),
165- req );
161+ return glue_cbc_encrypt_req_128bit (camellia_enc_blk , req );
166162}
167163
168164static int cbc_decrypt (struct skcipher_request * req )
@@ -180,8 +176,7 @@ static int xts_encrypt(struct skcipher_request *req)
180176 struct crypto_skcipher * tfm = crypto_skcipher_reqtfm (req );
181177 struct camellia_xts_ctx * ctx = crypto_skcipher_ctx (tfm );
182178
183- return glue_xts_req_128bit (& camellia_enc_xts , req ,
184- XTS_TWEAK_CAST (camellia_enc_blk ),
179+ return glue_xts_req_128bit (& camellia_enc_xts , req , camellia_enc_blk ,
185180 & ctx -> tweak_ctx , & ctx -> crypt_ctx , false);
186181}
187182
@@ -190,8 +185,7 @@ static int xts_decrypt(struct skcipher_request *req)
190185 struct crypto_skcipher * tfm = crypto_skcipher_reqtfm (req );
191186 struct camellia_xts_ctx * ctx = crypto_skcipher_ctx (tfm );
192187
193- return glue_xts_req_128bit (& camellia_dec_xts , req ,
194- XTS_TWEAK_CAST (camellia_enc_blk ),
188+ return glue_xts_req_128bit (& camellia_dec_xts , req , camellia_enc_blk ,
195189 & ctx -> tweak_ctx , & ctx -> crypt_ctx , true);
196190}
197191
0 commit comments