Lines Matching refs:rctx
551 struct sahara_aes_reqctx *rctx = skcipher_request_ctx(req); in sahara_aes_cbc_update_iv() local
555 if (rctx->mode & FLAGS_ENCRYPT) { in sahara_aes_cbc_update_iv()
559 memcpy(req->iv, rctx->iv_out, ivsize); in sahara_aes_cbc_update_iv()
568 struct sahara_aes_reqctx *rctx; in sahara_aes_process() local
582 rctx = skcipher_request_ctx(req); in sahara_aes_process()
584 rctx->mode &= FLAGS_MODE_MASK; in sahara_aes_process()
585 dev->flags = (dev->flags & ~FLAGS_MODE_MASK) | rctx->mode; in sahara_aes_process()
594 rctx->iv_out, ivsize, in sahara_aes_process()
654 struct sahara_aes_reqctx *rctx = skcipher_request_ctx(req); in sahara_aes_fallback() local
658 skcipher_request_set_tfm(&rctx->fallback_req, ctx->fallback); in sahara_aes_fallback()
659 skcipher_request_set_callback(&rctx->fallback_req, in sahara_aes_fallback()
663 skcipher_request_set_crypt(&rctx->fallback_req, req->src, in sahara_aes_fallback()
667 return crypto_skcipher_encrypt(&rctx->fallback_req); in sahara_aes_fallback()
669 return crypto_skcipher_decrypt(&rctx->fallback_req); in sahara_aes_fallback()
674 struct sahara_aes_reqctx *rctx = skcipher_request_ctx(req); in sahara_aes_crypt() local
695 rctx->mode = mode; in sahara_aes_crypt()
752 struct sahara_sha_reqctx *rctx) in sahara_sha_init_hdr() argument
756 hdr = rctx->mode; in sahara_sha_init_hdr()
758 if (rctx->first) { in sahara_sha_init_hdr()
765 if (rctx->last) in sahara_sha_init_hdr()
775 struct sahara_sha_reqctx *rctx, in sahara_sha_hw_links_create() argument
783 dev->in_sg = rctx->in_sg; in sahara_sha_hw_links_create()
785 dev->nb_in_sg = sg_nents_for_len(dev->in_sg, rctx->total); in sahara_sha_hw_links_create()
801 len = rctx->total; in sahara_sha_hw_links_create()
818 struct sahara_sha_reqctx *rctx, in sahara_sha_hw_data_descriptor_create() argument
825 if (rctx->first) in sahara_sha_hw_data_descriptor_create()
827 dev->hw_desc[index]->hdr = sahara_sha_init_hdr(dev, rctx); in sahara_sha_hw_data_descriptor_create()
832 dev->hw_desc[index]->len1 = rctx->total; in sahara_sha_hw_data_descriptor_create()
836 rctx->sg_in_idx = 0; in sahara_sha_hw_data_descriptor_create()
840 i = sahara_sha_hw_links_create(dev, rctx, index); in sahara_sha_hw_data_descriptor_create()
842 rctx->sg_in_idx = index; in sahara_sha_hw_data_descriptor_create()
850 result_len = rctx->context_size; in sahara_sha_hw_data_descriptor_create()
871 struct sahara_sha_reqctx *rctx, in sahara_sha_hw_context_descriptor_create() argument
875 dev->hw_desc[index]->hdr = sahara_sha_init_hdr(dev, rctx); in sahara_sha_hw_context_descriptor_create()
877 dev->hw_desc[index]->len1 = rctx->context_size; in sahara_sha_hw_context_descriptor_create()
882 dev->hw_link[index]->len = rctx->context_size; in sahara_sha_hw_context_descriptor_create()
892 struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); in sahara_sha_prepare_request() local
900 len = rctx->buf_cnt + req->nbytes; in sahara_sha_prepare_request()
903 if (!rctx->last && (len < block_size)) { in sahara_sha_prepare_request()
905 scatterwalk_map_and_copy(rctx->buf + rctx->buf_cnt, req->src, in sahara_sha_prepare_request()
907 rctx->buf_cnt += req->nbytes; in sahara_sha_prepare_request()
913 if (rctx->buf_cnt) in sahara_sha_prepare_request()
914 memcpy(rctx->rembuf, rctx->buf, rctx->buf_cnt); in sahara_sha_prepare_request()
917 hash_later = rctx->last ? 0 : len & (block_size - 1); in sahara_sha_prepare_request()
921 scatterwalk_map_and_copy(rctx->buf, req->src, offset, in sahara_sha_prepare_request()
925 rctx->total = len - hash_later; in sahara_sha_prepare_request()
927 if (rctx->buf_cnt && req->nbytes) { in sahara_sha_prepare_request()
928 sg_init_table(rctx->in_sg_chain, 2); in sahara_sha_prepare_request()
929 sg_set_buf(rctx->in_sg_chain, rctx->rembuf, rctx->buf_cnt); in sahara_sha_prepare_request()
930 sg_chain(rctx->in_sg_chain, 2, req->src); in sahara_sha_prepare_request()
931 rctx->in_sg = rctx->in_sg_chain; in sahara_sha_prepare_request()
933 } else if (rctx->buf_cnt) { in sahara_sha_prepare_request()
934 rctx->in_sg = rctx->in_sg_chain; in sahara_sha_prepare_request()
935 sg_init_one(rctx->in_sg, rctx->rembuf, rctx->buf_cnt); in sahara_sha_prepare_request()
938 rctx->in_sg = req->src; in sahara_sha_prepare_request()
942 rctx->buf_cnt = hash_later; in sahara_sha_prepare_request()
950 struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); in sahara_sha_process() local
958 if (rctx->first) { in sahara_sha_process()
959 ret = sahara_sha_hw_data_descriptor_create(dev, rctx, req, 0); in sahara_sha_process()
964 rctx->first = 0; in sahara_sha_process()
966 memcpy(dev->context_base, rctx->context, rctx->context_size); in sahara_sha_process()
968 sahara_sha_hw_context_descriptor_create(dev, rctx, req, 0); in sahara_sha_process()
970 ret = sahara_sha_hw_data_descriptor_create(dev, rctx, req, 1); in sahara_sha_process()
987 if (rctx->sg_in_idx) in sahara_sha_process()
996 memcpy(rctx->context, dev->context_base, rctx->context_size); in sahara_sha_process()
998 if (req->result && rctx->last) in sahara_sha_process()
999 memcpy(req->result, rctx->context, rctx->digest_size); in sahara_sha_process()
1049 struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); in sahara_sha_enqueue() local
1056 rctx->last = last; in sahara_sha_enqueue()
1058 if (!rctx->active) { in sahara_sha_enqueue()
1059 rctx->active = 1; in sahara_sha_enqueue()
1060 rctx->first = 1; in sahara_sha_enqueue()
1075 struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); in sahara_sha_init() local
1077 memset(rctx, 0, sizeof(*rctx)); in sahara_sha_init()
1081 rctx->mode |= SAHARA_HDR_MDHA_ALG_SHA1; in sahara_sha_init()
1082 rctx->digest_size = SHA1_DIGEST_SIZE; in sahara_sha_init()
1085 rctx->mode |= SAHARA_HDR_MDHA_ALG_SHA256; in sahara_sha_init()
1086 rctx->digest_size = SHA256_DIGEST_SIZE; in sahara_sha_init()
1092 rctx->context_size = rctx->digest_size + 4; in sahara_sha_init()
1093 rctx->active = 0; in sahara_sha_init()
1123 struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); in sahara_sha_export() local
1125 memcpy(out, rctx, sizeof(struct sahara_sha_reqctx)); in sahara_sha_export()
1132 struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); in sahara_sha_import() local
1134 memcpy(rctx, in, sizeof(struct sahara_sha_reqctx)); in sahara_sha_import()