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