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()
133 if (rctx->cryptlen == 0) in chacha_decrypt()
138 sg_init_table(rctx->src, 2); in chacha_decrypt()
139 src = scatterwalk_ffwd(rctx->src, req->src, req->assoclen); in chacha_decrypt()
143 sg_init_table(rctx->dst, 2); in chacha_decrypt()
144 dst = scatterwalk_ffwd(rctx->dst, req->dst, req->assoclen); in chacha_decrypt()
151 rctx->cryptlen, creq->iv); in chacha_decrypt()
162 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_tail_continue() local
164 if (rctx->cryptlen == req->cryptlen) /* encrypting */ in poly_tail_continue()
179 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_tail() local
180 struct poly_req *preq = &rctx->u.poly; in poly_tail()
185 len = cpu_to_le64(rctx->assoclen); in poly_tail()
187 len = cpu_to_le64(rctx->cryptlen); in poly_tail()
195 rctx->tag, sizeof(preq->tail)); in poly_tail()
212 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_cipherpad() local
213 struct poly_req *preq = &rctx->u.poly; in poly_cipherpad()
217 padlen = (bs - (rctx->cryptlen % bs)) % bs; in poly_cipherpad()
242 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_cipher() local
243 struct poly_req *preq = &rctx->u.poly; in poly_cipher()
247 if (rctx->cryptlen == req->cryptlen) /* encrypting */ in poly_cipher()
250 sg_init_table(rctx->src, 2); in poly_cipher()
251 crypt = scatterwalk_ffwd(rctx->src, crypt, req->assoclen); in poly_cipher()
256 ahash_request_set_crypt(&preq->req, crypt, NULL, rctx->cryptlen); in poly_cipher()
273 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_adpad() local
274 struct poly_req *preq = &rctx->u.poly; in poly_adpad()
278 padlen = (bs - (rctx->assoclen % bs)) % bs; in poly_adpad()
303 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_ad() local
304 struct poly_req *preq = &rctx->u.poly; in poly_ad()
310 ahash_request_set_crypt(&preq->req, req->src, NULL, rctx->assoclen); in poly_ad()
327 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_setkey() local
328 struct poly_req *preq = &rctx->u.poly; in poly_setkey()
332 sg_set_buf(preq->src, rctx->key, sizeof(rctx->key)); in poly_setkey()
337 ahash_request_set_crypt(&preq->req, preq->src, NULL, sizeof(rctx->key)); in poly_setkey()
354 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_init() local
355 struct poly_req *preq = &rctx->u.poly; in poly_init()
378 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_genkey() local
379 struct chacha_req *creq = &rctx->u.chacha; in poly_genkey()
382 rctx->assoclen = req->assoclen; in poly_genkey()
385 if (rctx->assoclen < 8) in poly_genkey()
387 rctx->assoclen -= 8; in poly_genkey()
391 memset(rctx->key, 0, sizeof(rctx->key)); in poly_genkey()
392 sg_set_buf(creq->src, rctx->key, sizeof(rctx->key)); in poly_genkey()
417 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chacha_encrypt() local
418 struct chacha_req *creq = &rctx->u.chacha; in chacha_encrypt()
427 sg_init_table(rctx->src, 2); in chacha_encrypt()
428 src = scatterwalk_ffwd(rctx->src, req->src, req->assoclen); in chacha_encrypt()
432 sg_init_table(rctx->dst, 2); in chacha_encrypt()
433 dst = scatterwalk_ffwd(rctx->dst, req->dst, req->assoclen); in chacha_encrypt()
451 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chachapoly_encrypt() local
453 rctx->cryptlen = req->cryptlen; in chachapoly_encrypt()
472 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in chachapoly_decrypt() local
474 rctx->cryptlen = req->cryptlen - POLY1305_DIGEST_SIZE; in chachapoly_decrypt()