Lines Matching refs:ctx

167 	struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
170 if (ctx->flags & DRIVER_FLAGS_MD5)
172 else if (ctx->flags & DRIVER_FLAGS_SHA1)
174 else if (ctx->flags & DRIVER_FLAGS_SHA224)
176 else if (ctx->flags & DRIVER_FLAGS_SHA256)
213 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
215 if (ctx->bufcnt) {
216 img_hash_xmit_cpu(hdev, ctx->buffer, ctx->bufcnt, 0);
217 ctx->bufcnt = 0;
219 if (ctx->sg)
226 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
228 ctx->dma_ct = dma_map_sg(hdev->dev, sg, 1, DMA_TO_DEVICE);
229 if (ctx->dma_ct == 0) {
237 ctx->dma_ct,
256 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
258 ctx->bufcnt = sg_copy_to_buffer(hdev->req->src, sg_nents(ctx->sg),
259 ctx->buffer, hdev->req->nbytes);
261 ctx->total = hdev->req->nbytes;
262 ctx->bufcnt = 0;
268 return img_hash_xmit_cpu(hdev, ctx->buffer, ctx->total, 1);
273 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
278 memcpy(req->result, ctx->digest, ctx->digsize);
285 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
286 __be32 *hash = (__be32 *)ctx->digest;
289 for (i = (ctx->digsize / sizeof(*hash)) - 1; i >= 0; i--)
290 hash[i] = img_hash_read_result_queue(ctx->hdev);
295 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
296 struct img_hash_dev *hdev = ctx->hdev;
304 ctx->flags |= DRIVER_FLAGS_ERROR;
316 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
320 dev_dbg(hdev->dev, "xmit dma size: %d\n", ctx->total);
322 if (!ctx->total)
361 struct img_hash_request_ctx *ctx;
369 ctx = ahash_request_ctx(hdev->req);
370 if (!ctx->sg)
373 addr = sg_virt(ctx->sg);
374 nbytes = ctx->sg->length - ctx->offset;
390 sg_init_one(&tsg, addr + ctx->offset, wsend * 4);
393 ctx->flags |= DRIVER_FLAGS_CPU;
395 img_hash_xmit_cpu(hdev, addr + ctx->offset,
397 ctx->sent += wsend * 4;
400 ctx->sent += wsend * 4;
405 ctx->bufcnt = sg_pcopy_to_buffer(ctx->sgfirst, ctx->nents,
406 ctx->buffer, bleft, ctx->sent);
408 ctx->sg = sg_next(ctx->sg);
409 while (ctx->sg && (ctx->bufcnt < 4)) {
410 len = ctx->sg->length;
411 if (likely(len > (4 - ctx->bufcnt)))
412 len = 4 - ctx->bufcnt;
413 tbc = sg_pcopy_to_buffer(ctx->sgfirst, ctx->nents,
414 ctx->buffer + ctx->bufcnt, len,
415 ctx->sent + ctx->bufcnt);
416 ctx->bufcnt += tbc;
417 if (tbc >= ctx->sg->length) {
418 ctx->sg = sg_next(ctx->sg);
423 ctx->sent += ctx->bufcnt;
424 ctx->offset = tbc;
429 ctx->offset = 0;
430 ctx->sg = sg_next(ctx->sg);
436 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
438 if (ctx->flags & DRIVER_FLAGS_SG)
439 dma_unmap_sg(hdev->dev, ctx->sg, ctx->dma_ct, DMA_TO_DEVICE);
447 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
450 ctx->bufcnt = 0;
491 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
493 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
504 struct img_hash_request_ctx *ctx;
534 ctx = ahash_request_ctx(req);
537 ctx->op, req->nbytes);
555 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
557 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
570 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
572 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
584 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
586 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
600 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
602 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
613 struct img_hash_ctx *ctx = crypto_ahash_ctx(tfm);
615 ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback);
626 struct img_hash_request_ctx *ctx = ahash_request_ctx(req);
644 ctx->hdev = hdev;
645 ctx->flags = 0;
646 ctx->digsize = crypto_ahash_digestsize(tfm);
648 switch (ctx->digsize) {
650 ctx->flags |= DRIVER_FLAGS_SHA1;
653 ctx->flags |= DRIVER_FLAGS_SHA256;
656 ctx->flags |= DRIVER_FLAGS_SHA224;
659 ctx->flags |= DRIVER_FLAGS_MD5;
665 ctx->bufcnt = 0;
666 ctx->offset = 0;
667 ctx->sent = 0;
668 ctx->total = req->nbytes;
669 ctx->sg = req->src;
670 ctx->sgfirst = req->src;
671 ctx->nents = sg_nents(ctx->sg);
680 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 return PTR_ERR(ctx->fallback);
690 crypto_ahash_reqsize(ctx->fallback) +