Lines Matching refs:context
135 static inline void TigerFinalize(PHP_TIGER_CTX *context) in TigerFinalize() argument
137 context->passed += (uint64_t) context->length << 3; in TigerFinalize()
139 context->buffer[context->length++] = 0x1; in TigerFinalize()
140 if (context->length % 8) { in TigerFinalize()
141 memset(&context->buffer[context->length], 0, 8-context->length%8); in TigerFinalize()
142 context->length += 8-context->length%8; in TigerFinalize()
145 if (context->length > 56) { in TigerFinalize()
146 memset(&context->buffer[context->length], 0, 64 - context->length); in TigerFinalize()
147 tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state); in TigerFinalize()
148 memset(context->buffer, 0, 56); in TigerFinalize()
150 memset(&context->buffer[context->length], 0, 56 - context->length); in TigerFinalize()
154 memcpy(&context->buffer[56], &context->passed, sizeof(uint64_t)); in TigerFinalize()
156 context->buffer[56] = (unsigned char) (context->passed & 0xff); in TigerFinalize()
157 context->buffer[57] = (unsigned char) ((context->passed >> 8) & 0xff); in TigerFinalize()
158 context->buffer[58] = (unsigned char) ((context->passed >> 16) & 0xff); in TigerFinalize()
159 context->buffer[59] = (unsigned char) ((context->passed >> 24) & 0xff); in TigerFinalize()
160 context->buffer[60] = (unsigned char) ((context->passed >> 32) & 0xff); in TigerFinalize()
161 context->buffer[61] = (unsigned char) ((context->passed >> 40) & 0xff); in TigerFinalize()
162 context->buffer[62] = (unsigned char) ((context->passed >> 48) & 0xff); in TigerFinalize()
163 context->buffer[63] = (unsigned char) ((context->passed >> 56) & 0xff); in TigerFinalize()
165 tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state); in TigerFinalize()
168 …inline void TigerDigest(unsigned char *digest_str, unsigned int digest_len, PHP_TIGER_CTX *context) in TigerDigest() argument
173 digest_str[i] = (unsigned char) ((context->state[i/8] >> (8 * (i%8))) & 0xff); in TigerDigest()
177 PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args) in PHP_3TIGERInit() argument
179 memset(context, 0, sizeof(*context)); in PHP_3TIGERInit()
180 context->state[0] = L64(0x0123456789ABCDEF); in PHP_3TIGERInit()
181 context->state[1] = L64(0xFEDCBA9876543210); in PHP_3TIGERInit()
182 context->state[2] = L64(0xF096A5B4C3B2E187); in PHP_3TIGERInit()
185 PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args) in PHP_4TIGERInit() argument
187 memset(context, 0, sizeof(*context)); in PHP_4TIGERInit()
188 context->passes = 1; in PHP_4TIGERInit()
189 context->state[0] = L64(0x0123456789ABCDEF); in PHP_4TIGERInit()
190 context->state[1] = L64(0xFEDCBA9876543210); in PHP_4TIGERInit()
191 context->state[2] = L64(0xF096A5B4C3B2E187); in PHP_4TIGERInit()
194 PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len) in PHP_TIGERUpdate() argument
196 if (context->length + len < 64) { in PHP_TIGERUpdate()
197 memcpy(&context->buffer[context->length], input, len); in PHP_TIGERUpdate()
198 context->length += len; in PHP_TIGERUpdate()
200 size_t i = 0, r = (context->length + len) % 64; in PHP_TIGERUpdate()
202 if (context->length) { in PHP_TIGERUpdate()
203 i = 64 - context->length; in PHP_TIGERUpdate()
204 memcpy(&context->buffer[context->length], input, i); in PHP_TIGERUpdate()
205 tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state); in PHP_TIGERUpdate()
206 ZEND_SECURE_ZERO(context->buffer, 64); in PHP_TIGERUpdate()
207 context->passed += 512; in PHP_TIGERUpdate()
211 memcpy(context->buffer, &input[i], 64); in PHP_TIGERUpdate()
212 tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state); in PHP_TIGERUpdate()
213 context->passed += 512; in PHP_TIGERUpdate()
215 ZEND_SECURE_ZERO(&context->buffer[r], 64-r); in PHP_TIGERUpdate()
216 memcpy(context->buffer, &input[i], r); in PHP_TIGERUpdate()
217 context->length = r; in PHP_TIGERUpdate()
221 PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context) in PHP_TIGER128Final() argument
223 TigerFinalize(context); in PHP_TIGER128Final()
224 TigerDigest(digest, 16, context); in PHP_TIGER128Final()
225 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER128Final()
228 PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context) in PHP_TIGER160Final() argument
230 TigerFinalize(context); in PHP_TIGER160Final()
231 TigerDigest(digest, 20, context); in PHP_TIGER160Final()
232 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER160Final()
235 PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context) in PHP_TIGER192Final() argument
237 TigerFinalize(context); in PHP_TIGER192Final()
238 TigerDigest(digest, 24, context); in PHP_TIGER192Final()
239 ZEND_SECURE_ZERO(context, sizeof(*context)); in PHP_TIGER192Final()
244 PHP_TIGER_CTX *ctx = (PHP_TIGER_CTX *) hash->context; in php_tiger_unserialize()