Lines Matching refs:actx
171 static int mxs_dcp_start_dma(struct dcp_async_ctx *actx) in mxs_dcp_start_dma() argument
175 const int chan = actx->chan; in mxs_dcp_start_dma()
178 struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; in mxs_dcp_start_dma()
220 static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, in mxs_dcp_run_aes() argument
225 struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; in mxs_dcp_run_aes()
247 if (actx->fill % AES_BLOCK_SIZE) { in mxs_dcp_run_aes()
276 desc->size = actx->fill; in mxs_dcp_run_aes()
280 ret = mxs_dcp_start_dma(actx); in mxs_dcp_run_aes()
298 struct dcp_async_ctx *actx = crypto_tfm_ctx(arq->tfm); in mxs_dcp_aes_block_crypt() local
320 actx->fill = 0; in mxs_dcp_aes_block_crypt()
323 memcpy(key, actx->key, actx->key_len); in mxs_dcp_aes_block_crypt()
344 if (actx->fill + len > out_off) in mxs_dcp_aes_block_crypt()
345 clen = out_off - actx->fill; in mxs_dcp_aes_block_crypt()
349 memcpy(in_buf + actx->fill, src_buf, clen); in mxs_dcp_aes_block_crypt()
352 actx->fill += clen; in mxs_dcp_aes_block_crypt()
358 if (actx->fill == out_off || sg_is_last(src) || in mxs_dcp_aes_block_crypt()
360 ret = mxs_dcp_run_aes(actx, req, init); in mxs_dcp_aes_block_crypt()
366 actx->fill, dst_off); in mxs_dcp_aes_block_crypt()
367 dst_off += actx->fill; in mxs_dcp_aes_block_crypt()
368 last_out_len = actx->fill; in mxs_dcp_aes_block_crypt()
369 actx->fill = 0; in mxs_dcp_aes_block_crypt()
452 struct dcp_async_ctx *actx = crypto_tfm_ctx(arq->tfm); in mxs_dcp_aes_enqueue() local
456 if (unlikely(actx->key_len != AES_KEYSIZE_128)) in mxs_dcp_aes_enqueue()
461 actx->chan = DCP_CHAN_CRYPTO; in mxs_dcp_aes_enqueue()
463 spin_lock(&sdcp->lock[actx->chan]); in mxs_dcp_aes_enqueue()
464 ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base); in mxs_dcp_aes_enqueue()
465 spin_unlock(&sdcp->lock[actx->chan]); in mxs_dcp_aes_enqueue()
467 wake_up_process(sdcp->thread[actx->chan]); in mxs_dcp_aes_enqueue()
495 struct dcp_async_ctx *actx = crypto_skcipher_ctx(tfm); in mxs_dcp_aes_setkey() local
502 actx->key_len = len; in mxs_dcp_aes_setkey()
504 memcpy(actx->key, key, len); in mxs_dcp_aes_setkey()
513 crypto_skcipher_clear_flags(actx->fallback, CRYPTO_TFM_REQ_MASK); in mxs_dcp_aes_setkey()
514 crypto_skcipher_set_flags(actx->fallback, in mxs_dcp_aes_setkey()
516 return crypto_skcipher_setkey(actx->fallback, key, len); in mxs_dcp_aes_setkey()
522 struct dcp_async_ctx *actx = crypto_skcipher_ctx(tfm); in mxs_dcp_aes_fallback_init_tfm() local
529 actx->fallback = blk; in mxs_dcp_aes_fallback_init_tfm()
537 struct dcp_async_ctx *actx = crypto_skcipher_ctx(tfm); in mxs_dcp_aes_fallback_exit_tfm() local
539 crypto_free_skcipher(actx->fallback); in mxs_dcp_aes_fallback_exit_tfm()
551 struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); in mxs_dcp_run_sha() local
553 struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; in mxs_dcp_run_sha()
570 desc->control1 = actx->alg; in mxs_dcp_run_sha()
574 desc->size = actx->fill; in mxs_dcp_run_sha()
584 (actx->alg == MXS_DCP_CONTROL1_HASH_SELECT_SHA1) ? in mxs_dcp_run_sha()
603 ret = mxs_dcp_start_dma(actx); in mxs_dcp_run_sha()
621 struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); in dcp_sha_req_to_buf() local
641 if (actx->fill + len > DCP_BUF_SZ) in dcp_sha_req_to_buf()
642 clen = DCP_BUF_SZ - actx->fill; in dcp_sha_req_to_buf()
646 scatterwalk_map_and_copy(in_buf + actx->fill, src, oft, clen, in dcp_sha_req_to_buf()
651 actx->fill += clen; in dcp_sha_req_to_buf()
657 if (len && actx->fill == DCP_BUF_SZ) { in dcp_sha_req_to_buf()
661 actx->fill = 0; in dcp_sha_req_to_buf()
677 actx->fill = 0; in dcp_sha_req_to_buf()
726 struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); in dcp_sha_init() local
734 memset(actx, 0, sizeof(*actx)); in dcp_sha_init()
737 actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA1; in dcp_sha_init()
739 actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA256; in dcp_sha_init()
741 actx->fill = 0; in dcp_sha_init()
742 actx->hot = 0; in dcp_sha_init()
743 actx->chan = DCP_CHAN_HASH_SHA; in dcp_sha_init()
745 mutex_init(&actx->mutex); in dcp_sha_init()
756 struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); in dcp_sha_update_fx() local
767 mutex_lock(&actx->mutex); in dcp_sha_update_fx()
771 if (!actx->hot) { in dcp_sha_update_fx()
772 actx->hot = 1; in dcp_sha_update_fx()
776 spin_lock(&sdcp->lock[actx->chan]); in dcp_sha_update_fx()
777 ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base); in dcp_sha_update_fx()
778 spin_unlock(&sdcp->lock[actx->chan]); in dcp_sha_update_fx()
780 wake_up_process(sdcp->thread[actx->chan]); in dcp_sha_update_fx()
781 mutex_unlock(&actx->mutex); in dcp_sha_update_fx()
818 struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); in dcp_sha_import() local
822 memset(actx, 0, sizeof(struct dcp_async_ctx)); in dcp_sha_import()
824 memcpy(actx, &export->async_ctx, sizeof(struct dcp_async_ctx)); in dcp_sha_import()