Lines Matching refs:areq

73 int sun8i_ce_hash_init(struct ahash_request *areq)  in sun8i_ce_hash_init()  argument
75 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_init()
76 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_init()
82 rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; in sun8i_ce_hash_init()
87 int sun8i_ce_hash_export(struct ahash_request *areq, void *out) in sun8i_ce_hash_export() argument
89 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_export()
90 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_export()
94 rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; in sun8i_ce_hash_export()
99 int sun8i_ce_hash_import(struct ahash_request *areq, const void *in) in sun8i_ce_hash_import() argument
101 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_import()
102 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_import()
106 rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; in sun8i_ce_hash_import()
111 int sun8i_ce_hash_final(struct ahash_request *areq) in sun8i_ce_hash_final() argument
113 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_final()
114 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_final()
122 rctx->fallback_req.base.flags = areq->base.flags & in sun8i_ce_hash_final()
124 rctx->fallback_req.result = areq->result; in sun8i_ce_hash_final()
134 int sun8i_ce_hash_update(struct ahash_request *areq) in sun8i_ce_hash_update() argument
136 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_update()
137 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_update()
141 rctx->fallback_req.base.flags = areq->base.flags & in sun8i_ce_hash_update()
143 rctx->fallback_req.nbytes = areq->nbytes; in sun8i_ce_hash_update()
144 rctx->fallback_req.src = areq->src; in sun8i_ce_hash_update()
149 int sun8i_ce_hash_finup(struct ahash_request *areq) in sun8i_ce_hash_finup() argument
151 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_finup()
152 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_finup()
160 rctx->fallback_req.base.flags = areq->base.flags & in sun8i_ce_hash_finup()
163 rctx->fallback_req.nbytes = areq->nbytes; in sun8i_ce_hash_finup()
164 rctx->fallback_req.src = areq->src; in sun8i_ce_hash_finup()
165 rctx->fallback_req.result = areq->result; in sun8i_ce_hash_finup()
174 static int sun8i_ce_hash_digest_fb(struct ahash_request *areq) in sun8i_ce_hash_digest_fb() argument
176 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_digest_fb()
177 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_digest_fb()
185 rctx->fallback_req.base.flags = areq->base.flags & in sun8i_ce_hash_digest_fb()
188 rctx->fallback_req.nbytes = areq->nbytes; in sun8i_ce_hash_digest_fb()
189 rctx->fallback_req.src = areq->src; in sun8i_ce_hash_digest_fb()
190 rctx->fallback_req.result = areq->result; in sun8i_ce_hash_digest_fb()
199 static bool sun8i_ce_hash_need_fallback(struct ahash_request *areq) in sun8i_ce_hash_need_fallback() argument
203 if (areq->nbytes == 0) in sun8i_ce_hash_need_fallback()
206 if (sg_nents(areq->src) > MAX_SG - 1) in sun8i_ce_hash_need_fallback()
208 sg = areq->src; in sun8i_ce_hash_need_fallback()
217 int sun8i_ce_hash_digest(struct ahash_request *areq) in sun8i_ce_hash_digest() argument
219 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_digest()
221 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_digest()
228 if (sun8i_ce_hash_need_fallback(areq)) in sun8i_ce_hash_digest()
229 return sun8i_ce_hash_digest_fb(areq); in sun8i_ce_hash_digest()
231 nr_sgs = sg_nents(areq->src); in sun8i_ce_hash_digest()
233 return sun8i_ce_hash_digest_fb(areq); in sun8i_ce_hash_digest()
235 for_each_sg(areq->src, sg, nr_sgs, i) { in sun8i_ce_hash_digest()
237 return sun8i_ce_hash_digest_fb(areq); in sun8i_ce_hash_digest()
247 return crypto_transfer_hash_request_to_engine(engine, areq); in sun8i_ce_hash_digest()
252 struct ahash_request *areq = container_of(breq, struct ahash_request, base); in sun8i_ce_hash_run() local
253 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in sun8i_ce_hash_run()
255 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); in sun8i_ce_hash_run()
307 dev_dbg(ce->dev, "%s %s len=%d\n", __func__, crypto_tfm_alg_name(areq->base.tfm), areq->nbytes); in sun8i_ce_hash_run()
320 nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), DMA_TO_DEVICE); in sun8i_ce_hash_run()
327 len = areq->nbytes; in sun8i_ce_hash_run()
328 for_each_sg(areq->src, sg, nr_sgs, i) { in sun8i_ce_hash_run()
348 byte_count = areq->nbytes; in sun8i_ce_hash_run()
399 cet->t_dlen = cpu_to_le32((areq->nbytes + j * 4) * 8); in sun8i_ce_hash_run()
401 cet->t_dlen = cpu_to_le32(areq->nbytes / 4 + j); in sun8i_ce_hash_run()
403 chan->timeout = areq->nbytes; in sun8i_ce_hash_run()
405 err = sun8i_ce_run_task(ce, flow, crypto_tfm_alg_name(areq->base.tfm)); in sun8i_ce_hash_run()
408 dma_unmap_sg(ce->dev, areq->src, nr_sgs, DMA_TO_DEVICE); in sun8i_ce_hash_run()
412 memcpy(areq->result, result, algt->alg.hash.halg.digestsize); in sun8i_ce_hash_run()