Lines Matching refs:md
350 static int sha256_compress(struct sha256_state *md, in sha256_compress() argument
358 S[i] = md->state[i]; in sha256_compress()
387 md->state[i] = md->state[i] + S[i]; in sha256_compress()
396 struct sha256_state *md = (struct sha256_state *)in; in my_sha256_init() local
397 md->curlen = 0; in my_sha256_init()
398 md->length = 0; in my_sha256_init()
399 md->state[0] = 0x6A09E667UL; in my_sha256_init()
400 md->state[1] = 0xBB67AE85UL; in my_sha256_init()
401 md->state[2] = 0x3C6EF372UL; in my_sha256_init()
402 md->state[3] = 0xA54FF53AUL; in my_sha256_init()
403 md->state[4] = 0x510E527FUL; in my_sha256_init()
404 md->state[5] = 0x9B05688CUL; in my_sha256_init()
405 md->state[6] = 0x1F83D9ABUL; in my_sha256_init()
406 md->state[7] = 0x5BE0CD19UL; in my_sha256_init()
423 struct sha256_state *md = (struct sha256_state *)ctx; in my_sha256_update() local
425 if(md->curlen > sizeof(md->buf)) in my_sha256_update()
428 if(md->curlen == 0 && inlen >= CURL_SHA256_BLOCK_SIZE) { in my_sha256_update()
429 if(sha256_compress(md, (unsigned char *)in) < 0) in my_sha256_update()
431 md->length += CURL_SHA256_BLOCK_SIZE * 8; in my_sha256_update()
436 n = CURLMIN(inlen, (CURL_SHA256_BLOCK_SIZE - md->curlen)); in my_sha256_update()
437 memcpy(md->buf + md->curlen, in, n); in my_sha256_update()
438 md->curlen += n; in my_sha256_update()
441 if(md->curlen == CURL_SHA256_BLOCK_SIZE) { in my_sha256_update()
442 if(sha256_compress(md, md->buf) < 0) in my_sha256_update()
444 md->length += 8 * CURL_SHA256_BLOCK_SIZE; in my_sha256_update()
445 md->curlen = 0; in my_sha256_update()
459 struct sha256_state *md = ctx; in my_sha256_final() local
462 if(md->curlen >= sizeof(md->buf)) in my_sha256_final()
466 md->length += md->curlen * 8; in my_sha256_final()
469 md->buf[md->curlen++] = (unsigned char)0x80; in my_sha256_final()
475 if(md->curlen > 56) { in my_sha256_final()
476 while(md->curlen < 64) { in my_sha256_final()
477 md->buf[md->curlen++] = (unsigned char)0; in my_sha256_final()
479 sha256_compress(md, md->buf); in my_sha256_final()
480 md->curlen = 0; in my_sha256_final()
484 while(md->curlen < 56) { in my_sha256_final()
485 md->buf[md->curlen++] = (unsigned char)0; in my_sha256_final()
489 WPA_PUT_BE64(md->buf + 56, md->length); in my_sha256_final()
490 sha256_compress(md, md->buf); in my_sha256_final()
494 WPA_PUT_BE32(out + (4 * i), md->state[i]); in my_sha256_final()