Lines Matching refs:md
135 static void sha512_compress(struct hash_state * md, const unsigned char *buf) in sha512_compress() argument
142 S[i] = md->sha512.state[i]; in sha512_compress()
169 md->sha512.state[i] = md->sha512.state[i] + S[i]; in sha512_compress()
173 static void sha512_init(struct hash_state * md) in sha512_init() argument
175 md->sha512.curlen = 0; in sha512_init()
176 md->sha512.length = 0; in sha512_init()
177 md->sha512.state[0] = CONST64(0x6a09e667f3bcc908); in sha512_init()
178 md->sha512.state[1] = CONST64(0xbb67ae8584caa73b); in sha512_init()
179 md->sha512.state[2] = CONST64(0x3c6ef372fe94f82b); in sha512_init()
180 md->sha512.state[3] = CONST64(0xa54ff53a5f1d36f1); in sha512_init()
181 md->sha512.state[4] = CONST64(0x510e527fade682d1); in sha512_init()
182 md->sha512.state[5] = CONST64(0x9b05688c2b3e6c1f); in sha512_init()
183 md->sha512.state[6] = CONST64(0x1f83d9abfb41bd6b); in sha512_init()
184 md->sha512.state[7] = CONST64(0x5be0cd19137e2179); in sha512_init()
187 static void sha512_done(struct hash_state * md, unsigned char *out) in sha512_done() argument
192 md->sha512.length += md->sha512.curlen * CONST64(8); in sha512_done()
195 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80; in sha512_done()
200 if (md->sha512.curlen > 112) { in sha512_done()
201 while (md->sha512.curlen < 128) { in sha512_done()
202 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done()
204 sha512_compress(md, md->sha512.buf); in sha512_done()
205 md->sha512.curlen = 0; in sha512_done()
210 while (md->sha512.curlen < 120) { in sha512_done()
211 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done()
215 STORE64H(md->sha512.length, md->sha512.buf + 120); in sha512_done()
216 sha512_compress(md, md->sha512.buf); in sha512_done()
220 STORE64H(md->sha512.state[i], out+(8 * i)); in sha512_done()
226 static void sha512_process(struct hash_state * md, in sha512_process() argument
233 if (md->sha512.curlen == 0 && inlen >= SHA512_BLOCKSIZE) { in sha512_process()
234 sha512_compress(md, in); in sha512_process()
235 md->sha512.length += SHA512_BLOCKSIZE * 8; in sha512_process()
239 n = MIN(inlen, (SHA512_BLOCKSIZE - md->sha512.curlen)); in sha512_process()
240 memcpy(md->sha512.buf + md->sha512.curlen, in sha512_process()
242 md->sha512.curlen += n; in sha512_process()
245 if (md->sha512.curlen == SHA512_BLOCKSIZE) { in sha512_process()
246 sha512_compress(md, md->sha512.buf); in sha512_process()
247 md->sha512.length += SHA512_BLOCKSIZE * 8; in sha512_process()
248 md->sha512.curlen = 0; in sha512_process()
257 struct hash_state md; in f2fs_sha512() local
259 sha512_init(&md); in f2fs_sha512()
260 sha512_process(&md, in, in_size); in f2fs_sha512()
261 sha512_done(&md, out); in f2fs_sha512()
306 struct hash_state md; in main() local