Lines Matching full:md
115 static void sha512_compress(struct hash_state * md, const unsigned char *buf) in sha512_compress() argument
122 S[i] = md->sha512.state[i]; in sha512_compress()
149 md->sha512.state[i] = md->sha512.state[i] + S[i]; in sha512_compress()
153 static void sha512_init(struct hash_state * md) in sha512_init() argument
155 md->sha512.curlen = 0; in sha512_init()
156 md->sha512.length = 0; in sha512_init()
157 md->sha512.state[0] = CONST64(0x6a09e667f3bcc908); in sha512_init()
158 md->sha512.state[1] = CONST64(0xbb67ae8584caa73b); in sha512_init()
159 md->sha512.state[2] = CONST64(0x3c6ef372fe94f82b); in sha512_init()
160 md->sha512.state[3] = CONST64(0xa54ff53a5f1d36f1); in sha512_init()
161 md->sha512.state[4] = CONST64(0x510e527fade682d1); in sha512_init()
162 md->sha512.state[5] = CONST64(0x9b05688c2b3e6c1f); in sha512_init()
163 md->sha512.state[6] = CONST64(0x1f83d9abfb41bd6b); in sha512_init()
164 md->sha512.state[7] = CONST64(0x5be0cd19137e2179); in sha512_init()
167 static void sha512_done(struct hash_state * md, unsigned char *out) in sha512_done() argument
172 md->sha512.length += md->sha512.curlen * CONST64(8); in sha512_done()
175 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80; in sha512_done()
180 if (md->sha512.curlen > 112) { in sha512_done()
181 while (md->sha512.curlen < 128) { in sha512_done()
182 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done()
184 sha512_compress(md, md->sha512.buf); in sha512_done()
185 md->sha512.curlen = 0; in sha512_done()
190 while (md->sha512.curlen < 120) { in sha512_done()
191 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done()
195 STORE64H(md->sha512.length, md->sha512.buf + 120); in sha512_done()
196 sha512_compress(md, md->sha512.buf); in sha512_done()
200 STORE64H(md->sha512.state[i], out+(8 * i)); in sha512_done()
206 static void sha512_process(struct hash_state * md, in sha512_process() argument
213 if (md->sha512.curlen == 0 && inlen >= SHA512_BLOCKSIZE) { in sha512_process()
214 sha512_compress(md, in); in sha512_process()
215 md->sha512.length += SHA512_BLOCKSIZE * 8; in sha512_process()
219 n = MIN(inlen, (SHA512_BLOCKSIZE - md->sha512.curlen)); in sha512_process()
220 memcpy(md->sha512.buf + md->sha512.curlen, in sha512_process()
222 md->sha512.curlen += n; in sha512_process()
225 if (md->sha512.curlen == SHA512_BLOCKSIZE) { in sha512_process()
226 sha512_compress(md, md->sha512.buf); in sha512_process()
227 md->sha512.length += SHA512_BLOCKSIZE * 8; in sha512_process()
228 md->sha512.curlen = 0; in sha512_process()
237 struct hash_state md; in ext2fs_sha512() local
239 sha512_init(&md); in ext2fs_sha512()
240 sha512_process(&md, in, in_size); in ext2fs_sha512()
241 sha512_done(&md, out); in ext2fs_sha512()