Lines Matching refs:areq
25 static bool sl3516_ce_need_fallback(struct skcipher_request *areq) in sl3516_ce_need_fallback() argument
27 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_need_fallback()
34 if (areq->cryptlen == 0 || areq->cryptlen % 16) { in sl3516_ce_need_fallback()
43 if (sg_nents(areq->src) > MAXDESC / 2) { in sl3516_ce_need_fallback()
48 if (sg_nents(areq->dst) > MAXDESC) { in sl3516_ce_need_fallback()
53 sg = areq->src; in sl3516_ce_need_fallback()
69 sg = areq->dst; in sl3516_ce_need_fallback()
87 in_sg = areq->src; in sl3516_ce_need_fallback()
88 out_sg = areq->dst; in sl3516_ce_need_fallback()
103 static int sl3516_ce_cipher_fallback(struct skcipher_request *areq) in sl3516_ce_cipher_fallback() argument
105 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_cipher_fallback()
107 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_cipher_fallback()
116 skcipher_request_set_callback(&rctx->fallback_req, areq->base.flags, in sl3516_ce_cipher_fallback()
117 areq->base.complete, areq->base.data); in sl3516_ce_cipher_fallback()
118 skcipher_request_set_crypt(&rctx->fallback_req, areq->src, areq->dst, in sl3516_ce_cipher_fallback()
119 areq->cryptlen, areq->iv); in sl3516_ce_cipher_fallback()
127 static int sl3516_ce_cipher(struct skcipher_request *areq) in sl3516_ce_cipher() argument
129 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_cipher()
132 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_cipher()
146 crypto_tfm_alg_name(areq->base.tfm), in sl3516_ce_cipher()
147 areq->cryptlen, in sl3516_ce_cipher()
148 rctx->op_dir, areq->iv, crypto_skcipher_ivsize(tfm), in sl3516_ce_cipher()
153 if (areq->src == areq->dst) { in sl3516_ce_cipher()
154 nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
163 nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
170 nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst), in sl3516_ce_cipher()
179 len = areq->cryptlen; in sl3516_ce_cipher()
181 sg = areq->src; in sl3516_ce_cipher()
189 areq->cryptlen, i, rctx->t_src[i].len, sg->offset, todo); in sl3516_ce_cipher()
196 dev_err(ce->dev, "remaining len %d/%u nr_sgs=%d\n", len, areq->cryptlen, nr_sgs); in sl3516_ce_cipher()
201 len = areq->cryptlen; in sl3516_ce_cipher()
203 sg = areq->dst; in sl3516_ce_cipher()
211 areq->cryptlen, i, rctx->t_dst[i].len, sg->offset, todo); in sl3516_ce_cipher()
234 ecb->cipher.algorithm_len = areq->cryptlen; in sl3516_ce_cipher()
247 err = sl3516_ce_run_task(ce, rctx, crypto_tfm_alg_name(areq->base.tfm)); in sl3516_ce_cipher()
250 if (areq->src == areq->dst) { in sl3516_ce_cipher()
251 dma_unmap_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
254 dma_unmap_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
256 dma_unmap_sg(ce->dev, areq->dst, sg_nents(areq->dst), in sl3516_ce_cipher()
265 int sl3516_ce_handle_cipher_request(struct crypto_engine *engine, void *areq) in sl3516_ce_handle_cipher_request() argument
268 struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); in sl3516_ce_handle_cipher_request()
278 int sl3516_ce_skdecrypt(struct skcipher_request *areq) in sl3516_ce_skdecrypt() argument
280 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_skdecrypt()
282 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_skdecrypt()
288 if (sl3516_ce_need_fallback(areq)) in sl3516_ce_skdecrypt()
289 return sl3516_ce_cipher_fallback(areq); in sl3516_ce_skdecrypt()
293 return crypto_transfer_skcipher_request_to_engine(engine, areq); in sl3516_ce_skdecrypt()
296 int sl3516_ce_skencrypt(struct skcipher_request *areq) in sl3516_ce_skencrypt() argument
298 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_skencrypt()
300 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_skencrypt()
306 if (sl3516_ce_need_fallback(areq)) in sl3516_ce_skencrypt()
307 return sl3516_ce_cipher_fallback(areq); in sl3516_ce_skencrypt()
311 return crypto_transfer_skcipher_request_to_engine(engine, areq); in sl3516_ce_skencrypt()