Lines Matching refs:sctx
44 struct sha256_state_be *sctx = shash_desc_ctx(desc); in nx_sha256_init() local
46 memset(sctx, 0, sizeof *sctx); in nx_sha256_init()
48 sctx->state[0] = __cpu_to_be32(SHA256_H0); in nx_sha256_init()
49 sctx->state[1] = __cpu_to_be32(SHA256_H1); in nx_sha256_init()
50 sctx->state[2] = __cpu_to_be32(SHA256_H2); in nx_sha256_init()
51 sctx->state[3] = __cpu_to_be32(SHA256_H3); in nx_sha256_init()
52 sctx->state[4] = __cpu_to_be32(SHA256_H4); in nx_sha256_init()
53 sctx->state[5] = __cpu_to_be32(SHA256_H5); in nx_sha256_init()
54 sctx->state[6] = __cpu_to_be32(SHA256_H6); in nx_sha256_init()
55 sctx->state[7] = __cpu_to_be32(SHA256_H7); in nx_sha256_init()
56 sctx->count = 0; in nx_sha256_init()
64 struct sha256_state_be *sctx = shash_desc_ctx(desc); in nx_sha256_update() local
73 u64 buf_len = (sctx->count % SHA256_BLOCK_SIZE); in nx_sha256_update()
81 total = (sctx->count % SHA256_BLOCK_SIZE) + len; in nx_sha256_update()
83 memcpy(sctx->buf + buf_len, data, len); in nx_sha256_update()
84 sctx->count += len; in nx_sha256_update()
88 memcpy(csbcpb->cpb.sha256.message_digest, sctx->state, SHA256_DIGEST_SIZE); in nx_sha256_update()
98 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, in nx_sha256_update()
114 (u8 *) sctx->buf, in nx_sha256_update()
172 memcpy(sctx->buf, data, leftover); in nx_sha256_update()
174 sctx->count += len; in nx_sha256_update()
175 memcpy(sctx->state, csbcpb->cpb.sha256.message_digest, SHA256_DIGEST_SIZE); in nx_sha256_update()
183 struct sha256_state_be *sctx = shash_desc_ctx(desc); in nx_sha256_final() local
201 if (sctx->count >= SHA256_BLOCK_SIZE) { in nx_sha256_final()
204 memcpy(csbcpb->cpb.sha256.input_partial_digest, sctx->state, SHA256_DIGEST_SIZE); in nx_sha256_final()
212 csbcpb->cpb.sha256.message_bit_length = (u64) (sctx->count * 8); in nx_sha256_final()
214 len = sctx->count & (SHA256_BLOCK_SIZE - 1); in nx_sha256_final()
215 in_sg = nx_build_sg_list(nx_ctx->in_sg, (u8 *) sctx->buf, in nx_sha256_final()
218 if (len != (sctx->count & (SHA256_BLOCK_SIZE - 1))) { in nx_sha256_final()
244 atomic64_add(sctx->count, &(nx_ctx->stats->sha256_bytes)); in nx_sha256_final()
253 struct sha256_state_be *sctx = shash_desc_ctx(desc); in nx_sha256_export() local
255 memcpy(out, sctx, sizeof(*sctx)); in nx_sha256_export()
262 struct sha256_state_be *sctx = shash_desc_ctx(desc); in nx_sha256_import() local
264 memcpy(sctx, in, sizeof(*sctx)); in nx_sha256_import()