Lines Matching refs:req
44 struct akcipher_request *req)
46 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
48 dma_unmap_sg(dev, req->dst, edesc->dst_nents, DMA_FROM_DEVICE);
57 struct akcipher_request *req)
59 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
69 struct akcipher_request *req)
71 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
81 struct akcipher_request *req)
83 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
98 struct akcipher_request *req)
100 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
119 struct akcipher_request *req = context;
120 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
132 rsa_pub_unmap(dev, edesc, req);
133 rsa_io_unmap(dev, edesc, req);
141 akcipher_request_complete(req, ecode);
143 crypto_finalize_akcipher_request(jrp->engine, req, ecode);
149 struct akcipher_request *req = context;
150 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
154 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
167 rsa_priv_f1_unmap(dev, edesc, req);
170 rsa_priv_f2_unmap(dev, edesc, req);
173 rsa_priv_f3_unmap(dev, edesc, req);
176 rsa_io_unmap(dev, edesc, req);
184 akcipher_request_complete(req, ecode);
186 crypto_finalize_akcipher_request(jrp->engine, req, ecode);
242 static struct rsa_edesc *rsa_edesc_alloc(struct akcipher_request *req,
245 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
248 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
251 gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
260 if (req->src_len > key->n_sz) {
265 lzeros = caam_rsa_count_leading_zeros(req->src, req->src_len -
270 req_ctx->fixup_src = scatterwalk_ffwd(req_ctx->src, req->src,
272 req_ctx->fixup_src_len = req->src_len - lzeros;
278 diff_size = key->n_sz - req->src_len;
279 req_ctx->fixup_src = req->src;
280 req_ctx->fixup_src_len = req->src_len;
285 dst_nents = sg_nents_for_len(req->dst, req->dst_len);
293 mapped_dst_nents = dma_map_sg(dev, req->dst, dst_nents,
329 sg_to_sec4_sg_last(req->dst, req->dst_len,
362 dma_unmap_sg(dev, req->dst, dst_nents, DMA_FROM_DEVICE);
370 struct akcipher_request *req = container_of(areq,
373 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
374 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
382 ret = caam_jr_enqueue(jrdev, desc, req_ctx->akcipher_op_done, req);
385 rsa_pub_unmap(jrdev, req_ctx->edesc, req);
386 rsa_io_unmap(jrdev, req_ctx->edesc, req);
395 static int set_rsa_pub_pdb(struct akcipher_request *req,
398 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
399 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
432 pdb->g_dma = sg_dma_address(req->dst);
441 static int set_rsa_priv_f1_pdb(struct akcipher_request *req,
444 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
470 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
480 pdb->f_dma = sg_dma_address(req->dst);
488 static int set_rsa_priv_f2_pdb(struct akcipher_request *req,
491 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
535 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
545 pdb->f_dma = sg_dma_address(req->dst);
565 static int set_rsa_priv_f3_pdb(struct akcipher_request *req,
568 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
624 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
634 pdb->f_dma = sg_dma_address(req->dst);
661 struct akcipher_request *req)
664 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
667 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
678 if (req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)
680 req);
682 ret = caam_jr_enqueue(jrdev, desc, cbk, req);
687 rsa_priv_f1_unmap(jrdev, edesc, req);
690 rsa_priv_f2_unmap(jrdev, edesc, req);
693 rsa_priv_f3_unmap(jrdev, edesc, req);
696 rsa_pub_unmap(jrdev, edesc, req);
698 rsa_io_unmap(jrdev, edesc, req);
705 static int caam_rsa_enc(struct akcipher_request *req)
707 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
717 if (req->dst_len < key->n_sz) {
718 req->dst_len = key->n_sz;
724 edesc = rsa_edesc_alloc(req, DESC_RSA_PUB_LEN);
729 ret = set_rsa_pub_pdb(req, edesc);
736 return akcipher_enqueue_req(jrdev, rsa_pub_done, req);
739 rsa_io_unmap(jrdev, edesc, req);
744 static int caam_rsa_dec_priv_f1(struct akcipher_request *req)
746 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
753 edesc = rsa_edesc_alloc(req, DESC_RSA_PRIV_F1_LEN);
758 ret = set_rsa_priv_f1_pdb(req, edesc);
765 return akcipher_enqueue_req(jrdev, rsa_priv_f_done, req);
768 rsa_io_unmap(jrdev, edesc, req);
773 static int caam_rsa_dec_priv_f2(struct akcipher_request *req)
775 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
782 edesc = rsa_edesc_alloc(req, DESC_RSA_PRIV_F2_LEN);
787 ret = set_rsa_priv_f2_pdb(req, edesc);
794 return akcipher_enqueue_req(jrdev, rsa_priv_f_done, req);
797 rsa_io_unmap(jrdev, edesc, req);
802 static int caam_rsa_dec_priv_f3(struct akcipher_request *req)
804 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
811 edesc = rsa_edesc_alloc(req, DESC_RSA_PRIV_F3_LEN);
816 ret = set_rsa_priv_f3_pdb(req, edesc);
823 return akcipher_enqueue_req(jrdev, rsa_priv_f_done, req);
826 rsa_io_unmap(jrdev, edesc, req);
831 static int caam_rsa_dec(struct akcipher_request *req)
833 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
841 if (req->dst_len < key->n_sz) {
842 req->dst_len = key->n_sz;
848 ret = caam_rsa_dec_priv_f3(req);
850 ret = caam_rsa_dec_priv_f2(req);
852 ret = caam_rsa_dec_priv_f1(req);