Lines Matching refs:mctx
126 int cifs_md4_init(struct md4_ctx *mctx) in cifs_md4_init() argument
128 memset(mctx, 0, sizeof(struct md4_ctx)); in cifs_md4_init()
129 mctx->hash[0] = 0x67452301; in cifs_md4_init()
130 mctx->hash[1] = 0xefcdab89; in cifs_md4_init()
131 mctx->hash[2] = 0x98badcfe; in cifs_md4_init()
132 mctx->hash[3] = 0x10325476; in cifs_md4_init()
133 mctx->byte_count = 0; in cifs_md4_init()
139 int cifs_md4_update(struct md4_ctx *mctx, const u8 *data, unsigned int len) in cifs_md4_update() argument
141 const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f); in cifs_md4_update()
143 mctx->byte_count += len; in cifs_md4_update()
146 memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), in cifs_md4_update()
151 memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), in cifs_md4_update()
154 md4_transform_helper(mctx); in cifs_md4_update()
158 while (len >= sizeof(mctx->block)) { in cifs_md4_update()
159 memcpy(mctx->block, data, sizeof(mctx->block)); in cifs_md4_update()
160 md4_transform_helper(mctx); in cifs_md4_update()
161 data += sizeof(mctx->block); in cifs_md4_update()
162 len -= sizeof(mctx->block); in cifs_md4_update()
165 memcpy(mctx->block, data, len); in cifs_md4_update()
171 int cifs_md4_final(struct md4_ctx *mctx, u8 *out) in cifs_md4_final() argument
173 const unsigned int offset = mctx->byte_count & 0x3f; in cifs_md4_final()
174 char *p = (char *)mctx->block + offset; in cifs_md4_final()
180 md4_transform_helper(mctx); in cifs_md4_final()
181 p = (char *)mctx->block; in cifs_md4_final()
186 mctx->block[14] = mctx->byte_count << 3; in cifs_md4_final()
187 mctx->block[15] = mctx->byte_count >> 29; in cifs_md4_final()
188 le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - in cifs_md4_final()
190 md4_transform(mctx->hash, mctx->block); in cifs_md4_final()
191 cpu_to_le32_array(mctx->hash, ARRAY_SIZE(mctx->hash)); in cifs_md4_final()
192 memcpy(out, mctx->hash, sizeof(mctx->hash)); in cifs_md4_final()
193 memset(mctx, 0, sizeof(*mctx)); in cifs_md4_final()