Lines Matching refs:nx_ctx
34 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm); in nx_crypto_ctx_sha256_init() local
41 nx_ctx_init(nx_ctx, HCOP_FC_SHA); in nx_crypto_ctx_sha256_init()
43 nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA256]; in nx_crypto_ctx_sha256_init()
45 NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA256); in nx_crypto_ctx_sha256_init()
72 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); in nx_sha256_update() local
73 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; in nx_sha256_update()
82 spin_lock_irqsave(&nx_ctx->lock, irq_flags); in nx_sha256_update()
99 max_sg_len = min_t(u64, nx_ctx->ap->sglen, in nx_sha256_update()
102 nx_ctx->ap->databytelen/NX_PAGE_SIZE); in nx_sha256_update()
105 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, in nx_sha256_update()
107 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); in nx_sha256_update()
116 struct nx_sg *in_sg = nx_ctx->in_sg; in nx_sha256_update()
129 used_sgs = in_sg - nx_ctx->in_sg; in nx_sha256_update()
147 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); in nx_sha256_update()
160 if (!nx_ctx->op.inlen || !nx_ctx->op.outlen) { in nx_sha256_update()
165 rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, in nx_sha256_update()
170 atomic_inc(&(nx_ctx->stats->sha256_ops)); in nx_sha256_update()
185 spin_unlock_irqrestore(&nx_ctx->lock, irq_flags); in nx_sha256_update()
192 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); in nx_sha256_final() local
193 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; in nx_sha256_final()
200 spin_lock_irqsave(&nx_ctx->lock, irq_flags); in nx_sha256_final()
202 max_sg_len = min_t(u64, nx_ctx->ap->sglen, in nx_sha256_final()
205 nx_ctx->ap->databytelen/NX_PAGE_SIZE); in nx_sha256_final()
223 in_sg = nx_build_sg_list(nx_ctx->in_sg, (u8 *) sctx->buf, in nx_sha256_final()
232 out_sg = nx_build_sg_list(nx_ctx->out_sg, out, &len, max_sg_len); in nx_sha256_final()
239 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); in nx_sha256_final()
240 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); in nx_sha256_final()
241 if (!nx_ctx->op.outlen) { in nx_sha256_final()
246 rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, in nx_sha256_final()
251 atomic_inc(&(nx_ctx->stats->sha256_ops)); in nx_sha256_final()
253 atomic64_add(sctx->count, &(nx_ctx->stats->sha256_bytes)); in nx_sha256_final()
256 spin_unlock_irqrestore(&nx_ctx->lock, irq_flags); in nx_sha256_final()