Lines Matching refs:sctx
23 struct sha256_state *sctx = shash_desc_ctx(desc);
25 sha224_init(sctx);
31 struct sha256_state *sctx = shash_desc_ctx(desc);
33 sha256_init(sctx);
37 static inline int lib_sha256_base_do_update(struct sha256_state *sctx,
42 unsigned int partial = sctx->count % SHA256_BLOCK_SIZE;
44 sctx->count += len;
52 memcpy(sctx->buf + partial, data, p);
56 block_fn(sctx, sctx->buf, 1);
63 block_fn(sctx, data, blocks);
69 memcpy(sctx->buf + partial, data, len);
79 struct sha256_state *sctx = shash_desc_ctx(desc);
81 return lib_sha256_base_do_update(sctx, data, len, block_fn);
84 static inline int lib_sha256_base_do_finalize(struct sha256_state *sctx,
88 __be64 *bits = (__be64 *)(sctx->buf + bit_offset);
89 unsigned int partial = sctx->count % SHA256_BLOCK_SIZE;
91 sctx->buf[partial++] = 0x80;
93 memset(sctx->buf + partial, 0x0, SHA256_BLOCK_SIZE - partial);
96 block_fn(sctx, sctx->buf, 1);
99 memset(sctx->buf + partial, 0x0, bit_offset - partial);
100 *bits = cpu_to_be64(sctx->count << 3);
101 block_fn(sctx, sctx->buf, 1);
109 struct sha256_state *sctx = shash_desc_ctx(desc);
111 return lib_sha256_base_do_finalize(sctx, block_fn);
114 static inline int lib_sha256_base_finish(struct sha256_state *sctx, u8 *out,
121 put_unaligned_be32(sctx->state[i], digest++);
123 memzero_explicit(sctx, sizeof(*sctx));
130 struct sha256_state *sctx = shash_desc_ctx(desc);
132 return lib_sha256_base_finish(sctx, out, digest_size);