Lines Matching refs:rctx
28 struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx_dma(req);
34 if (rctx->hash_rem) {
36 unsigned int offset = rctx->nbytes - rctx->hash_rem;
38 scatterwalk_map_and_copy(rctx->buf, rctx->src,
39 offset, rctx->hash_rem, 0);
40 rctx->buf_count = rctx->hash_rem;
42 rctx->buf_count = 0;
46 if (req->result && rctx->final)
47 memcpy(req->result, rctx->iv, digest_size);
50 sg_free_table(&rctx->data_sg);
60 struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx_dma(req);
73 rctx->null_msg = 0;
75 len = (u64)rctx->buf_count + (u64)nbytes;
78 scatterwalk_map_and_copy(rctx->buf + rctx->buf_count, req->src,
80 rctx->buf_count += nbytes;
85 rctx->src = req->src;
86 rctx->nbytes = nbytes;
88 rctx->final = final;
89 rctx->hash_rem = final ? 0 : len & (block_size - 1);
90 rctx->hash_cnt = len - rctx->hash_rem;
91 if (!final && !rctx->hash_rem) {
93 rctx->hash_cnt -= block_size;
94 rctx->hash_rem = block_size;
97 if (final && (rctx->null_msg || (len & (block_size - 1))))
102 sg_init_one(&rctx->iv_sg, rctx->iv, sizeof(rctx->iv));
110 ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp);
115 if (rctx->buf_count) {
116 sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count);
117 sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->buf_sg);
125 sg = ccp_crypto_sg_table_add(&rctx->data_sg, req->src);
135 rctx->hash_cnt += pad_length;
137 memset(rctx->pad, 0, sizeof(rctx->pad));
138 rctx->pad[0] = 0x80;
139 sg_init_one(&rctx->pad_sg, rctx->pad, pad_length);
140 sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->pad_sg);
148 sg = rctx->data_sg.sgl;
156 memset(&rctx->cmd, 0, sizeof(rctx->cmd));
157 INIT_LIST_HEAD(&rctx->cmd.entry);
158 rctx->cmd.engine = CCP_ENGINE_AES;
159 rctx->cmd.u.aes.type = ctx->u.aes.type;
160 rctx->cmd.u.aes.mode = ctx->u.aes.mode;
161 rctx->cmd.u.aes.action = CCP_AES_ACTION_ENCRYPT;
162 rctx->cmd.u.aes.key = &ctx->u.aes.key_sg;
163 rctx->cmd.u.aes.key_len = ctx->u.aes.key_len;
164 rctx->cmd.u.aes.iv = &rctx->iv_sg;
165 rctx->cmd.u.aes.iv_len = AES_BLOCK_SIZE;
166 rctx->cmd.u.aes.src = sg;
167 rctx->cmd.u.aes.src_len = rctx->hash_cnt;
168 rctx->cmd.u.aes.dst = NULL;
169 rctx->cmd.u.aes.cmac_key = cmac_key_sg;
170 rctx->cmd.u.aes.cmac_key_len = ctx->u.aes.kn_len;
171 rctx->cmd.u.aes.cmac_final = final;
173 ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd);
178 sg_free_table(&rctx->data_sg);
185 struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx_dma(req);
187 memset(rctx, 0, sizeof(*rctx));
189 rctx->null_msg = 1;
222 struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx_dma(req);
228 state.null_msg = rctx->null_msg;
229 memcpy(state.iv, rctx->iv, sizeof(state.iv));
230 state.buf_count = rctx->buf_count;
231 memcpy(state.buf, rctx->buf, sizeof(state.buf));
241 struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx_dma(req);
247 memset(rctx, 0, sizeof(*rctx));
248 rctx->null_msg = state.null_msg;
249 memcpy(rctx->iv, state.iv, sizeof(rctx->iv));
250 rctx->buf_count = state.buf_count;
251 memcpy(rctx->buf, state.buf, sizeof(rctx->buf));