Lines Matching full:req
42 struct skcipher_request *req) in mv_cesa_skcipher_req_iter_init() argument
44 mv_cesa_req_dma_iter_init(&iter->base, req->cryptlen); in mv_cesa_skcipher_req_iter_init()
45 mv_cesa_sg_dma_iter_init(&iter->src, req->src, DMA_TO_DEVICE); in mv_cesa_skcipher_req_iter_init()
46 mv_cesa_sg_dma_iter_init(&iter->dst, req->dst, DMA_FROM_DEVICE); in mv_cesa_skcipher_req_iter_init()
59 mv_cesa_skcipher_dma_cleanup(struct skcipher_request *req) in mv_cesa_skcipher_dma_cleanup() argument
61 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_dma_cleanup()
63 if (req->dst != req->src) { in mv_cesa_skcipher_dma_cleanup()
64 dma_unmap_sg(cesa_dev->dev, req->dst, creq->dst_nents, in mv_cesa_skcipher_dma_cleanup()
66 dma_unmap_sg(cesa_dev->dev, req->src, creq->src_nents, in mv_cesa_skcipher_dma_cleanup()
69 dma_unmap_sg(cesa_dev->dev, req->src, creq->src_nents, in mv_cesa_skcipher_dma_cleanup()
75 static inline void mv_cesa_skcipher_cleanup(struct skcipher_request *req) in mv_cesa_skcipher_cleanup() argument
77 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_cleanup()
80 mv_cesa_skcipher_dma_cleanup(req); in mv_cesa_skcipher_cleanup()
83 static void mv_cesa_skcipher_std_step(struct skcipher_request *req) in mv_cesa_skcipher_std_step() argument
85 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_std_step()
88 size_t len = min_t(size_t, req->cryptlen - sreq->offset, in mv_cesa_skcipher_std_step()
97 len = mv_cesa_sg_copy_to_sram(engine, req->src, creq->src_nents, in mv_cesa_skcipher_std_step()
123 static int mv_cesa_skcipher_std_process(struct skcipher_request *req, in mv_cesa_skcipher_std_process() argument
126 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_std_process()
131 len = mv_cesa_sg_copy_from_sram(engine, req->dst, creq->dst_nents, in mv_cesa_skcipher_std_process()
136 if (sreq->offset < req->cryptlen) in mv_cesa_skcipher_std_process()
142 static int mv_cesa_skcipher_process(struct crypto_async_request *req, in mv_cesa_skcipher_process() argument
145 struct skcipher_request *skreq = skcipher_request_cast(req); in mv_cesa_skcipher_process()
155 static void mv_cesa_skcipher_step(struct crypto_async_request *req) in mv_cesa_skcipher_step() argument
157 struct skcipher_request *skreq = skcipher_request_cast(req); in mv_cesa_skcipher_step()
167 mv_cesa_skcipher_dma_prepare(struct skcipher_request *req) in mv_cesa_skcipher_dma_prepare() argument
169 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_dma_prepare()
176 mv_cesa_skcipher_std_prepare(struct skcipher_request *req) in mv_cesa_skcipher_std_prepare() argument
178 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_std_prepare()
185 static inline void mv_cesa_skcipher_prepare(struct crypto_async_request *req, in mv_cesa_skcipher_prepare() argument
188 struct skcipher_request *skreq = skcipher_request_cast(req); in mv_cesa_skcipher_prepare()
200 mv_cesa_skcipher_req_cleanup(struct crypto_async_request *req) in mv_cesa_skcipher_req_cleanup() argument
202 struct skcipher_request *skreq = skcipher_request_cast(req); in mv_cesa_skcipher_req_cleanup()
208 mv_cesa_skcipher_complete(struct crypto_async_request *req) in mv_cesa_skcipher_complete() argument
210 struct skcipher_request *skreq = skcipher_request_cast(req); in mv_cesa_skcipher_complete()
312 static int mv_cesa_skcipher_dma_req_init(struct skcipher_request *req, in mv_cesa_skcipher_dma_req_init() argument
315 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_dma_req_init()
316 gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? in mv_cesa_skcipher_dma_req_init()
326 if (req->src != req->dst) { in mv_cesa_skcipher_dma_req_init()
327 ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, in mv_cesa_skcipher_dma_req_init()
332 ret = dma_map_sg(cesa_dev->dev, req->dst, creq->dst_nents, in mv_cesa_skcipher_dma_req_init()
339 ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, in mv_cesa_skcipher_dma_req_init()
346 mv_cesa_skcipher_req_iter_init(&iter, req); in mv_cesa_skcipher_dma_req_init()
395 if (req->dst != req->src) in mv_cesa_skcipher_dma_req_init()
396 dma_unmap_sg(cesa_dev->dev, req->dst, creq->dst_nents, in mv_cesa_skcipher_dma_req_init()
400 dma_unmap_sg(cesa_dev->dev, req->src, creq->src_nents, in mv_cesa_skcipher_dma_req_init()
401 req->dst != req->src ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL); in mv_cesa_skcipher_dma_req_init()
407 mv_cesa_skcipher_std_req_init(struct skcipher_request *req, in mv_cesa_skcipher_std_req_init() argument
410 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_std_req_init()
422 static int mv_cesa_skcipher_req_init(struct skcipher_request *req, in mv_cesa_skcipher_req_init() argument
425 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_req_init()
426 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in mv_cesa_skcipher_req_init()
430 if (!IS_ALIGNED(req->cryptlen, blksize)) in mv_cesa_skcipher_req_init()
433 creq->src_nents = sg_nents_for_len(req->src, req->cryptlen); in mv_cesa_skcipher_req_init()
438 creq->dst_nents = sg_nents_for_len(req->dst, req->cryptlen); in mv_cesa_skcipher_req_init()
448 ret = mv_cesa_skcipher_dma_req_init(req, tmpl); in mv_cesa_skcipher_req_init()
450 ret = mv_cesa_skcipher_std_req_init(req, tmpl); in mv_cesa_skcipher_req_init()
455 static int mv_cesa_skcipher_queue_req(struct skcipher_request *req, in mv_cesa_skcipher_queue_req() argument
459 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); in mv_cesa_skcipher_queue_req()
462 ret = mv_cesa_skcipher_req_init(req, tmpl); in mv_cesa_skcipher_queue_req()
466 engine = mv_cesa_select_engine(req->cryptlen); in mv_cesa_skcipher_queue_req()
467 mv_cesa_skcipher_prepare(&req->base, engine); in mv_cesa_skcipher_queue_req()
469 ret = mv_cesa_queue_req(&req->base, &creq->base); in mv_cesa_skcipher_queue_req()
471 if (mv_cesa_req_needs_cleanup(&req->base, ret)) in mv_cesa_skcipher_queue_req()
472 mv_cesa_skcipher_cleanup(req); in mv_cesa_skcipher_queue_req()
477 static int mv_cesa_des_op(struct skcipher_request *req, in mv_cesa_des_op() argument
480 struct mv_cesa_des_ctx *ctx = crypto_tfm_ctx(req->base.tfm); in mv_cesa_des_op()
487 return mv_cesa_skcipher_queue_req(req, tmpl); in mv_cesa_des_op()
490 static int mv_cesa_ecb_des_encrypt(struct skcipher_request *req) in mv_cesa_ecb_des_encrypt() argument
498 return mv_cesa_des_op(req, &tmpl); in mv_cesa_ecb_des_encrypt()
501 static int mv_cesa_ecb_des_decrypt(struct skcipher_request *req) in mv_cesa_ecb_des_decrypt() argument
509 return mv_cesa_des_op(req, &tmpl); in mv_cesa_ecb_des_decrypt()
533 static int mv_cesa_cbc_des_op(struct skcipher_request *req, in mv_cesa_cbc_des_op() argument
539 memcpy(tmpl->ctx.skcipher.iv, req->iv, DES_BLOCK_SIZE); in mv_cesa_cbc_des_op()
541 return mv_cesa_des_op(req, tmpl); in mv_cesa_cbc_des_op()
544 static int mv_cesa_cbc_des_encrypt(struct skcipher_request *req) in mv_cesa_cbc_des_encrypt() argument
550 return mv_cesa_cbc_des_op(req, &tmpl); in mv_cesa_cbc_des_encrypt()
553 static int mv_cesa_cbc_des_decrypt(struct skcipher_request *req) in mv_cesa_cbc_des_decrypt() argument
559 return mv_cesa_cbc_des_op(req, &tmpl); in mv_cesa_cbc_des_decrypt()
584 static int mv_cesa_des3_op(struct skcipher_request *req, in mv_cesa_des3_op() argument
587 struct mv_cesa_des3_ctx *ctx = crypto_tfm_ctx(req->base.tfm); in mv_cesa_des3_op()
594 return mv_cesa_skcipher_queue_req(req, tmpl); in mv_cesa_des3_op()
597 static int mv_cesa_ecb_des3_ede_encrypt(struct skcipher_request *req) in mv_cesa_ecb_des3_ede_encrypt() argument
606 return mv_cesa_des3_op(req, &tmpl); in mv_cesa_ecb_des3_ede_encrypt()
609 static int mv_cesa_ecb_des3_ede_decrypt(struct skcipher_request *req) in mv_cesa_ecb_des3_ede_decrypt() argument
618 return mv_cesa_des3_op(req, &tmpl); in mv_cesa_ecb_des3_ede_decrypt()
643 static int mv_cesa_cbc_des3_op(struct skcipher_request *req, in mv_cesa_cbc_des3_op() argument
646 memcpy(tmpl->ctx.skcipher.iv, req->iv, DES3_EDE_BLOCK_SIZE); in mv_cesa_cbc_des3_op()
648 return mv_cesa_des3_op(req, tmpl); in mv_cesa_cbc_des3_op()
651 static int mv_cesa_cbc_des3_ede_encrypt(struct skcipher_request *req) in mv_cesa_cbc_des3_ede_encrypt() argument
660 return mv_cesa_cbc_des3_op(req, &tmpl); in mv_cesa_cbc_des3_ede_encrypt()
663 static int mv_cesa_cbc_des3_ede_decrypt(struct skcipher_request *req) in mv_cesa_cbc_des3_ede_decrypt() argument
672 return mv_cesa_cbc_des3_op(req, &tmpl); in mv_cesa_cbc_des3_ede_decrypt()
697 static int mv_cesa_aes_op(struct skcipher_request *req, in mv_cesa_aes_op() argument
700 struct mv_cesa_aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); in mv_cesa_aes_op()
724 return mv_cesa_skcipher_queue_req(req, tmpl); in mv_cesa_aes_op()
727 static int mv_cesa_ecb_aes_encrypt(struct skcipher_request *req) in mv_cesa_ecb_aes_encrypt() argument
735 return mv_cesa_aes_op(req, &tmpl); in mv_cesa_ecb_aes_encrypt()
738 static int mv_cesa_ecb_aes_decrypt(struct skcipher_request *req) in mv_cesa_ecb_aes_decrypt() argument
746 return mv_cesa_aes_op(req, &tmpl); in mv_cesa_ecb_aes_decrypt()
770 static int mv_cesa_cbc_aes_op(struct skcipher_request *req, in mv_cesa_cbc_aes_op() argument
775 memcpy(tmpl->ctx.skcipher.iv, req->iv, AES_BLOCK_SIZE); in mv_cesa_cbc_aes_op()
777 return mv_cesa_aes_op(req, tmpl); in mv_cesa_cbc_aes_op()
780 static int mv_cesa_cbc_aes_encrypt(struct skcipher_request *req) in mv_cesa_cbc_aes_encrypt() argument
786 return mv_cesa_cbc_aes_op(req, &tmpl); in mv_cesa_cbc_aes_encrypt()
789 static int mv_cesa_cbc_aes_decrypt(struct skcipher_request *req) in mv_cesa_cbc_aes_decrypt() argument
795 return mv_cesa_cbc_aes_op(req, &tmpl); in mv_cesa_cbc_aes_decrypt()