Lines Matching refs:context
137 static inline void TigerFinalize(PHP_TIGER_CTX *context) in TigerFinalize() argument
139 context->passed += (uint64_t) context->length << 3; in TigerFinalize()
141 context->buffer[context->length++] = 0x1; in TigerFinalize()
142 if (context->length % 8) { in TigerFinalize()
143 memset(&context->buffer[context->length], 0, 8-context->length%8); in TigerFinalize()
144 context->length += 8-context->length%8; in TigerFinalize()
147 if (context->length > 56) { in TigerFinalize()
148 memset(&context->buffer[context->length], 0, 64 - context->length); in TigerFinalize()
149 tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state); in TigerFinalize()
150 memset(context->buffer, 0, 56); in TigerFinalize()
152 memset(&context->buffer[context->length], 0, 56 - context->length); in TigerFinalize()
156 memcpy(&context->buffer[56], &context->passed, sizeof(uint64_t)); in TigerFinalize()
158 context->buffer[56] = (unsigned char) (context->passed & 0xff); in TigerFinalize()
159 context->buffer[57] = (unsigned char) ((context->passed >> 8) & 0xff); in TigerFinalize()
160 context->buffer[58] = (unsigned char) ((context->passed >> 16) & 0xff); in TigerFinalize()
161 context->buffer[59] = (unsigned char) ((context->passed >> 24) & 0xff); in TigerFinalize()
162 context->buffer[60] = (unsigned char) ((context->passed >> 32) & 0xff); in TigerFinalize()
163 context->buffer[61] = (unsigned char) ((context->passed >> 40) & 0xff); in TigerFinalize()
164 context->buffer[62] = (unsigned char) ((context->passed >> 48) & 0xff); in TigerFinalize()
165 context->buffer[63] = (unsigned char) ((context->passed >> 56) & 0xff); in TigerFinalize()
167 tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state); in TigerFinalize()
170 …inline void TigerDigest(unsigned char *digest_str, unsigned int digest_len, PHP_TIGER_CTX *context) in TigerDigest() argument
175 digest_str[i] = (unsigned char) ((context->state[i/8] >> (8 * (i%8))) & 0xff); in TigerDigest()
179 PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context) in PHP_3TIGERInit() argument
181 memset(context, 0, sizeof(*context)); in PHP_3TIGERInit()
182 context->state[0] = L64(0x0123456789ABCDEF); in PHP_3TIGERInit()
183 context->state[1] = L64(0xFEDCBA9876543210); in PHP_3TIGERInit()
184 context->state[2] = L64(0xF096A5B4C3B2E187); in PHP_3TIGERInit()
187 PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context) in PHP_4TIGERInit() argument
189 memset(context, 0, sizeof(*context)); in PHP_4TIGERInit()
190 context->passes = 1; in PHP_4TIGERInit()
191 context->state[0] = L64(0x0123456789ABCDEF); in PHP_4TIGERInit()
192 context->state[1] = L64(0xFEDCBA9876543210); in PHP_4TIGERInit()
193 context->state[2] = L64(0xF096A5B4C3B2E187); in PHP_4TIGERInit()
196 PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len) in PHP_TIGERUpdate() argument
198 if (context->length + len < 64) { in PHP_TIGERUpdate()
199 memcpy(&context->buffer[context->length], input, len); in PHP_TIGERUpdate()
200 context->length += len; in PHP_TIGERUpdate()
202 size_t i = 0, r = (context->length + len) % 64; in PHP_TIGERUpdate()
204 if (context->length) { in PHP_TIGERUpdate()
205 i = 64 - context->length; in PHP_TIGERUpdate()
206 memcpy(&context->buffer[context->length], input, i); in PHP_TIGERUpdate()
207 tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state); in PHP_TIGERUpdate()
208 ZEND_SECURE_ZERO(context->buffer, 64); in PHP_TIGERUpdate()
209 context->passed += 512; in PHP_TIGERUpdate()
213 memcpy(context->buffer, &input[i], 64); in PHP_TIGERUpdate()
214 tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state); in PHP_TIGERUpdate()
215 context->passed += 512; in PHP_TIGERUpdate()
217 ZEND_SECURE_ZERO(&context->buffer[r], 64-r); in PHP_TIGERUpdate()
218 memcpy(context->buffer, &input[i], r); in PHP_TIGERUpdate()
219 context->length = r; in PHP_TIGERUpdate()
223 PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context) in PHP_TIGER128Final() argument
225 TigerFinalize(context); in PHP_TIGER128Final()
226 TigerDigest(digest, 16, context); in PHP_TIGER128Final()
227 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER128Final()
230 PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context) in PHP_TIGER160Final() argument
232 TigerFinalize(context); in PHP_TIGER160Final()
233 TigerDigest(digest, 20, context); in PHP_TIGER160Final()
234 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER160Final()
237 PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context) in PHP_TIGER192Final() argument
239 TigerFinalize(context); in PHP_TIGER192Final()
240 TigerDigest(digest, 24, context); in PHP_TIGER192Final()
241 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER192Final()