Lines Matching defs:rctx

31 	struct ccp_sha_req_ctx *rctx = ahash_request_ctx_dma(req);
37 if (rctx->hash_rem) {
39 unsigned int offset = rctx->nbytes - rctx->hash_rem;
41 scatterwalk_map_and_copy(rctx->buf, rctx->src,
42 offset, rctx->hash_rem, 0);
43 rctx->buf_count = rctx->hash_rem;
45 rctx->buf_count = 0;
49 if (req->result && rctx->final)
50 memcpy(req->result, rctx->ctx, digest_size);
53 sg_free_table(&rctx->data_sg);
63 struct ccp_sha_req_ctx *rctx = ahash_request_ctx_dma(req);
72 len = (u64)rctx->buf_count + (u64)nbytes;
75 scatterwalk_map_and_copy(rctx->buf + rctx->buf_count, req->src,
77 rctx->buf_count += nbytes;
82 rctx->src = req->src;
83 rctx->nbytes = nbytes;
85 rctx->final = final;
86 rctx->hash_rem = final ? 0 : len & (block_size - 1);
87 rctx->hash_cnt = len - rctx->hash_rem;
88 if (!final && !rctx->hash_rem) {
90 rctx->hash_cnt -= block_size;
91 rctx->hash_rem = block_size;
95 sg_init_one(&rctx->ctx_sg, rctx->ctx, sizeof(rctx->ctx));
98 if (rctx->buf_count && nbytes) {
105 ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp);
109 sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count);
110 sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->buf_sg);
115 sg = ccp_crypto_sg_table_add(&rctx->data_sg, req->src);
122 sg = rctx->data_sg.sgl;
123 } else if (rctx->buf_count) {
124 sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count);
126 sg = &rctx->buf_sg;
131 rctx->msg_bits += (rctx->hash_cnt << 3); /* Total in bits */
133 memset(&rctx->cmd, 0, sizeof(rctx->cmd));
134 INIT_LIST_HEAD(&rctx->cmd.entry);
135 rctx->cmd.engine = CCP_ENGINE_SHA;
136 rctx->cmd.u.sha.type = rctx->type;
137 rctx->cmd.u.sha.ctx = &rctx->ctx_sg;
139 switch (rctx->type) {
141 rctx->cmd.u.sha.ctx_len = SHA1_DIGEST_SIZE;
144 rctx->cmd.u.sha.ctx_len = SHA224_DIGEST_SIZE;
147 rctx->cmd.u.sha.ctx_len = SHA256_DIGEST_SIZE;
150 rctx->cmd.u.sha.ctx_len = SHA384_DIGEST_SIZE;
153 rctx->cmd.u.sha.ctx_len = SHA512_DIGEST_SIZE;
160 rctx->cmd.u.sha.src = sg;
161 rctx->cmd.u.sha.src_len = rctx->hash_cnt;
162 rctx->cmd.u.sha.opad = ctx->u.sha.key_len ?
164 rctx->cmd.u.sha.opad_len = ctx->u.sha.key_len ?
166 rctx->cmd.u.sha.first = rctx->first;
167 rctx->cmd.u.sha.final = rctx->final;
168 rctx->cmd.u.sha.msg_bits = rctx->msg_bits;
170 rctx->first = 0;
172 ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd);
177 sg_free_table(&rctx->data_sg);
186 struct ccp_sha_req_ctx *rctx = ahash_request_ctx_dma(req);
192 memset(rctx, 0, sizeof(*rctx));
194 rctx->type = alg->type;
195 rctx->first = 1;
199 memcpy(rctx->buf, ctx->u.sha.ipad, block_size);
200 rctx->buf_count = block_size;
234 struct ccp_sha_req_ctx *rctx = ahash_request_ctx_dma(req);
240 state.type = rctx->type;
241 state.msg_bits = rctx->msg_bits;
242 state.first = rctx->first;
243 memcpy(state.ctx, rctx->ctx, sizeof(state.ctx));
244 state.buf_count = rctx->buf_count;
245 memcpy(state.buf, rctx->buf, sizeof(state.buf));
255 struct ccp_sha_req_ctx *rctx = ahash_request_ctx_dma(req);
261 memset(rctx, 0, sizeof(*rctx));
262 rctx->type = state.type;
263 rctx->msg_bits = state.msg_bits;
264 rctx->first = state.first;
265 memcpy(rctx->ctx, state.ctx, sizeof(rctx->ctx));
266 rctx->buf_count = state.buf_count;
267 memcpy(rctx->buf, state.buf, sizeof(rctx->buf));