Lines Matching refs:ctx
39 static inline int starfive_hash_wait_busy(struct starfive_cryp_ctx *ctx)
41 struct starfive_cryp_dev *cryp = ctx->cryp;
48 static inline int starfive_hash_wait_key_done(struct starfive_cryp_ctx *ctx)
50 struct starfive_cryp_dev *cryp = ctx->cryp;
57 static int starfive_hash_hmac_key(struct starfive_cryp_ctx *ctx)
59 struct starfive_cryp_request_ctx *rctx = ctx->rctx;
60 struct starfive_cryp_dev *cryp = ctx->cryp;
61 int klen = ctx->keylen, loop;
62 unsigned int *key = (unsigned int *)ctx->key;
65 writel(ctx->keylen, cryp->base + STARFIVE_HASH_SHAWKLEN);
81 if (starfive_hash_wait_key_done(ctx))
89 struct starfive_cryp_ctx *ctx = param;
90 struct starfive_cryp_request_ctx *rctx = ctx->rctx;
91 struct starfive_cryp_dev *cryp = ctx->cryp;
113 static int starfive_hash_xmit_dma(struct starfive_cryp_ctx *ctx)
115 struct starfive_cryp_request_ctx *rctx = ctx->rctx;
116 struct starfive_cryp_dev *cryp = ctx->cryp;
123 starfive_hash_start(ctx);
160 in_desc->callback_param = ctx;
168 static int starfive_hash_xmit(struct starfive_cryp_ctx *ctx)
170 struct starfive_cryp_request_ctx *rctx = ctx->rctx;
171 struct starfive_cryp_dev *cryp = ctx->cryp;
178 if (starfive_hash_wait_busy(ctx))
182 rctx->csr.hash.mode = ctx->hash_mode;
185 if (ctx->is_hmac) {
186 ret = starfive_hash_hmac_key(ctx);
195 return starfive_hash_xmit_dma(ctx);
201 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req));
212 data[count] = readl(ctx->cryp->base + STARFIVE_HASH_SHARDR);
262 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req));
263 struct starfive_cryp_dev *cryp = ctx->cryp;
268 return starfive_hash_xmit(ctx);
275 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
277 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
292 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
294 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
309 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
311 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
326 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
328 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
343 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
345 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
358 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
360 struct starfive_cryp_dev *cryp = ctx->cryp;
370 ctx->rctx = rctx;
382 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
384 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
396 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
398 ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
410 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
412 ctx->cryp = starfive_cryp_find_dev(ctx);
414 if (!ctx->cryp)
417 ctx->ahash_fbk = crypto_alloc_ahash(alg_name, 0,
420 if (IS_ERR(ctx->ahash_fbk))
421 return dev_err_probe(ctx->cryp->dev, PTR_ERR(ctx->ahash_fbk),
424 crypto_ahash_set_statesize(hash, crypto_ahash_statesize(ctx->ahash_fbk));
426 crypto_ahash_reqsize(ctx->ahash_fbk));
428 ctx->keylen = 0;
429 ctx->hash_mode = mode;
436 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
438 crypto_free_ahash(ctx->ahash_fbk);
441 static int starfive_hash_long_setkey(struct starfive_cryp_ctx *ctx,
475 ahash_request_set_crypt(req, &sg, ctx->key, keylen);
490 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
495 crypto_ahash_setkey(ctx->ahash_fbk, key, keylen);
498 memcpy(ctx->key, key, keylen);
499 ctx->keylen = keylen;
503 ctx->keylen = digestsize;
510 if (ctx->hash_mode == STARFIVE_HASH_SM3)
525 return starfive_hash_long_setkey(ctx, key, keylen, alg_name);
560 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
562 ctx->is_hmac = true;
570 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
572 ctx->is_hmac = true;
580 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
582 ctx->is_hmac = true;
590 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
592 ctx->is_hmac = true;
600 struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(hash);
602 ctx->is_hmac = true;