Lines Matching refs:ctx

166 	struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
169 if (ctx->flags & DRIVER_FLAGS_MD5)
171 else if (ctx->flags & DRIVER_FLAGS_SHA1)
173 else if (ctx->flags & DRIVER_FLAGS_SHA224)
175 else if (ctx->flags & DRIVER_FLAGS_SHA256)
212 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
214 if (ctx->bufcnt) {
215 img_hash_xmit_cpu(hdev, ctx->buffer, ctx->bufcnt, 0);
216 ctx->bufcnt = 0;
218 if (ctx->sg)
225 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
227 ctx->dma_ct = dma_map_sg(hdev->dev, sg, 1, DMA_TO_DEVICE);
228 if (ctx->dma_ct == 0) {
236 ctx->dma_ct,
255 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
257 ctx->bufcnt = sg_copy_to_buffer(hdev->req->src, sg_nents(ctx->sg),
258 ctx->buffer, hdev->req->nbytes);
260 ctx->total = hdev->req->nbytes;
261 ctx->bufcnt = 0;
267 return img_hash_xmit_cpu(hdev, ctx->buffer, ctx->total, 1);
272 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
277 memcpy(req->result, ctx->digest, ctx->digsize);
284 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
285 u32 *hash = (u32 *)ctx->digest;
288 for (i = (ctx->digsize / sizeof(u32)) - 1; i >= 0; i--)
289 hash[i] = img_hash_read_result_queue(ctx->hdev);
294 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
295 struct img_hash_dev *hdev = ctx->hdev;
303 ctx->flags |= DRIVER_FLAGS_ERROR;
315 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
319 dev_dbg(hdev->dev, "xmit dma size: %d\n", ctx->total);
321 if (!ctx->total)
360 struct img_hash_request_ctx *ctx;
368 ctx = ahash_request_ctx(hdev->req);
369 if (!ctx->sg)
372 addr = sg_virt(ctx->sg);
373 nbytes = ctx->sg->length - ctx->offset;
389 sg_init_one(&tsg, addr + ctx->offset, wsend * 4);
392 ctx->flags |= DRIVER_FLAGS_CPU;
394 img_hash_xmit_cpu(hdev, addr + ctx->offset,
396 ctx->sent += wsend * 4;
399 ctx->sent += wsend * 4;
404 ctx->bufcnt = sg_pcopy_to_buffer(ctx->sgfirst, ctx->nents,
405 ctx->buffer, bleft, ctx->sent);
407 ctx->sg = sg_next(ctx->sg);
408 while (ctx->sg && (ctx->bufcnt < 4)) {
409 len = ctx->sg->length;
410 if (likely(len > (4 - ctx->bufcnt)))
411 len = 4 - ctx->bufcnt;
412 tbc = sg_pcopy_to_buffer(ctx->sgfirst, ctx->nents,
413 ctx->buffer + ctx->bufcnt, len,
414 ctx->sent + ctx->bufcnt);
415 ctx->bufcnt += tbc;
416 if (tbc >= ctx->sg->length) {
417 ctx->sg = sg_next(ctx->sg);
422 ctx->sent += ctx->bufcnt;
423 ctx->offset = tbc;
428 ctx->offset = 0;
429 ctx->sg = sg_next(ctx->sg);
435 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
437 if (ctx->flags & DRIVER_FLAGS_SG)
438 dma_unmap_sg(hdev->dev, ctx->sg, ctx->dma_ct, DMA_TO_DEVICE);
446 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
449 ctx->bufcnt = 0;
490 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
492 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
503 struct img_hash_request_ctx *ctx;
533 ctx = ahash_request_ctx(req);
536 ctx->op, req->nbytes);
554 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
556 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
569 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
571 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
583 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
585 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
599 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
601 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
612 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
614 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
625 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
643 ctx->hdev = hdev;
644 ctx->flags = 0;
645 ctx->digsize = crypto_ahash_digestsize(tfm);
647 switch (ctx->digsize) {
649 ctx->flags |= DRIVER_FLAGS_SHA1;
652 ctx->flags |= DRIVER_FLAGS_SHA256;
655 ctx->flags |= DRIVER_FLAGS_SHA224;
658 ctx->flags |= DRIVER_FLAGS_MD5;
664 ctx->bufcnt = 0;
665 ctx->offset = 0;
666 ctx->sent = 0;
667 ctx->total = req->nbytes;
668 ctx->sg = req->src;
669 ctx->sgfirst = req->src;
670 ctx->nents = sg_nents(ctx->sg);
679 struct img_hash_ctx *ctx = crypto_tfm_ctx(tfm);
682 ctx->fallback = crypto_alloc_ahash(alg_name, 0,
684 if (IS_ERR(ctx->fallback)) {
686 err = PTR_ERR(ctx->fallback);
691 crypto_ahash_reqsize(ctx->fallback) +