Lines Matching refs:context
142 PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX * context) in PHP_SHA256Init() argument
144 context->count[0] = context->count[1] = 0; in PHP_SHA256Init()
147 context->state[0] = 0x6a09e667; in PHP_SHA256Init()
148 context->state[1] = 0xbb67ae85; in PHP_SHA256Init()
149 context->state[2] = 0x3c6ef372; in PHP_SHA256Init()
150 context->state[3] = 0xa54ff53a; in PHP_SHA256Init()
151 context->state[4] = 0x510e527f; in PHP_SHA256Init()
152 context->state[5] = 0x9b05688c; in PHP_SHA256Init()
153 context->state[6] = 0x1f83d9ab; in PHP_SHA256Init()
154 context->state[7] = 0x5be0cd19; in PHP_SHA256Init()
202 PHP_HASH_API void PHP_SHA224Init(PHP_SHA224_CTX * context) in PHP_SHA224Init() argument
204 context->count[0] = context->count[1] = 0; in PHP_SHA224Init()
207 context->state[0] = 0xc1059ed8; in PHP_SHA224Init()
208 context->state[1] = 0x367cd507; in PHP_SHA224Init()
209 context->state[2] = 0x3070dd17; in PHP_SHA224Init()
210 context->state[3] = 0xf70e5939; in PHP_SHA224Init()
211 context->state[4] = 0xffc00b31; in PHP_SHA224Init()
212 context->state[5] = 0x68581511; in PHP_SHA224Init()
213 context->state[6] = 0x64f98fa7; in PHP_SHA224Init()
214 context->state[7] = 0xbefa4fa4; in PHP_SHA224Init()
223 PHP_HASH_API void PHP_SHA224Update(PHP_SHA224_CTX * context, const unsigned char *input, size_t inp… in PHP_SHA224Update() argument
228 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA224Update()
231 if ((context->count[0] += ((uint32_t) inputLen << 3)) < ((uint32_t) inputLen << 3)) { in PHP_SHA224Update()
232 context->count[1]++; in PHP_SHA224Update()
234 context->count[1] += ((uint32_t) inputLen >> 29); in PHP_SHA224Update()
241 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA224Update()
242 SHA256Transform(context->state, context->buffer); in PHP_SHA224Update()
245 SHA256Transform(context->state, &input[i]); in PHP_SHA224Update()
254 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA224Update()
262 PHP_HASH_API void PHP_SHA224Final(unsigned char digest[28], PHP_SHA224_CTX * context) in PHP_SHA224Final() argument
268 bits[7] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA224Final()
269 bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA224Final()
270 bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA224Final()
271 bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA224Final()
272 bits[3] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA224Final()
273 bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA224Final()
274 bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA224Final()
275 bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA224Final()
279 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA224Final()
281 PHP_SHA224Update(context, PADDING, padLen); in PHP_SHA224Final()
284 PHP_SHA224Update(context, bits, 8); in PHP_SHA224Final()
287 SHAEncode32(digest, context->state, 28); in PHP_SHA224Final()
291 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA224Final()
300 PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX * context, const unsigned char *input, size_t inp… in PHP_SHA256Update() argument
305 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA256Update()
308 if ((context->count[0] += ((uint32_t) inputLen << 3)) < ((uint32_t) inputLen << 3)) { in PHP_SHA256Update()
309 context->count[1]++; in PHP_SHA256Update()
311 context->count[1] += ((uint32_t) inputLen >> 29); in PHP_SHA256Update()
318 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA256Update()
319 SHA256Transform(context->state, context->buffer); in PHP_SHA256Update()
322 SHA256Transform(context->state, &input[i]); in PHP_SHA256Update()
331 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA256Update()
339 PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX * context) in PHP_SHA256Final() argument
345 bits[7] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA256Final()
346 bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA256Final()
347 bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA256Final()
348 bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA256Final()
349 bits[3] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA256Final()
350 bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA256Final()
351 bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA256Final()
352 bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA256Final()
356 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA256Final()
358 PHP_SHA256Update(context, PADDING, padLen); in PHP_SHA256Final()
361 PHP_SHA256Update(context, bits, 8); in PHP_SHA256Final()
364 SHAEncode32(digest, context->state, 32); in PHP_SHA256Final()
368 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA256Final()
451 PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX * context) in PHP_SHA384Init() argument
453 context->count[0] = context->count[1] = 0; in PHP_SHA384Init()
456 context->state[0] = L64(0xcbbb9d5dc1059ed8); in PHP_SHA384Init()
457 context->state[1] = L64(0x629a292a367cd507); in PHP_SHA384Init()
458 context->state[2] = L64(0x9159015a3070dd17); in PHP_SHA384Init()
459 context->state[3] = L64(0x152fecd8f70e5939); in PHP_SHA384Init()
460 context->state[4] = L64(0x67332667ffc00b31); in PHP_SHA384Init()
461 context->state[5] = L64(0x8eb44a8768581511); in PHP_SHA384Init()
462 context->state[6] = L64(0xdb0c2e0d64f98fa7); in PHP_SHA384Init()
463 context->state[7] = L64(0x47b5481dbefa4fa4); in PHP_SHA384Init()
514 PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX * context, const unsigned char *input, size_t inp… in PHP_SHA384Update() argument
519 index = (unsigned int) ((context->count[0] >> 3) & 0x7F); in PHP_SHA384Update()
522 if ((context->count[0] += ((uint64_t) inputLen << 3)) < ((uint64_t) inputLen << 3)) { in PHP_SHA384Update()
523 context->count[1]++; in PHP_SHA384Update()
525 context->count[1] += ((uint64_t) inputLen >> 61); in PHP_SHA384Update()
532 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA384Update()
533 SHA512Transform(context->state, context->buffer); in PHP_SHA384Update()
536 SHA512Transform(context->state, &input[i]); in PHP_SHA384Update()
543 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA384Update()
551 PHP_HASH_API void PHP_SHA384Final(unsigned char digest[48], PHP_SHA384_CTX * context) in PHP_SHA384Final() argument
557 bits[15] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA384Final()
558 bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA384Final()
559 bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA384Final()
560 bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA384Final()
561 bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF); in PHP_SHA384Final()
562 bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF); in PHP_SHA384Final()
563 bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF); in PHP_SHA384Final()
564 bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF); in PHP_SHA384Final()
565 bits[7] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA384Final()
566 bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA384Final()
567 bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA384Final()
568 bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA384Final()
569 bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF); in PHP_SHA384Final()
570 bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF); in PHP_SHA384Final()
571 bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF); in PHP_SHA384Final()
572 bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF); in PHP_SHA384Final()
576 index = (unsigned int) ((context->count[0] >> 3) & 0x7f); in PHP_SHA384Final()
578 PHP_SHA384Update(context, PADDING, padLen); in PHP_SHA384Final()
581 PHP_SHA384Update(context, bits, 16); in PHP_SHA384Final()
584 SHAEncode64(digest, context->state, 48); in PHP_SHA384Final()
588 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA384Final()
610 PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX * context) in PHP_SHA512Init() argument
612 context->count[0] = context->count[1] = 0; in PHP_SHA512Init()
615 context->state[0] = L64(0x6a09e667f3bcc908); in PHP_SHA512Init()
616 context->state[1] = L64(0xbb67ae8584caa73b); in PHP_SHA512Init()
617 context->state[2] = L64(0x3c6ef372fe94f82b); in PHP_SHA512Init()
618 context->state[3] = L64(0xa54ff53a5f1d36f1); in PHP_SHA512Init()
619 context->state[4] = L64(0x510e527fade682d1); in PHP_SHA512Init()
620 context->state[5] = L64(0x9b05688c2b3e6c1f); in PHP_SHA512Init()
621 context->state[6] = L64(0x1f83d9abfb41bd6b); in PHP_SHA512Init()
622 context->state[7] = L64(0x5be0cd19137e2179); in PHP_SHA512Init()
629 PHP_HASH_API void PHP_SHA512_256Init(PHP_SHA512_CTX * context) in PHP_SHA512_256Init() argument
631 context->count[0] = context->count[1] = 0; in PHP_SHA512_256Init()
633 context->state[0] = L64(0x22312194FC2BF72C); in PHP_SHA512_256Init()
634 context->state[1] = L64(0x9F555FA3C84C64C2); in PHP_SHA512_256Init()
635 context->state[2] = L64(0x2393B86B6F53B151); in PHP_SHA512_256Init()
636 context->state[3] = L64(0x963877195940EABD); in PHP_SHA512_256Init()
637 context->state[4] = L64(0x96283EE2A88EFFE3); in PHP_SHA512_256Init()
638 context->state[5] = L64(0xBE5E1E2553863992); in PHP_SHA512_256Init()
639 context->state[6] = L64(0x2B0199FC2C85B8AA); in PHP_SHA512_256Init()
640 context->state[7] = L64(0x0EB72DDC81C52CA2); in PHP_SHA512_256Init()
647 PHP_HASH_API void PHP_SHA512_224Init(PHP_SHA512_CTX * context) in PHP_SHA512_224Init() argument
649 context->count[0] = context->count[1] = 0; in PHP_SHA512_224Init()
651 context->state[0] = L64(0x8C3D37C819544DA2); in PHP_SHA512_224Init()
652 context->state[1] = L64(0x73E1996689DCD4D6); in PHP_SHA512_224Init()
653 context->state[2] = L64(0x1DFAB7AE32FF9C82); in PHP_SHA512_224Init()
654 context->state[3] = L64(0x679DD514582F9FCF); in PHP_SHA512_224Init()
655 context->state[4] = L64(0x0F6D2B697BD44DA8); in PHP_SHA512_224Init()
656 context->state[5] = L64(0x77E36F7304C48942); in PHP_SHA512_224Init()
657 context->state[6] = L64(0x3F9D85A86A1D36C8); in PHP_SHA512_224Init()
658 context->state[7] = L64(0x1112E6AD91D692A1); in PHP_SHA512_224Init()
667 PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX * context, const unsigned char *input, size_t inp… in PHP_SHA512Update() argument
672 index = (unsigned int) ((context->count[0] >> 3) & 0x7F); in PHP_SHA512Update()
675 if ((context->count[0] += ((uint64_t) inputLen << 3)) < ((uint64_t) inputLen << 3)) { in PHP_SHA512Update()
676 context->count[1]++; in PHP_SHA512Update()
678 context->count[1] += ((uint64_t) inputLen >> 61); in PHP_SHA512Update()
685 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA512Update()
686 SHA512Transform(context->state, context->buffer); in PHP_SHA512Update()
689 SHA512Transform(context->state, &input[i]); in PHP_SHA512Update()
698 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA512Update()
706 PHP_HASH_API void PHP_SHA512Final(unsigned char digest[64], PHP_SHA512_CTX * context) in PHP_SHA512Final() argument
712 bits[15] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA512Final()
713 bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA512Final()
714 bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA512Final()
715 bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA512Final()
716 bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF); in PHP_SHA512Final()
717 bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF); in PHP_SHA512Final()
718 bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF); in PHP_SHA512Final()
719 bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF); in PHP_SHA512Final()
720 bits[7] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA512Final()
721 bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA512Final()
722 bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA512Final()
723 bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA512Final()
724 bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF); in PHP_SHA512Final()
725 bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF); in PHP_SHA512Final()
726 bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF); in PHP_SHA512Final()
727 bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF); in PHP_SHA512Final()
731 index = (unsigned int) ((context->count[0] >> 3) & 0x7f); in PHP_SHA512Final()
733 PHP_SHA512Update(context, PADDING, padLen); in PHP_SHA512Final()
736 PHP_SHA512Update(context, bits, 16); in PHP_SHA512Final()
739 SHAEncode64(digest, context->state, 64); in PHP_SHA512Final()
743 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA512Final()
750 PHP_HASH_API void PHP_SHA512_256Final(unsigned char digest[32], PHP_SHA512_CTX * context) in PHP_SHA512_256Final() argument
753 PHP_SHA512Final(full_digest, context); in PHP_SHA512_256Final()
761 PHP_HASH_API void PHP_SHA512_224Final(unsigned char digest[28], PHP_SHA512_CTX * context) in PHP_SHA512_224Final() argument
764 PHP_SHA512Final(full_digest, context); in PHP_SHA512_224Final()