Lines Matching refs:rctx
31 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); in qce_skcipher_done() local
50 dma_unmap_sg(qce->dev, rctx->src_sg, rctx->src_nents, dir_src); in qce_skcipher_done()
51 dma_unmap_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); in qce_skcipher_done()
53 sg_free_table(&rctx->dst_tbl); in qce_skcipher_done()
59 memcpy(rctx->iv, result_buf->encr_cntr_iv, rctx->ivsize); in qce_skcipher_done()
67 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); in qce_skcipher_async_req_handle() local
77 rctx->iv = req->iv; in qce_skcipher_async_req_handle()
78 rctx->ivsize = crypto_skcipher_ivsize(skcipher); in qce_skcipher_async_req_handle()
79 rctx->cryptlen = req->cryptlen; in qce_skcipher_async_req_handle()
85 rctx->src_nents = sg_nents_for_len(req->src, req->cryptlen); in qce_skcipher_async_req_handle()
87 rctx->dst_nents = sg_nents_for_len(req->dst, req->cryptlen); in qce_skcipher_async_req_handle()
89 rctx->dst_nents = rctx->src_nents; in qce_skcipher_async_req_handle()
90 if (rctx->src_nents < 0) { in qce_skcipher_async_req_handle()
92 return rctx->src_nents; in qce_skcipher_async_req_handle()
94 if (rctx->dst_nents < 0) { in qce_skcipher_async_req_handle()
96 return -rctx->dst_nents; in qce_skcipher_async_req_handle()
99 rctx->dst_nents += 1; in qce_skcipher_async_req_handle()
104 ret = sg_alloc_table(&rctx->dst_tbl, rctx->dst_nents, gfp); in qce_skcipher_async_req_handle()
108 sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); in qce_skcipher_async_req_handle()
110 sg = qce_sgtable_add(&rctx->dst_tbl, req->dst, req->cryptlen); in qce_skcipher_async_req_handle()
116 sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg, in qce_skcipher_async_req_handle()
124 rctx->dst_sg = rctx->dst_tbl.sgl; in qce_skcipher_async_req_handle()
126 dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); in qce_skcipher_async_req_handle()
133 src_nents = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src); in qce_skcipher_async_req_handle()
138 rctx->src_sg = req->src; in qce_skcipher_async_req_handle()
140 rctx->src_sg = rctx->dst_sg; in qce_skcipher_async_req_handle()
144 ret = qce_dma_prep_sgs(&qce->dma, rctx->src_sg, src_nents, in qce_skcipher_async_req_handle()
145 rctx->dst_sg, dst_nents, in qce_skcipher_async_req_handle()
162 dma_unmap_sg(qce->dev, req->src, rctx->src_nents, dir_src); in qce_skcipher_async_req_handle()
164 dma_unmap_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); in qce_skcipher_async_req_handle()
166 sg_free_table(&rctx->dst_tbl); in qce_skcipher_async_req_handle()
260 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); in qce_skcipher_crypt() local
266 rctx->flags = tmpl->alg_flags; in qce_skcipher_crypt()
267 rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; in qce_skcipher_crypt()
268 keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen; in qce_skcipher_crypt()
278 if (IS_ECB(rctx->flags) || IS_CBC(rctx->flags)) in qce_skcipher_crypt()
290 if (IS_AES(rctx->flags) && in qce_skcipher_crypt()
292 (IS_XTS(rctx->flags) && ((req->cryptlen <= aes_sw_max_len) || in qce_skcipher_crypt()
295 skcipher_request_set_tfm(&rctx->fallback_req, ctx->fallback); in qce_skcipher_crypt()
296 skcipher_request_set_callback(&rctx->fallback_req, in qce_skcipher_crypt()
300 skcipher_request_set_crypt(&rctx->fallback_req, req->src, in qce_skcipher_crypt()
302 ret = encrypt ? crypto_skcipher_encrypt(&rctx->fallback_req) : in qce_skcipher_crypt()
303 crypto_skcipher_decrypt(&rctx->fallback_req); in qce_skcipher_crypt()