summaryrefslogtreecommitdiff
path: root/ext/hash/hash_tiger.c
diff options
context:
space:
mode:
authorRouven Weßling <rouven@contentful.com>2016-01-29 13:47:47 +0100
committerNikita Popov <nikic@php.net>2016-02-04 11:57:41 +0100
commit7e0459e7cef32a143f8c0eb80b8b85e74b19c615 (patch)
treea77a833853f69567af3c080324232eb4c739c445 /ext/hash/hash_tiger.c
parente93c28053d7d31853f59dc5adf0bfaff52819fb2 (diff)
downloadphp-git-7e0459e7cef32a143f8c0eb80b8b85e74b19c615.tar.gz
Replace usage of php_hash_uint32 and php_hash_uint64 with uint32_t and uint64_t.
Remove the unused php_hash_int32 and php_hash_int64.
Diffstat (limited to 'ext/hash/hash_tiger.c')
-rw-r--r--ext/hash/hash_tiger.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index ac93d7513c..61244de773 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -42,13 +42,13 @@
#define round(a,b,c,x,mul) \
c ^= x; \
a -= t1[(unsigned char)(c)] ^ \
- t2[(unsigned char)(((php_hash_uint32)(c))>>(2*8))] ^ \
+ t2[(unsigned char)(((uint32_t)(c))>>(2*8))] ^ \
t3[(unsigned char)((c)>>(4*8))] ^ \
- t4[(unsigned char)(((php_hash_uint32)((c)>>(4*8)))>>(2*8))] ; \
- b += t4[(unsigned char)(((php_hash_uint32)(c))>>(1*8))] ^ \
- t3[(unsigned char)(((php_hash_uint32)(c))>>(3*8))] ^ \
- t2[(unsigned char)(((php_hash_uint32)((c)>>(4*8)))>>(1*8))] ^ \
- t1[(unsigned char)(((php_hash_uint32)((c)>>(4*8)))>>(3*8))]; \
+ t4[(unsigned char)(((uint32_t)((c)>>(4*8)))>>(2*8))] ; \
+ b += t4[(unsigned char)(((uint32_t)(c))>>(1*8))] ^ \
+ t3[(unsigned char)(((uint32_t)(c))>>(3*8))] ^ \
+ t2[(unsigned char)(((uint32_t)((c)>>(4*8)))>>(1*8))] ^ \
+ t1[(unsigned char)(((uint32_t)((c)>>(4*8)))>>(3*8))]; \
b *= mul;
#define pass(a,b,c,mul) \
@@ -105,7 +105,7 @@
# define split(str) \
{ \
int i; \
- php_hash_uint64 tmp[8]; \
+ uint64_t tmp[8]; \
\
for (i = 0; i < 64; ++i) { \
((unsigned char *) tmp)[i^7] = ((unsigned char *) str)[i]; \
@@ -118,8 +118,8 @@
#define tiger_compress(passes, str, state) \
{ \
- register php_hash_uint64 a, b, c, tmpa, x0, x1, x2, x3, x4, x5, x6, x7; \
- php_hash_uint64 aa, bb, cc; \
+ register uint64_t a, b, c, tmpa, x0, x1, x2, x3, x4, x5, x6, x7; \
+ uint64_t aa, bb, cc; \
unsigned int pass_no; \
\
a = state[0]; \
@@ -138,7 +138,7 @@
static inline void TigerFinalize(PHP_TIGER_CTX *context)
{
- context->passed += (php_hash_uint64) context->length << 3;
+ context->passed += (uint64_t) context->length << 3;
context->buffer[context->length++] = 0x1;
if (context->length % 8) {
@@ -148,14 +148,14 @@ static inline void TigerFinalize(PHP_TIGER_CTX *context)
if (context->length > 56) {
memset(&context->buffer[context->length], 0, 64 - context->length);
- tiger_compress(context->passes, ((php_hash_uint64 *) context->buffer), context->state);
+ tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state);
memset(context->buffer, 0, 56);
} else {
memset(&context->buffer[context->length], 0, 56 - context->length);
}
#ifndef WORDS_BIGENDIAN
- memcpy(&context->buffer[56], &context->passed, sizeof(php_hash_uint64));
+ memcpy(&context->buffer[56], &context->passed, sizeof(uint64_t));
#else
context->buffer[56] = (unsigned char) (context->passed & 0xff);
context->buffer[57] = (unsigned char) ((context->passed >> 8) & 0xff);
@@ -166,7 +166,7 @@ static inline void TigerFinalize(PHP_TIGER_CTX *context)
context->buffer[62] = (unsigned char) ((context->passed >> 48) & 0xff);
context->buffer[63] = (unsigned char) ((context->passed >> 56) & 0xff);
#endif
- tiger_compress(context->passes, ((php_hash_uint64 *) context->buffer), context->state);
+ tiger_compress(context->passes, ((uint64_t *) context->buffer), context->state);
}
static inline void TigerDigest(unsigned char *digest_str, unsigned int digest_len, PHP_TIGER_CTX *context)
@@ -206,14 +206,14 @@ PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *i
if (context->length) {
i = 64 - context->length;
memcpy(&context->buffer[context->length], input, i);
- tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
+ tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state);
ZEND_SECURE_ZERO(context->buffer, 64);
context->passed += 512;
}
for (; i + 64 <= len; i += 64) {
memcpy(context->buffer, &input[i], 64);
- tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
+ tiger_compress(context->passes, ((const uint64_t *) context->buffer), context->state);
context->passed += 512;
}
ZEND_SECURE_ZERO(&context->buffer[r], 64-r);