Lines Matching defs:areq

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