Lines Matching refs:rctx
99 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_verify_tag() local
100 u8 tag[sizeof(rctx->tag)]; in poly_verify_tag()
103 req->assoclen + rctx->cryptlen, in poly_verify_tag()
105 if (crypto_memneq(tag, rctx->tag, sizeof(tag))) in poly_verify_tag()
112 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_copy_tag() local
114 scatterwalk_map_and_copy(rctx->tag, req->dst, in poly_copy_tag()
115 req->assoclen + rctx->cryptlen, in poly_copy_tag()
116 sizeof(rctx->tag), 1); in poly_copy_tag()
128 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chacha_decrypt() local
129 struct chacha_req *creq = &rctx->u.chacha; in chacha_decrypt()
135 sg_init_table(rctx->src, 2); in chacha_decrypt()
136 src = scatterwalk_ffwd(rctx->src, req->src, req->assoclen); in chacha_decrypt()
140 sg_init_table(rctx->dst, 2); in chacha_decrypt()
141 dst = scatterwalk_ffwd(rctx->dst, req->dst, req->assoclen); in chacha_decrypt()
148 rctx->cryptlen, creq->iv); in chacha_decrypt()
158 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_tail_continue() local
160 if (rctx->cryptlen == req->cryptlen) /* encrypting */ in poly_tail_continue()
175 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_tail() local
176 struct poly_req *preq = &rctx->u.poly; in poly_tail()
181 len = cpu_to_le64(rctx->assoclen); in poly_tail()
183 len = cpu_to_le64(rctx->cryptlen); in poly_tail()
191 rctx->tag, sizeof(preq->tail)); in poly_tail()
208 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_cipherpad() local
209 struct poly_req *preq = &rctx->u.poly; in poly_cipherpad()
213 padlen = (bs - (rctx->cryptlen % bs)) % bs; in poly_cipherpad()
238 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_cipher() local
239 struct poly_req *preq = &rctx->u.poly; in poly_cipher()
243 if (rctx->cryptlen == req->cryptlen) /* encrypting */ in poly_cipher()
246 sg_init_table(rctx->src, 2); in poly_cipher()
247 crypt = scatterwalk_ffwd(rctx->src, crypt, req->assoclen); in poly_cipher()
252 ahash_request_set_crypt(&preq->req, crypt, NULL, rctx->cryptlen); in poly_cipher()
269 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_adpad() local
270 struct poly_req *preq = &rctx->u.poly; in poly_adpad()
274 padlen = (bs - (rctx->assoclen % bs)) % bs; in poly_adpad()
299 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_ad() local
300 struct poly_req *preq = &rctx->u.poly; in poly_ad()
306 ahash_request_set_crypt(&preq->req, req->src, NULL, rctx->assoclen); in poly_ad()
323 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_setkey() local
324 struct poly_req *preq = &rctx->u.poly; in poly_setkey()
328 sg_set_buf(preq->src, rctx->key, sizeof(rctx->key)); in poly_setkey()
333 ahash_request_set_crypt(&preq->req, preq->src, NULL, sizeof(rctx->key)); in poly_setkey()
350 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_init() local
351 struct poly_req *preq = &rctx->u.poly; in poly_init()
374 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_genkey() local
375 struct chacha_req *creq = &rctx->u.chacha; in poly_genkey()
378 rctx->assoclen = req->assoclen; in poly_genkey()
381 if (rctx->assoclen < 8) in poly_genkey()
383 rctx->assoclen -= 8; in poly_genkey()
387 memset(rctx->key, 0, sizeof(rctx->key)); in poly_genkey()
388 sg_set_buf(creq->src, rctx->key, sizeof(rctx->key)); in poly_genkey()
413 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chacha_encrypt() local
414 struct chacha_req *creq = &rctx->u.chacha; in chacha_encrypt()
420 sg_init_table(rctx->src, 2); in chacha_encrypt()
421 src = scatterwalk_ffwd(rctx->src, req->src, req->assoclen); in chacha_encrypt()
425 sg_init_table(rctx->dst, 2); in chacha_encrypt()
426 dst = scatterwalk_ffwd(rctx->dst, req->dst, req->assoclen); in chacha_encrypt()
443 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chachapoly_encrypt() local
445 rctx->cryptlen = req->cryptlen; in chachapoly_encrypt()
464 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chachapoly_decrypt() local
466 rctx->cryptlen = req->cryptlen - POLY1305_DIGEST_SIZE; in chachapoly_decrypt()