Lines Matching refs:rctx
41 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_done() local
53 dma_unmap_sg(qce->dev, req->src, rctx->src_nents, DMA_TO_DEVICE); in qce_ahash_done()
54 dma_unmap_sg(qce->dev, &rctx->result_sg, 1, DMA_FROM_DEVICE); in qce_ahash_done()
56 memcpy(rctx->digest, result->auth_iv, digestsize); in qce_ahash_done()
57 if (req->result && rctx->last_blk) in qce_ahash_done()
60 rctx->byte_count[0] = cpu_to_be32(result->auth_byte_count[0]); in qce_ahash_done()
61 rctx->byte_count[1] = cpu_to_be32(result->auth_byte_count[1]); in qce_ahash_done()
67 req->src = rctx->src_orig; in qce_ahash_done()
68 req->nbytes = rctx->nbytes_orig; in qce_ahash_done()
69 rctx->last_blk = false; in qce_ahash_done()
70 rctx->first_blk = false; in qce_ahash_done()
78 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_async_req_handle() local
82 unsigned long flags = rctx->flags; in qce_ahash_async_req_handle()
86 rctx->authkey = ctx->authkey; in qce_ahash_async_req_handle()
87 rctx->authklen = QCE_SHA_HMAC_KEY_SIZE; in qce_ahash_async_req_handle()
89 rctx->authkey = ctx->authkey; in qce_ahash_async_req_handle()
90 rctx->authklen = AES_KEYSIZE_128; in qce_ahash_async_req_handle()
93 rctx->src_nents = sg_nents_for_len(req->src, req->nbytes); in qce_ahash_async_req_handle()
94 if (rctx->src_nents < 0) { in qce_ahash_async_req_handle()
96 return rctx->src_nents; in qce_ahash_async_req_handle()
99 ret = dma_map_sg(qce->dev, req->src, rctx->src_nents, DMA_TO_DEVICE); in qce_ahash_async_req_handle()
103 sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); in qce_ahash_async_req_handle()
105 ret = dma_map_sg(qce->dev, &rctx->result_sg, 1, DMA_FROM_DEVICE); in qce_ahash_async_req_handle()
111 ret = qce_dma_prep_sgs(&qce->dma, req->src, rctx->src_nents, in qce_ahash_async_req_handle()
112 &rctx->result_sg, 1, qce_ahash_done, async_req); in qce_ahash_async_req_handle()
127 dma_unmap_sg(qce->dev, &rctx->result_sg, 1, DMA_FROM_DEVICE); in qce_ahash_async_req_handle()
129 dma_unmap_sg(qce->dev, req->src, rctx->src_nents, DMA_TO_DEVICE); in qce_ahash_async_req_handle()
135 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_init() local
139 memset(rctx, 0, sizeof(*rctx)); in qce_ahash_init()
140 rctx->first_blk = true; in qce_ahash_init()
141 rctx->last_blk = false; in qce_ahash_init()
142 rctx->flags = tmpl->alg_flags; in qce_ahash_init()
143 memcpy(rctx->digest, std_iv, sizeof(rctx->digest)); in qce_ahash_init()
150 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_export() local
153 memcpy(export_state->pending_buf, rctx->buf, rctx->buflen); in qce_ahash_export()
154 memcpy(export_state->partial_digest, rctx->digest, sizeof(rctx->digest)); in qce_ahash_export()
155 export_state->byte_count[0] = rctx->byte_count[0]; in qce_ahash_export()
156 export_state->byte_count[1] = rctx->byte_count[1]; in qce_ahash_export()
157 export_state->pending_buflen = rctx->buflen; in qce_ahash_export()
158 export_state->count = rctx->count; in qce_ahash_export()
159 export_state->first_blk = rctx->first_blk; in qce_ahash_export()
160 export_state->flags = rctx->flags; in qce_ahash_export()
167 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_import() local
170 memset(rctx, 0, sizeof(*rctx)); in qce_ahash_import()
171 rctx->count = import_state->count; in qce_ahash_import()
172 rctx->buflen = import_state->pending_buflen; in qce_ahash_import()
173 rctx->first_blk = import_state->first_blk; in qce_ahash_import()
174 rctx->flags = import_state->flags; in qce_ahash_import()
175 rctx->byte_count[0] = import_state->byte_count[0]; in qce_ahash_import()
176 rctx->byte_count[1] = import_state->byte_count[1]; in qce_ahash_import()
177 memcpy(rctx->buf, import_state->pending_buf, rctx->buflen); in qce_ahash_import()
178 memcpy(rctx->digest, import_state->partial_digest, sizeof(rctx->digest)); in qce_ahash_import()
186 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_update() local
196 rctx->count += req->nbytes; in qce_ahash_update()
199 total = req->nbytes + rctx->buflen; in qce_ahash_update()
202 scatterwalk_map_and_copy(rctx->buf + rctx->buflen, req->src, in qce_ahash_update()
204 rctx->buflen += req->nbytes; in qce_ahash_update()
209 rctx->src_orig = req->src; in qce_ahash_update()
210 rctx->nbytes_orig = req->nbytes; in qce_ahash_update()
216 if (rctx->buflen) in qce_ahash_update()
217 memcpy(rctx->tmpbuf, rctx->buf, rctx->buflen); in qce_ahash_update()
242 scatterwalk_map_and_copy(rctx->buf, req->src, src_offset, in qce_ahash_update()
249 len = rctx->buflen; in qce_ahash_update()
263 if (rctx->buflen) { in qce_ahash_update()
264 sg_init_table(rctx->sg, 2); in qce_ahash_update()
265 sg_set_buf(rctx->sg, rctx->tmpbuf, rctx->buflen); in qce_ahash_update()
266 sg_chain(rctx->sg, 2, req->src); in qce_ahash_update()
267 req->src = rctx->sg; in qce_ahash_update()
271 rctx->buflen = hash_later; in qce_ahash_update()
278 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_final() local
282 if (!rctx->buflen) { in qce_ahash_final()
289 rctx->last_blk = true; in qce_ahash_final()
291 rctx->src_orig = req->src; in qce_ahash_final()
292 rctx->nbytes_orig = req->nbytes; in qce_ahash_final()
294 memcpy(rctx->tmpbuf, rctx->buf, rctx->buflen); in qce_ahash_final()
295 sg_init_one(rctx->sg, rctx->tmpbuf, rctx->buflen); in qce_ahash_final()
297 req->src = rctx->sg; in qce_ahash_final()
298 req->nbytes = rctx->buflen; in qce_ahash_final()
305 struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req); in qce_ahash_digest() local
314 rctx->src_orig = req->src; in qce_ahash_digest()
315 rctx->nbytes_orig = req->nbytes; in qce_ahash_digest()
316 rctx->first_blk = true; in qce_ahash_digest()
317 rctx->last_blk = true; in qce_ahash_digest()
319 if (!rctx->nbytes_orig) { in qce_ahash_digest()