Lines Matching +full:4 +full:c
3 * cast6.c - Cast6 cipher algorithm [rfc2612].
9 * Copyright (C) 2003 Kartikey Mahendra Bhatt <kartik_me@hotmail.com>.
85 static const u8 Tr[4][8] = {
96 key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]); in W()
97 key[5] ^= F2(key[6], Tr[i % 4][1], Tm[i][1]); in W()
98 key[4] ^= F3(key[5], Tr[i % 4][2], Tm[i][2]); in W()
99 key[3] ^= F1(key[4], Tr[i % 4][3], Tm[i][3]); in W()
100 key[2] ^= F2(key[3], Tr[i % 4][4], Tm[i][4]); in W()
101 key[1] ^= F3(key[2], Tr[i % 4][5], Tm[i][5]); in W()
102 key[0] ^= F1(key[1], Tr[i % 4][6], Tm[i][6]); in W()
103 key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]); in W()
106 int __cast6_setkey(struct cast6_ctx *c, const u8 *in_key, unsigned int key_len) in __cast6_setkey() argument
112 if (key_len % 4 != 0) in __cast6_setkey()
120 key[2] = be32_to_cpu(p_key[2]); /* C */ in __cast6_setkey()
122 key[4] = be32_to_cpu(p_key[4]); /* E */ in __cast6_setkey()
131 c->Kr[i][0] = key[0] & 0x1f; in __cast6_setkey()
132 c->Kr[i][1] = key[2] & 0x1f; in __cast6_setkey()
133 c->Kr[i][2] = key[4] & 0x1f; in __cast6_setkey()
134 c->Kr[i][3] = key[6] & 0x1f; in __cast6_setkey()
136 c->Km[i][0] = key[7]; in __cast6_setkey()
137 c->Km[i][1] = key[5]; in __cast6_setkey()
138 c->Km[i][2] = key[3]; in __cast6_setkey()
139 c->Km[i][3] = key[1]; in __cast6_setkey()
174 const struct cast6_ctx *c = ctx; in __cast6_encrypt() local
175 u32 block[4]; in __cast6_encrypt()
180 block[1] = get_unaligned_be32(inbuf + 4); in __cast6_encrypt()
184 Km = c->Km[0]; Kr = c->Kr[0]; Q(block, Kr, Km); in __cast6_encrypt()
185 Km = c->Km[1]; Kr = c->Kr[1]; Q(block, Kr, Km); in __cast6_encrypt()
186 Km = c->Km[2]; Kr = c->Kr[2]; Q(block, Kr, Km); in __cast6_encrypt()
187 Km = c->Km[3]; Kr = c->Kr[3]; Q(block, Kr, Km); in __cast6_encrypt()
188 Km = c->Km[4]; Kr = c->Kr[4]; Q(block, Kr, Km); in __cast6_encrypt()
189 Km = c->Km[5]; Kr = c->Kr[5]; Q(block, Kr, Km); in __cast6_encrypt()
190 Km = c->Km[6]; Kr = c->Kr[6]; QBAR(block, Kr, Km); in __cast6_encrypt()
191 Km = c->Km[7]; Kr = c->Kr[7]; QBAR(block, Kr, Km); in __cast6_encrypt()
192 Km = c->Km[8]; Kr = c->Kr[8]; QBAR(block, Kr, Km); in __cast6_encrypt()
193 Km = c->Km[9]; Kr = c->Kr[9]; QBAR(block, Kr, Km); in __cast6_encrypt()
194 Km = c->Km[10]; Kr = c->Kr[10]; QBAR(block, Kr, Km); in __cast6_encrypt()
195 Km = c->Km[11]; Kr = c->Kr[11]; QBAR(block, Kr, Km); in __cast6_encrypt()
198 put_unaligned_be32(block[1], outbuf + 4); in __cast6_encrypt()
211 const struct cast6_ctx *c = ctx; in __cast6_decrypt() local
212 u32 block[4]; in __cast6_decrypt()
217 block[1] = get_unaligned_be32(inbuf + 4); in __cast6_decrypt()
221 Km = c->Km[11]; Kr = c->Kr[11]; Q(block, Kr, Km); in __cast6_decrypt()
222 Km = c->Km[10]; Kr = c->Kr[10]; Q(block, Kr, Km); in __cast6_decrypt()
223 Km = c->Km[9]; Kr = c->Kr[9]; Q(block, Kr, Km); in __cast6_decrypt()
224 Km = c->Km[8]; Kr = c->Kr[8]; Q(block, Kr, Km); in __cast6_decrypt()
225 Km = c->Km[7]; Kr = c->Kr[7]; Q(block, Kr, Km); in __cast6_decrypt()
226 Km = c->Km[6]; Kr = c->Kr[6]; Q(block, Kr, Km); in __cast6_decrypt()
227 Km = c->Km[5]; Kr = c->Kr[5]; QBAR(block, Kr, Km); in __cast6_decrypt()
228 Km = c->Km[4]; Kr = c->Kr[4]; QBAR(block, Kr, Km); in __cast6_decrypt()
229 Km = c->Km[3]; Kr = c->Kr[3]; QBAR(block, Kr, Km); in __cast6_decrypt()
230 Km = c->Km[2]; Kr = c->Kr[2]; QBAR(block, Kr, Km); in __cast6_decrypt()
231 Km = c->Km[1]; Kr = c->Kr[1]; QBAR(block, Kr, Km); in __cast6_decrypt()
232 Km = c->Km[0]; Kr = c->Kr[0]; QBAR(block, Kr, Km); in __cast6_decrypt()
235 put_unaligned_be32(block[1], outbuf + 4); in __cast6_decrypt()