Lines Matching refs:context

93 	PHP_SHA1_CTX context;  in PHP_FUNCTION()  local
100 PHP_SHA1Init(&context); in PHP_FUNCTION()
101 PHP_SHA1Update(&context, arg, arg_len); in PHP_FUNCTION()
102 PHP_SHA1Final(digest, &context); in PHP_FUNCTION()
123 PHP_SHA1_CTX context; in PHP_FUNCTION() local
136 PHP_SHA1Init(&context); in PHP_FUNCTION()
139 PHP_SHA1Update(&context, buf, n); in PHP_FUNCTION()
142 PHP_SHA1Final(digest, &context); in PHP_FUNCTION()
202 PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX * context) in PHP_SHA1Init() argument
204 context->count[0] = context->count[1] = 0; in PHP_SHA1Init()
207 context->state[0] = 0x67452301; in PHP_SHA1Init()
208 context->state[1] = 0xefcdab89; in PHP_SHA1Init()
209 context->state[2] = 0x98badcfe; in PHP_SHA1Init()
210 context->state[3] = 0x10325476; in PHP_SHA1Init()
211 context->state[4] = 0xc3d2e1f0; in PHP_SHA1Init()
329 PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, in PHP_SHA1Update() argument
335 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA1Update()
338 if ((context->count[0] += ((uint32_t) inputLen << 3)) in PHP_SHA1Update()
340 context->count[1]++; in PHP_SHA1Update()
341 context->count[1] += ((uint32_t) inputLen >> 29); in PHP_SHA1Update()
349 ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA1Update()
350 SHA1Transform(context->state, context->buffer); in PHP_SHA1Update()
353 SHA1Transform(context->state, &input[i]); in PHP_SHA1Update()
361 ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], in PHP_SHA1Update()
370 PHP_HASH_API void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context) in PHP_SHA1Final() argument
376 bits[7] = context->count[0] & 0xFF; in PHP_SHA1Final()
377 bits[6] = (context->count[0] >> 8) & 0xFF; in PHP_SHA1Final()
378 bits[5] = (context->count[0] >> 16) & 0xFF; in PHP_SHA1Final()
379 bits[4] = (context->count[0] >> 24) & 0xFF; in PHP_SHA1Final()
380 bits[3] = context->count[1] & 0xFF; in PHP_SHA1Final()
381 bits[2] = (context->count[1] >> 8) & 0xFF; in PHP_SHA1Final()
382 bits[1] = (context->count[1] >> 16) & 0xFF; in PHP_SHA1Final()
383 bits[0] = (context->count[1] >> 24) & 0xFF; in PHP_SHA1Final()
387 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA1Final()
389 PHP_SHA1Update(context, PADDING, padLen); in PHP_SHA1Final()
392 PHP_SHA1Update(context, bits, 8); in PHP_SHA1Final()
395 SHAEncode32(digest, context->state, 20); in PHP_SHA1Final()
399 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA1Final()
459 PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX * context) in PHP_SHA256Init() argument
461 context->count[0] = context->count[1] = 0; in PHP_SHA256Init()
464 context->state[0] = 0x6a09e667; in PHP_SHA256Init()
465 context->state[1] = 0xbb67ae85; in PHP_SHA256Init()
466 context->state[2] = 0x3c6ef372; in PHP_SHA256Init()
467 context->state[3] = 0xa54ff53a; in PHP_SHA256Init()
468 context->state[4] = 0x510e527f; in PHP_SHA256Init()
469 context->state[5] = 0x9b05688c; in PHP_SHA256Init()
470 context->state[6] = 0x1f83d9ab; in PHP_SHA256Init()
471 context->state[7] = 0x5be0cd19; in PHP_SHA256Init()
519 PHP_HASH_API void PHP_SHA224Init(PHP_SHA224_CTX * context) in PHP_SHA224Init() argument
521 context->count[0] = context->count[1] = 0; in PHP_SHA224Init()
524 context->state[0] = 0xc1059ed8; in PHP_SHA224Init()
525 context->state[1] = 0x367cd507; in PHP_SHA224Init()
526 context->state[2] = 0x3070dd17; in PHP_SHA224Init()
527 context->state[3] = 0xf70e5939; in PHP_SHA224Init()
528 context->state[4] = 0xffc00b31; in PHP_SHA224Init()
529 context->state[5] = 0x68581511; in PHP_SHA224Init()
530 context->state[6] = 0x64f98fa7; in PHP_SHA224Init()
531 context->state[7] = 0xbefa4fa4; in PHP_SHA224Init()
540 PHP_HASH_API void PHP_SHA224Update(PHP_SHA224_CTX * context, const unsigned char *input, unsigned i… in PHP_SHA224Update() argument
545 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA224Update()
548 if ((context->count[0] += ((uint32_t) inputLen << 3)) < ((uint32_t) inputLen << 3)) { in PHP_SHA224Update()
549 context->count[1]++; in PHP_SHA224Update()
551 context->count[1] += ((uint32_t) inputLen >> 29); in PHP_SHA224Update()
558 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA224Update()
559 SHA256Transform(context->state, context->buffer); in PHP_SHA224Update()
562 SHA256Transform(context->state, &input[i]); in PHP_SHA224Update()
571 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA224Update()
579 PHP_HASH_API void PHP_SHA224Final(unsigned char digest[28], PHP_SHA224_CTX * context) in PHP_SHA224Final() argument
585 bits[7] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA224Final()
586 bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA224Final()
587 bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA224Final()
588 bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA224Final()
589 bits[3] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA224Final()
590 bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA224Final()
591 bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA224Final()
592 bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA224Final()
596 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA224Final()
598 PHP_SHA224Update(context, PADDING, padLen); in PHP_SHA224Final()
601 PHP_SHA224Update(context, bits, 8); in PHP_SHA224Final()
604 SHAEncode32(digest, context->state, 28); in PHP_SHA224Final()
608 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA224Final()
617 PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX * context, const unsigned char *input, unsigned i… in PHP_SHA256Update() argument
622 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA256Update()
625 if ((context->count[0] += ((uint32_t) inputLen << 3)) < ((uint32_t) inputLen << 3)) { in PHP_SHA256Update()
626 context->count[1]++; in PHP_SHA256Update()
628 context->count[1] += ((uint32_t) inputLen >> 29); in PHP_SHA256Update()
635 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA256Update()
636 SHA256Transform(context->state, context->buffer); in PHP_SHA256Update()
639 SHA256Transform(context->state, &input[i]); in PHP_SHA256Update()
648 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA256Update()
656 PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX * context) in PHP_SHA256Final() argument
662 bits[7] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA256Final()
663 bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA256Final()
664 bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA256Final()
665 bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA256Final()
666 bits[3] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA256Final()
667 bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA256Final()
668 bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA256Final()
669 bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA256Final()
673 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA256Final()
675 PHP_SHA256Update(context, PADDING, padLen); in PHP_SHA256Final()
678 PHP_SHA256Update(context, bits, 8); in PHP_SHA256Final()
681 SHAEncode32(digest, context->state, 32); in PHP_SHA256Final()
685 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA256Final()
768 PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX * context) in PHP_SHA384Init() argument
770 context->count[0] = context->count[1] = 0; in PHP_SHA384Init()
773 context->state[0] = L64(0xcbbb9d5dc1059ed8); in PHP_SHA384Init()
774 context->state[1] = L64(0x629a292a367cd507); in PHP_SHA384Init()
775 context->state[2] = L64(0x9159015a3070dd17); in PHP_SHA384Init()
776 context->state[3] = L64(0x152fecd8f70e5939); in PHP_SHA384Init()
777 context->state[4] = L64(0x67332667ffc00b31); in PHP_SHA384Init()
778 context->state[5] = L64(0x8eb44a8768581511); in PHP_SHA384Init()
779 context->state[6] = L64(0xdb0c2e0d64f98fa7); in PHP_SHA384Init()
780 context->state[7] = L64(0x47b5481dbefa4fa4); in PHP_SHA384Init()
831 PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX * context, const unsigned char *input, unsigned i… in PHP_SHA384Update() argument
836 index = (unsigned int) ((context->count[0] >> 3) & 0x7F); in PHP_SHA384Update()
839 if ((context->count[0] += ((uint64_t) inputLen << 3)) < ((uint64_t) inputLen << 3)) { in PHP_SHA384Update()
840 context->count[1]++; in PHP_SHA384Update()
842 context->count[1] += ((uint64_t) inputLen >> 61); in PHP_SHA384Update()
849 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA384Update()
850 SHA512Transform(context->state, context->buffer); in PHP_SHA384Update()
853 SHA512Transform(context->state, &input[i]); in PHP_SHA384Update()
862 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA384Update()
870 PHP_HASH_API void PHP_SHA384Final(unsigned char digest[48], PHP_SHA384_CTX * context) in PHP_SHA384Final() argument
876 bits[15] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA384Final()
877 bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA384Final()
878 bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA384Final()
879 bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA384Final()
880 bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF); in PHP_SHA384Final()
881 bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF); in PHP_SHA384Final()
882 bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF); in PHP_SHA384Final()
883 bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF); in PHP_SHA384Final()
884 bits[7] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA384Final()
885 bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA384Final()
886 bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA384Final()
887 bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA384Final()
888 bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF); in PHP_SHA384Final()
889 bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF); in PHP_SHA384Final()
890 bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF); in PHP_SHA384Final()
891 bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF); in PHP_SHA384Final()
895 index = (unsigned int) ((context->count[0] >> 3) & 0x7f); in PHP_SHA384Final()
897 PHP_SHA384Update(context, PADDING, padLen); in PHP_SHA384Final()
900 PHP_SHA384Update(context, bits, 16); in PHP_SHA384Final()
903 SHAEncode64(digest, context->state, 48); in PHP_SHA384Final()
907 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA384Final()
925 PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX * context) in PHP_SHA512Init() argument
927 context->count[0] = context->count[1] = 0; in PHP_SHA512Init()
930 context->state[0] = L64(0x6a09e667f3bcc908); in PHP_SHA512Init()
931 context->state[1] = L64(0xbb67ae8584caa73b); in PHP_SHA512Init()
932 context->state[2] = L64(0x3c6ef372fe94f82b); in PHP_SHA512Init()
933 context->state[3] = L64(0xa54ff53a5f1d36f1); in PHP_SHA512Init()
934 context->state[4] = L64(0x510e527fade682d1); in PHP_SHA512Init()
935 context->state[5] = L64(0x9b05688c2b3e6c1f); in PHP_SHA512Init()
936 context->state[6] = L64(0x1f83d9abfb41bd6b); in PHP_SHA512Init()
937 context->state[7] = L64(0x5be0cd19137e2179); in PHP_SHA512Init()
944 PHP_HASH_API void PHP_SHA512_256Init(PHP_SHA512_CTX * context) in PHP_SHA512_256Init() argument
946 context->count[0] = context->count[1] = 0; in PHP_SHA512_256Init()
948 context->state[0] = L64(0x22312194FC2BF72C); in PHP_SHA512_256Init()
949 context->state[1] = L64(0x9F555FA3C84C64C2); in PHP_SHA512_256Init()
950 context->state[2] = L64(0x2393B86B6F53B151); in PHP_SHA512_256Init()
951 context->state[3] = L64(0x963877195940EABD); in PHP_SHA512_256Init()
952 context->state[4] = L64(0x96283EE2A88EFFE3); in PHP_SHA512_256Init()
953 context->state[5] = L64(0xBE5E1E2553863992); in PHP_SHA512_256Init()
954 context->state[6] = L64(0x2B0199FC2C85B8AA); in PHP_SHA512_256Init()
955 context->state[7] = L64(0x0EB72DDC81C52CA2); in PHP_SHA512_256Init()
962 PHP_HASH_API void PHP_SHA512_224Init(PHP_SHA512_CTX * context) in PHP_SHA512_224Init() argument
964 context->count[0] = context->count[1] = 0; in PHP_SHA512_224Init()
966 context->state[0] = L64(0x8C3D37C819544DA2); in PHP_SHA512_224Init()
967 context->state[1] = L64(0x73E1996689DCD4D6); in PHP_SHA512_224Init()
968 context->state[2] = L64(0x1DFAB7AE32FF9C82); in PHP_SHA512_224Init()
969 context->state[3] = L64(0x679DD514582F9FCF); in PHP_SHA512_224Init()
970 context->state[4] = L64(0x0F6D2B697BD44DA8); in PHP_SHA512_224Init()
971 context->state[5] = L64(0x77E36F7304C48942); in PHP_SHA512_224Init()
972 context->state[6] = L64(0x3F9D85A86A1D36C8); in PHP_SHA512_224Init()
973 context->state[7] = L64(0x1112E6AD91D692A1); in PHP_SHA512_224Init()
982 PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX * context, const unsigned char *input, unsigned i… in PHP_SHA512Update() argument
987 index = (unsigned int) ((context->count[0] >> 3) & 0x7F); in PHP_SHA512Update()
990 if ((context->count[0] += ((uint64_t) inputLen << 3)) < ((uint64_t) inputLen << 3)) { in PHP_SHA512Update()
991 context->count[1]++; in PHP_SHA512Update()
993 context->count[1] += ((uint64_t) inputLen >> 61); in PHP_SHA512Update()
1000 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA512Update()
1001 SHA512Transform(context->state, context->buffer); in PHP_SHA512Update()
1004 SHA512Transform(context->state, &input[i]); in PHP_SHA512Update()
1013 memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i); in PHP_SHA512Update()
1021 PHP_HASH_API void PHP_SHA512Final(unsigned char digest[64], PHP_SHA512_CTX * context) in PHP_SHA512Final() argument
1027 bits[15] = (unsigned char) (context->count[0] & 0xFF); in PHP_SHA512Final()
1028 bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF); in PHP_SHA512Final()
1029 bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF); in PHP_SHA512Final()
1030 bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF); in PHP_SHA512Final()
1031 bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF); in PHP_SHA512Final()
1032 bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF); in PHP_SHA512Final()
1033 bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF); in PHP_SHA512Final()
1034 bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF); in PHP_SHA512Final()
1035 bits[7] = (unsigned char) (context->count[1] & 0xFF); in PHP_SHA512Final()
1036 bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF); in PHP_SHA512Final()
1037 bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF); in PHP_SHA512Final()
1038 bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF); in PHP_SHA512Final()
1039 bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF); in PHP_SHA512Final()
1040 bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF); in PHP_SHA512Final()
1041 bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF); in PHP_SHA512Final()
1042 bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF); in PHP_SHA512Final()
1046 index = (unsigned int) ((context->count[0] >> 3) & 0x7f); in PHP_SHA512Final()
1048 PHP_SHA512Update(context, PADDING, padLen); in PHP_SHA512Final()
1051 PHP_SHA512Update(context, bits, 16); in PHP_SHA512Final()
1054 SHAEncode64(digest, context->state, 64); in PHP_SHA512Final()
1058 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA512Final()
1065 PHP_HASH_API void PHP_SHA512_256Final(unsigned char digest[32], PHP_SHA512_CTX * context) in PHP_SHA512_256Final() argument
1068 PHP_SHA512Final(full_digest, context); in PHP_SHA512_256Final()
1076 PHP_HASH_API void PHP_SHA512_224Final(unsigned char digest[28], PHP_SHA512_CTX * context) in PHP_SHA512_224Final() argument
1079 PHP_SHA512Final(full_digest, context); in PHP_SHA512_224Final()