Lines Matching full:md

127 static int sha256_compress(struct sha256_state *md,  in sha256_compress()  argument
134 S[i] = md->state[i]; in sha256_compress()
158 md->state[i] = md->state[i] + S[i]; in sha256_compress()
163 static void SHA256_Init(struct sha256_state *md) in SHA256_Init() argument
165 md->curlen = 0; in SHA256_Init()
166 md->length = 0; in SHA256_Init()
167 md->state[0] = 0x6A09E667UL; in SHA256_Init()
168 md->state[1] = 0xBB67AE85UL; in SHA256_Init()
169 md->state[2] = 0x3C6EF372UL; in SHA256_Init()
170 md->state[3] = 0xA54FF53AUL; in SHA256_Init()
171 md->state[4] = 0x510E527FUL; in SHA256_Init()
172 md->state[5] = 0x9B05688CUL; in SHA256_Init()
173 md->state[6] = 0x1F83D9ABUL; in SHA256_Init()
174 md->state[7] = 0x5BE0CD19UL; in SHA256_Init()
178 @param md The hash state
183 static int SHA256_Update(struct sha256_state *md, in SHA256_Update() argument
189 if(md->curlen > sizeof(md->buf)) in SHA256_Update()
192 if(md->curlen == 0 && inlen >= block_size) { in SHA256_Update()
193 if(sha256_compress(md, (unsigned char *)in) < 0) in SHA256_Update()
195 md->length += block_size * 8; in SHA256_Update()
200 n = CURLMIN(inlen, (block_size - md->curlen)); in SHA256_Update()
201 memcpy(md->buf + md->curlen, in, n); in SHA256_Update()
202 md->curlen += n; in SHA256_Update()
205 if(md->curlen == block_size) { in SHA256_Update()
206 if(sha256_compress(md, md->buf) < 0) in SHA256_Update()
208 md->length += 8 * block_size; in SHA256_Update()
209 md->curlen = 0; in SHA256_Update()
217 @param md The hash state
222 struct sha256_state *md) in SHA256_Final() argument
225 if(md->curlen >= sizeof(md->buf)) in SHA256_Final()
228 md->length += md->curlen * 8; in SHA256_Final()
230 md->buf[md->curlen++] = (unsigned char)0x80; in SHA256_Final()
235 if(md->curlen > 56) { in SHA256_Final()
236 while(md->curlen < 64) { in SHA256_Final()
237 md->buf[md->curlen++] = (unsigned char)0; in SHA256_Final()
239 sha256_compress(md, md->buf); in SHA256_Final()
240 md->curlen = 0; in SHA256_Final()
243 while(md->curlen < 56) { in SHA256_Final()
244 md->buf[md->curlen++] = (unsigned char)0; in SHA256_Final()
247 WPA_PUT_BE64(md->buf + 56, md->length); in SHA256_Final()
248 sha256_compress(md, md->buf); in SHA256_Final()
251 WPA_PUT_BE32(out + (4 * i), md->state[i]); in SHA256_Final()