Lines Matching refs:rctx
57 struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sun8i_ce_cipher_fallback() local
67 skcipher_request_set_tfm(&rctx->fallback_req, op->fallback_tfm); in sun8i_ce_cipher_fallback()
68 skcipher_request_set_callback(&rctx->fallback_req, areq->base.flags, in sun8i_ce_cipher_fallback()
70 skcipher_request_set_crypt(&rctx->fallback_req, areq->src, areq->dst, in sun8i_ce_cipher_fallback()
72 if (rctx->op_dir & CE_DECRYPTION) in sun8i_ce_cipher_fallback()
73 err = crypto_skcipher_decrypt(&rctx->fallback_req); in sun8i_ce_cipher_fallback()
75 err = crypto_skcipher_encrypt(&rctx->fallback_req); in sun8i_ce_cipher_fallback()
85 struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sun8i_ce_cipher_prepare() local
103 rctx->op_dir, areq->iv, crypto_skcipher_ivsize(tfm), in sun8i_ce_cipher_prepare()
110 flow = rctx->flow; in sun8i_ce_cipher_prepare()
119 common |= rctx->op_dir | CE_COMM_INT; in sun8i_ce_cipher_prepare()
144 rctx->addr_key = dma_map_single(ce->dev, op->key, op->keylen, DMA_TO_DEVICE); in sun8i_ce_cipher_prepare()
145 if (dma_mapping_error(ce->dev, rctx->addr_key)) { in sun8i_ce_cipher_prepare()
150 cet->t_key = cpu_to_le32(rctx->addr_key); in sun8i_ce_cipher_prepare()
154 rctx->ivlen = ivsize; in sun8i_ce_cipher_prepare()
155 rctx->bounce_iv = kzalloc(ivsize, GFP_KERNEL | GFP_DMA); in sun8i_ce_cipher_prepare()
156 if (!rctx->bounce_iv) { in sun8i_ce_cipher_prepare()
160 if (rctx->op_dir & CE_DECRYPTION) { in sun8i_ce_cipher_prepare()
161 rctx->backup_iv = kzalloc(ivsize, GFP_KERNEL); in sun8i_ce_cipher_prepare()
162 if (!rctx->backup_iv) { in sun8i_ce_cipher_prepare()
167 scatterwalk_map_and_copy(rctx->backup_iv, areq->src, in sun8i_ce_cipher_prepare()
170 memcpy(rctx->bounce_iv, areq->iv, ivsize); in sun8i_ce_cipher_prepare()
171 rctx->addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen, in sun8i_ce_cipher_prepare()
173 if (dma_mapping_error(ce->dev, rctx->addr_iv)) { in sun8i_ce_cipher_prepare()
178 cet->t_iv = cpu_to_le32(rctx->addr_iv); in sun8i_ce_cipher_prepare()
238 rctx->nr_sgs = nr_sgs; in sun8i_ce_cipher_prepare()
239 rctx->nr_sgd = nr_sgd; in sun8i_ce_cipher_prepare()
253 if (rctx->addr_iv) in sun8i_ce_cipher_prepare()
254 dma_unmap_single(ce->dev, rctx->addr_iv, rctx->ivlen, DMA_TO_DEVICE); in sun8i_ce_cipher_prepare()
256 if (rctx->op_dir & CE_DECRYPTION) { in sun8i_ce_cipher_prepare()
257 memcpy(areq->iv, rctx->backup_iv, ivsize); in sun8i_ce_cipher_prepare()
258 kfree_sensitive(rctx->backup_iv); in sun8i_ce_cipher_prepare()
263 kfree(rctx->bounce_iv); in sun8i_ce_cipher_prepare()
267 dma_unmap_single(ce->dev, rctx->addr_key, op->keylen, DMA_TO_DEVICE); in sun8i_ce_cipher_prepare()
279 struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(breq); in sun8i_ce_cipher_run() local
282 flow = rctx->flow; in sun8i_ce_cipher_run()
296 struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sun8i_ce_cipher_unprepare() local
300 int nr_sgs = rctx->nr_sgs; in sun8i_ce_cipher_unprepare()
301 int nr_sgd = rctx->nr_sgd; in sun8i_ce_cipher_unprepare()
304 flow = rctx->flow; in sun8i_ce_cipher_unprepare()
319 dma_unmap_single(ce->dev, rctx->addr_iv, rctx->ivlen, DMA_TO_DEVICE); in sun8i_ce_cipher_unprepare()
321 if (rctx->op_dir & CE_DECRYPTION) { in sun8i_ce_cipher_unprepare()
322 memcpy(areq->iv, rctx->backup_iv, ivsize); in sun8i_ce_cipher_unprepare()
323 kfree_sensitive(rctx->backup_iv); in sun8i_ce_cipher_unprepare()
328 kfree(rctx->bounce_iv); in sun8i_ce_cipher_unprepare()
331 dma_unmap_single(ce->dev, rctx->addr_key, op->keylen, DMA_TO_DEVICE); in sun8i_ce_cipher_unprepare()
340 struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sun8i_ce_skdecrypt() local
344 rctx->op_dir = CE_DECRYPTION; in sun8i_ce_skdecrypt()
349 rctx->flow = e; in sun8i_ce_skdecrypt()
359 struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sun8i_ce_skencrypt() local
363 rctx->op_dir = CE_ENCRYPTION; in sun8i_ce_skencrypt()
368 rctx->flow = e; in sun8i_ce_skencrypt()