Lines Matching refs:context
34 PHP_SHA1_CTX context; in PHP_FUNCTION() local
43 PHP_SHA1Init(&context); in PHP_FUNCTION()
44 PHP_SHA1Update(&context, (unsigned char *) ZSTR_VAL(arg), ZSTR_LEN(arg)); in PHP_FUNCTION()
45 PHP_SHA1Final(digest, &context); in PHP_FUNCTION()
66 PHP_SHA1_CTX context; in PHP_FUNCTION() local
81 PHP_SHA1Init(&context); in PHP_FUNCTION()
84 PHP_SHA1Update(&context, buf, n); in PHP_FUNCTION()
87 PHP_SHA1Final(digest, &context); in PHP_FUNCTION()
155 PHPAPI void PHP_SHA1InitArgs(PHP_SHA1_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args) in PHP_SHA1InitArgs() argument
157 context->count[0] = context->count[1] = 0; in PHP_SHA1InitArgs()
160 context->state[0] = 0x67452301; in PHP_SHA1InitArgs()
161 context->state[1] = 0xefcdab89; in PHP_SHA1InitArgs()
162 context->state[2] = 0x98badcfe; in PHP_SHA1InitArgs()
163 context->state[3] = 0x10325476; in PHP_SHA1InitArgs()
164 context->state[4] = 0xc3d2e1f0; in PHP_SHA1InitArgs()
173 PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, in PHP_SHA1Update() argument
180 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA1Update()
183 if ((context->count[0] += ((uint32_t) inputLen << 3)) in PHP_SHA1Update()
185 context->count[1]++; in PHP_SHA1Update()
186 context->count[1] += (uint32_t) (inputLen >> 29); in PHP_SHA1Update()
194 ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA1Update()
195 SHA1Transform(context->state, context->buffer); in PHP_SHA1Update()
198 SHA1Transform(context->state, &input[i]); in PHP_SHA1Update()
206 ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], in PHP_SHA1Update()
215 PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context) in PHP_SHA1Final() argument
221 bits[7] = context->count[0] & 0xFF; in PHP_SHA1Final()
222 bits[6] = (context->count[0] >> 8) & 0xFF; in PHP_SHA1Final()
223 bits[5] = (context->count[0] >> 16) & 0xFF; in PHP_SHA1Final()
224 bits[4] = (context->count[0] >> 24) & 0xFF; in PHP_SHA1Final()
225 bits[3] = context->count[1] & 0xFF; in PHP_SHA1Final()
226 bits[2] = (context->count[1] >> 8) & 0xFF; in PHP_SHA1Final()
227 bits[1] = (context->count[1] >> 16) & 0xFF; in PHP_SHA1Final()
228 bits[0] = (context->count[1] >> 24) & 0xFF; in PHP_SHA1Final()
232 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA1Final()
234 PHP_SHA1Update(context, PADDING, padLen); in PHP_SHA1Final()
237 PHP_SHA1Update(context, bits, 8); in PHP_SHA1Final()
240 SHA1Encode(digest, context->state, 20); in PHP_SHA1Final()
244 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA1Final()