Lines Matching refs:state
42 void (*crypt_chunk)(struct aegis_state *state, u8 *dst,
69 void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg);
70 void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst,
72 void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst,
75 static void crypto_aegis128_update(struct aegis_state *state) in crypto_aegis128_update() argument
80 tmp = state->blocks[AEGIS128_STATE_BLOCKS - 1]; in crypto_aegis128_update()
82 crypto_aegis_aesenc(&state->blocks[i], &state->blocks[i - 1], in crypto_aegis128_update()
83 &state->blocks[i]); in crypto_aegis128_update()
84 crypto_aegis_aesenc(&state->blocks[0], &tmp, &state->blocks[0]); in crypto_aegis128_update()
87 static void crypto_aegis128_update_a(struct aegis_state *state, in crypto_aegis128_update_a() argument
91 crypto_aegis128_update_simd(state, msg); in crypto_aegis128_update_a()
95 crypto_aegis128_update(state); in crypto_aegis128_update_a()
96 crypto_aegis_block_xor(&state->blocks[0], msg); in crypto_aegis128_update_a()
99 static void crypto_aegis128_update_u(struct aegis_state *state, const void *msg) in crypto_aegis128_update_u() argument
102 crypto_aegis128_update_simd(state, msg); in crypto_aegis128_update_u()
106 crypto_aegis128_update(state); in crypto_aegis128_update_u()
107 crypto_xor(state->blocks[0].bytes, msg, AEGIS_BLOCK_SIZE); in crypto_aegis128_update_u()
110 static void crypto_aegis128_init(struct aegis_state *state, in crypto_aegis128_init() argument
120 state->blocks[0] = key_iv; in crypto_aegis128_init()
121 state->blocks[1] = crypto_aegis_const[1]; in crypto_aegis128_init()
122 state->blocks[2] = crypto_aegis_const[0]; in crypto_aegis128_init()
123 state->blocks[3] = *key; in crypto_aegis128_init()
124 state->blocks[4] = *key; in crypto_aegis128_init()
126 crypto_aegis_block_xor(&state->blocks[3], &crypto_aegis_const[0]); in crypto_aegis128_init()
127 crypto_aegis_block_xor(&state->blocks[4], &crypto_aegis_const[1]); in crypto_aegis128_init()
130 crypto_aegis128_update_a(state, key); in crypto_aegis128_init()
131 crypto_aegis128_update_a(state, &key_iv); in crypto_aegis128_init()
135 static void crypto_aegis128_ad(struct aegis_state *state, in crypto_aegis128_ad() argument
143 crypto_aegis128_update_a(state, src_blk); in crypto_aegis128_ad()
150 crypto_aegis128_update_u(state, src); in crypto_aegis128_ad()
158 static void crypto_aegis128_encrypt_chunk(struct aegis_state *state, u8 *dst, in crypto_aegis128_encrypt_chunk() argument
170 tmp = state->blocks[2]; in crypto_aegis128_encrypt_chunk()
171 crypto_aegis_block_and(&tmp, &state->blocks[3]); in crypto_aegis128_encrypt_chunk()
172 crypto_aegis_block_xor(&tmp, &state->blocks[4]); in crypto_aegis128_encrypt_chunk()
173 crypto_aegis_block_xor(&tmp, &state->blocks[1]); in crypto_aegis128_encrypt_chunk()
176 crypto_aegis128_update_a(state, src_blk); in crypto_aegis128_encrypt_chunk()
186 tmp = state->blocks[2]; in crypto_aegis128_encrypt_chunk()
187 crypto_aegis_block_and(&tmp, &state->blocks[3]); in crypto_aegis128_encrypt_chunk()
188 crypto_aegis_block_xor(&tmp, &state->blocks[4]); in crypto_aegis128_encrypt_chunk()
189 crypto_aegis_block_xor(&tmp, &state->blocks[1]); in crypto_aegis128_encrypt_chunk()
192 crypto_aegis128_update_u(state, src); in crypto_aegis128_encrypt_chunk()
206 tmp = state->blocks[2]; in crypto_aegis128_encrypt_chunk()
207 crypto_aegis_block_and(&tmp, &state->blocks[3]); in crypto_aegis128_encrypt_chunk()
208 crypto_aegis_block_xor(&tmp, &state->blocks[4]); in crypto_aegis128_encrypt_chunk()
209 crypto_aegis_block_xor(&tmp, &state->blocks[1]); in crypto_aegis128_encrypt_chunk()
211 crypto_aegis128_update_a(state, &msg); in crypto_aegis128_encrypt_chunk()
219 static void crypto_aegis128_decrypt_chunk(struct aegis_state *state, u8 *dst, in crypto_aegis128_decrypt_chunk() argument
231 tmp = state->blocks[2]; in crypto_aegis128_decrypt_chunk()
232 crypto_aegis_block_and(&tmp, &state->blocks[3]); in crypto_aegis128_decrypt_chunk()
233 crypto_aegis_block_xor(&tmp, &state->blocks[4]); in crypto_aegis128_decrypt_chunk()
234 crypto_aegis_block_xor(&tmp, &state->blocks[1]); in crypto_aegis128_decrypt_chunk()
237 crypto_aegis128_update_a(state, &tmp); in crypto_aegis128_decrypt_chunk()
247 tmp = state->blocks[2]; in crypto_aegis128_decrypt_chunk()
248 crypto_aegis_block_and(&tmp, &state->blocks[3]); in crypto_aegis128_decrypt_chunk()
249 crypto_aegis_block_xor(&tmp, &state->blocks[4]); in crypto_aegis128_decrypt_chunk()
250 crypto_aegis_block_xor(&tmp, &state->blocks[1]); in crypto_aegis128_decrypt_chunk()
253 crypto_aegis128_update_a(state, &tmp); in crypto_aegis128_decrypt_chunk()
267 tmp = state->blocks[2]; in crypto_aegis128_decrypt_chunk()
268 crypto_aegis_block_and(&tmp, &state->blocks[3]); in crypto_aegis128_decrypt_chunk()
269 crypto_aegis_block_xor(&tmp, &state->blocks[4]); in crypto_aegis128_decrypt_chunk()
270 crypto_aegis_block_xor(&tmp, &state->blocks[1]); in crypto_aegis128_decrypt_chunk()
275 crypto_aegis128_update_a(state, &msg); in crypto_aegis128_decrypt_chunk()
281 static void crypto_aegis128_process_ad(struct aegis_state *state, in crypto_aegis128_process_ad() argument
300 crypto_aegis128_update_a(state, &buf); in crypto_aegis128_process_ad()
306 crypto_aegis128_ad(state, src, left); in crypto_aegis128_process_ad()
322 crypto_aegis128_update_a(state, &buf); in crypto_aegis128_process_ad()
326 static void crypto_aegis128_process_crypt(struct aegis_state *state, in crypto_aegis128_process_crypt() argument
340 ops->crypt_chunk(state, walk.dst.virt.addr, walk.src.virt.addr, in crypto_aegis128_process_crypt()
347 static void crypto_aegis128_final(struct aegis_state *state, in crypto_aegis128_final() argument
360 crypto_aegis_block_xor(&tmp, &state->blocks[3]); in crypto_aegis128_final()
363 crypto_aegis128_update_a(state, &tmp); in crypto_aegis128_final()
366 crypto_aegis_block_xor(tag_xor, &state->blocks[i]); in crypto_aegis128_final()
400 struct aegis_state state; in crypto_aegis128_crypt() local
402 crypto_aegis128_init(&state, &ctx->key, req->iv); in crypto_aegis128_crypt()
403 crypto_aegis128_process_ad(&state, req->src, req->assoclen); in crypto_aegis128_crypt()
404 crypto_aegis128_process_crypt(&state, req, ops); in crypto_aegis128_crypt()
405 crypto_aegis128_final(&state, tag_xor, req->assoclen, cryptlen); in crypto_aegis128_crypt()