Lines Matching refs:context
139 static inline void TigerFinalize(PHP_TIGER_CTX *context) in TigerFinalize() argument
141 context->passed += (uint64_t) context->length << 3; in TigerFinalize()
143 context->buffer[context->length++] = 0x1; in TigerFinalize()
144 if (context->length % 8) { in TigerFinalize()
145 memset(&context->buffer[context->length], 0, 8-context->length%8); in TigerFinalize()
146 context->length += 8-context->length%8; in TigerFinalize()
149 if (context->length > 56) { in TigerFinalize()
150 memset(&context->buffer[context->length], 0, 64 - context->length); in TigerFinalize()
151 tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state); in TigerFinalize()
152 memset(context->buffer, 0, 56); in TigerFinalize()
154 memset(&context->buffer[context->length], 0, 56 - context->length); in TigerFinalize()
158 memcpy(&context->buffer[56], &context->passed, sizeof(uint64_t)); in TigerFinalize()
160 context->buffer[56] = (unsigned char) (context->passed & 0xff); in TigerFinalize()
161 context->buffer[57] = (unsigned char) ((context->passed >> 8) & 0xff); in TigerFinalize()
162 context->buffer[58] = (unsigned char) ((context->passed >> 16) & 0xff); in TigerFinalize()
163 context->buffer[59] = (unsigned char) ((context->passed >> 24) & 0xff); in TigerFinalize()
164 context->buffer[60] = (unsigned char) ((context->passed >> 32) & 0xff); in TigerFinalize()
165 context->buffer[61] = (unsigned char) ((context->passed >> 40) & 0xff); in TigerFinalize()
166 context->buffer[62] = (unsigned char) ((context->passed >> 48) & 0xff); in TigerFinalize()
167 context->buffer[63] = (unsigned char) ((context->passed >> 56) & 0xff); in TigerFinalize()
169 tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state); in TigerFinalize()
172 …inline void TigerDigest(unsigned char *digest_str, unsigned int digest_len, PHP_TIGER_CTX *context) in TigerDigest() argument
177 digest_str[i] = (unsigned char) ((context->state[i/8] >> (8 * (i%8))) & 0xff); in TigerDigest()
181 PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context) in PHP_3TIGERInit() argument
183 memset(context, 0, sizeof(*context)); in PHP_3TIGERInit()
184 context->state[0] = L64(0x0123456789ABCDEF); in PHP_3TIGERInit()
185 context->state[1] = L64(0xFEDCBA9876543210); in PHP_3TIGERInit()
186 context->state[2] = L64(0xF096A5B4C3B2E187); in PHP_3TIGERInit()
189 PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context) in PHP_4TIGERInit() argument
191 memset(context, 0, sizeof(*context)); in PHP_4TIGERInit()
192 context->passes = 1; in PHP_4TIGERInit()
193 context->state[0] = L64(0x0123456789ABCDEF); in PHP_4TIGERInit()
194 context->state[1] = L64(0xFEDCBA9876543210); in PHP_4TIGERInit()
195 context->state[2] = L64(0xF096A5B4C3B2E187); in PHP_4TIGERInit()
198 PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len) in PHP_TIGERUpdate() argument
200 if (context->length + len < 64) { in PHP_TIGERUpdate()
201 memcpy(&context->buffer[context->length], input, len); in PHP_TIGERUpdate()
202 context->length += len; in PHP_TIGERUpdate()
204 size_t i = 0, r = (context->length + len) % 64; in PHP_TIGERUpdate()
206 if (context->length) { in PHP_TIGERUpdate()
207 i = 64 - context->length; in PHP_TIGERUpdate()
208 memcpy(&context->buffer[context->length], input, i); in PHP_TIGERUpdate()
209 tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state); in PHP_TIGERUpdate()
210 ZEND_SECURE_ZERO(context->buffer, 64); in PHP_TIGERUpdate()
211 context->passed += 512; in PHP_TIGERUpdate()
215 memcpy(context->buffer, &input[i], 64); in PHP_TIGERUpdate()
216 tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state); in PHP_TIGERUpdate()
217 context->passed += 512; in PHP_TIGERUpdate()
219 ZEND_SECURE_ZERO(&context->buffer[r], 64-r); in PHP_TIGERUpdate()
220 memcpy(context->buffer, &input[i], r); in PHP_TIGERUpdate()
221 context->length = r; in PHP_TIGERUpdate()
225 PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context) in PHP_TIGER128Final() argument
227 TigerFinalize(context); in PHP_TIGER128Final()
228 TigerDigest(digest, 16, context); in PHP_TIGER128Final()
229 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER128Final()
232 PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context) in PHP_TIGER160Final() argument
234 TigerFinalize(context); in PHP_TIGER160Final()
235 TigerDigest(digest, 20, context); in PHP_TIGER160Final()
236 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER160Final()
239 PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context) in PHP_TIGER192Final() argument
241 TigerFinalize(context); in PHP_TIGER192Final()
242 TigerDigest(digest, 24, context); in PHP_TIGER192Final()
243 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER192Final()