Lines Matching refs:req

213 	memcpy(iv, cryp->req.areq->iv, AES_BLOCK_SIZE);
289 starfive_aes_write_iv(ctx, (void *)cryp->req.areq->iv);
301 starfive_aes_write_iv(ctx, (void *)cryp->req.sreq->iv);
349 starfive_aes_get_iv(cryp, (void *)cryp->req.sreq->iv);
357 crypto_finalize_aead_request(cryp->engine, cryp->req.areq, err);
359 crypto_finalize_skcipher_request(cryp->engine, cryp->req.sreq,
461 static int starfive_aes_prepare_req(struct skcipher_request *req,
468 if (!req && !areq)
471 ctx = req ? crypto_skcipher_ctx(crypto_skcipher_reqtfm(req)) :
475 rctx = req ? skcipher_request_ctx(req) : aead_request_ctx(areq);
477 if (req) {
478 cryp->req.sreq = req;
479 cryp->total_in = req->cryptlen;
480 cryp->total_out = req->cryptlen;
484 cryp->req.areq = areq;
496 rctx->in_sg = req ? req->src : areq->src;
499 rctx->out_sg = req ? req->dst : areq->dst;
519 struct skcipher_request *req =
522 crypto_skcipher_ctx(crypto_skcipher_reqtfm(req));
529 err = starfive_aes_prepare_req(req, NULL);
567 struct aead_request *req =
570 crypto_aead_ctx(crypto_aead_reqtfm(req));
578 err = starfive_aes_prepare_req(NULL, req);
654 static int starfive_aes_crypt(struct skcipher_request *req, unsigned long flags)
656 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
665 if (req->cryptlen & blocksize_align)
668 return crypto_transfer_skcipher_request_to_engine(cryp->engine, req);
671 static int starfive_aes_aead_crypt(struct aead_request *req, unsigned long flags)
673 struct starfive_cryp_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
683 struct aead_request *subreq = aead_request_ctx(req);
686 aead_request_set_callback(subreq, req->base.flags,
687 req->base.complete, req->base.data);
688 aead_request_set_crypt(subreq, req->src,
689 req->dst, req->cryptlen, req->iv);
690 aead_request_set_ad(subreq, req->assoclen);
695 return crypto_transfer_aead_request_to_engine(cryp->engine, req);
766 static int starfive_aes_ecb_encrypt(struct skcipher_request *req)
768 return starfive_aes_crypt(req, STARFIVE_AES_MODE_ECB | FLG_ENCRYPT);
771 static int starfive_aes_ecb_decrypt(struct skcipher_request *req)
773 return starfive_aes_crypt(req, STARFIVE_AES_MODE_ECB);
776 static int starfive_aes_cbc_encrypt(struct skcipher_request *req)
778 return starfive_aes_crypt(req, STARFIVE_AES_MODE_CBC | FLG_ENCRYPT);
781 static int starfive_aes_cbc_decrypt(struct skcipher_request *req)
783 return starfive_aes_crypt(req, STARFIVE_AES_MODE_CBC);
786 static int starfive_aes_cfb_encrypt(struct skcipher_request *req)
788 return starfive_aes_crypt(req, STARFIVE_AES_MODE_CFB | FLG_ENCRYPT);
791 static int starfive_aes_cfb_decrypt(struct skcipher_request *req)
793 return starfive_aes_crypt(req, STARFIVE_AES_MODE_CFB);
796 static int starfive_aes_ofb_encrypt(struct skcipher_request *req)
798 return starfive_aes_crypt(req, STARFIVE_AES_MODE_OFB | FLG_ENCRYPT);
801 static int starfive_aes_ofb_decrypt(struct skcipher_request *req)
803 return starfive_aes_crypt(req, STARFIVE_AES_MODE_OFB);
806 static int starfive_aes_ctr_encrypt(struct skcipher_request *req)
808 return starfive_aes_crypt(req, STARFIVE_AES_MODE_CTR | FLG_ENCRYPT);
811 static int starfive_aes_ctr_decrypt(struct skcipher_request *req)
813 return starfive_aes_crypt(req, STARFIVE_AES_MODE_CTR);
816 static int starfive_aes_gcm_encrypt(struct aead_request *req)
818 return starfive_aes_aead_crypt(req, STARFIVE_AES_MODE_GCM | FLG_ENCRYPT);
821 static int starfive_aes_gcm_decrypt(struct aead_request *req)
823 return starfive_aes_aead_crypt(req, STARFIVE_AES_MODE_GCM);
826 static int starfive_aes_ccm_encrypt(struct aead_request *req)
830 ret = starfive_aes_ccm_check_iv(req->iv);
834 return starfive_aes_aead_crypt(req, STARFIVE_AES_MODE_CCM | FLG_ENCRYPT);
837 static int starfive_aes_ccm_decrypt(struct aead_request *req)
841 ret = starfive_aes_ccm_check_iv(req->iv);
845 return starfive_aes_aead_crypt(req, STARFIVE_AES_MODE_CCM);