Lines Matching refs:areq
21 static bool sl3516_ce_need_fallback(struct skcipher_request *areq) in sl3516_ce_need_fallback() argument
23 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_need_fallback()
30 if (areq->cryptlen == 0 || areq->cryptlen % 16) { in sl3516_ce_need_fallback()
39 if (sg_nents(areq->src) > MAXDESC / 2) { in sl3516_ce_need_fallback()
44 if (sg_nents(areq->dst) > MAXDESC) { in sl3516_ce_need_fallback()
49 sg = areq->src; in sl3516_ce_need_fallback()
65 sg = areq->dst; in sl3516_ce_need_fallback()
83 in_sg = areq->src; in sl3516_ce_need_fallback()
84 out_sg = areq->dst; in sl3516_ce_need_fallback()
99 static int sl3516_ce_cipher_fallback(struct skcipher_request *areq) in sl3516_ce_cipher_fallback() argument
101 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_cipher_fallback()
103 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_cipher_fallback()
112 skcipher_request_set_callback(&rctx->fallback_req, areq->base.flags, in sl3516_ce_cipher_fallback()
113 areq->base.complete, areq->base.data); in sl3516_ce_cipher_fallback()
114 skcipher_request_set_crypt(&rctx->fallback_req, areq->src, areq->dst, in sl3516_ce_cipher_fallback()
115 areq->cryptlen, areq->iv); in sl3516_ce_cipher_fallback()
123 static int sl3516_ce_cipher(struct skcipher_request *areq) in sl3516_ce_cipher() argument
125 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_cipher()
128 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_cipher()
142 crypto_tfm_alg_name(areq->base.tfm), in sl3516_ce_cipher()
143 areq->cryptlen, in sl3516_ce_cipher()
144 rctx->op_dir, areq->iv, crypto_skcipher_ivsize(tfm), in sl3516_ce_cipher()
149 if (areq->src == areq->dst) { in sl3516_ce_cipher()
150 nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
159 nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
166 nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst), in sl3516_ce_cipher()
175 len = areq->cryptlen; in sl3516_ce_cipher()
177 sg = areq->src; in sl3516_ce_cipher()
185 areq->cryptlen, i, rctx->t_src[i].len, sg->offset, todo); in sl3516_ce_cipher()
192 dev_err(ce->dev, "remaining len %d/%u nr_sgs=%d\n", len, areq->cryptlen, nr_sgs); in sl3516_ce_cipher()
197 len = areq->cryptlen; in sl3516_ce_cipher()
199 sg = areq->dst; in sl3516_ce_cipher()
207 areq->cryptlen, i, rctx->t_dst[i].len, sg->offset, todo); in sl3516_ce_cipher()
230 ecb->cipher.algorithm_len = areq->cryptlen; in sl3516_ce_cipher()
243 err = sl3516_ce_run_task(ce, rctx, crypto_tfm_alg_name(areq->base.tfm)); in sl3516_ce_cipher()
246 if (areq->src == areq->dst) { in sl3516_ce_cipher()
247 dma_unmap_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
250 dma_unmap_sg(ce->dev, areq->src, sg_nents(areq->src), in sl3516_ce_cipher()
252 dma_unmap_sg(ce->dev, areq->dst, sg_nents(areq->dst), in sl3516_ce_cipher()
261 static int sl3516_ce_handle_cipher_request(struct crypto_engine *engine, void *areq) in sl3516_ce_handle_cipher_request() argument
264 struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); in sl3516_ce_handle_cipher_request()
274 int sl3516_ce_skdecrypt(struct skcipher_request *areq) in sl3516_ce_skdecrypt() argument
276 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_skdecrypt()
278 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_skdecrypt()
284 if (sl3516_ce_need_fallback(areq)) in sl3516_ce_skdecrypt()
285 return sl3516_ce_cipher_fallback(areq); in sl3516_ce_skdecrypt()
289 return crypto_transfer_skcipher_request_to_engine(engine, areq); in sl3516_ce_skdecrypt()
292 int sl3516_ce_skencrypt(struct skcipher_request *areq) in sl3516_ce_skencrypt() argument
294 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in sl3516_ce_skencrypt()
296 struct sl3516_ce_cipher_req_ctx *rctx = skcipher_request_ctx(areq); in sl3516_ce_skencrypt()
302 if (sl3516_ce_need_fallback(areq)) in sl3516_ce_skencrypt()
303 return sl3516_ce_cipher_fallback(areq); in sl3516_ce_skencrypt()
307 return crypto_transfer_skcipher_request_to_engine(engine, areq); in sl3516_ce_skencrypt()