summaryrefslogtreecommitdiff
path: root/ext/hash
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2018-10-03 10:37:20 +0200
committerKalle Sommer Nielsen <kalle@php.net>2018-10-03 10:37:20 +0200
commitf7991ca656bd5a08d37095a7c18159865a885a64 (patch)
tree765f153926717f32fb968b31487c29ed25d266cd /ext/hash
parent596fbf7393777cb14006813111875db5b0a21d3b (diff)
downloadphp-git-f7991ca656bd5a08d37095a7c18159865a885a64.tar.gz
Revert "Fix compiler warnings in ext/hash"
This reverts commit 596fbf7393777cb14006813111875db5b0a21d3b.
Diffstat (limited to 'ext/hash')
-rw-r--r--ext/hash/hash.c30
-rw-r--r--ext/hash/hash_gost.c4
-rw-r--r--ext/hash/hash_md.c2
-rw-r--r--ext/hash/hash_snefru.c4
-rw-r--r--ext/hash/hash_tiger.c4
5 files changed, 22 insertions, 22 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index a6d881b7b4..2f4bf013db 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -151,11 +151,11 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
size_t n;
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- ops->hash_update(context, (unsigned char *) buf, (unsigned int) n);
+ ops->hash_update(context, (unsigned char *) buf, n);
}
php_stream_close(stream);
} else {
- ops->hash_update(context, (unsigned char *) data, (unsigned int) data_len);
+ ops->hash_update(context, (unsigned char *) data, data_len);
}
digest = zend_string_alloc(ops->digest_size, 0);
@@ -213,7 +213,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
if (key_len > (size_t)ops->block_size) {
/* Reduce the key first */
ops->hash_init(context);
- ops->hash_update(context, key, (unsigned int) key_len);
+ ops->hash_update(context, key, key_len);
ops->hash_final(K, context);
} else {
memcpy(K, key, key_len);
@@ -225,7 +225,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const zend_long data_size) {
ops->hash_init(context);
ops->hash_update(context, key, ops->block_size);
- ops->hash_update(context, data, (unsigned int) data_size);
+ ops->hash_update(context, data, data_size);
ops->hash_final(final, context);
}
@@ -276,11 +276,11 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
if (isfilename) {
char buf[1024];
- size_t n;
+ int n;
ops->hash_init(context);
ops->hash_update(context, K, ops->block_size);
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- ops->hash_update(context, (unsigned char *) buf, (unsigned int) n);
+ ops->hash_update(context, (unsigned char *) buf, n);
}
php_stream_close(stream);
ops->hash_final((unsigned char *) ZSTR_VAL(digest), context);
@@ -379,7 +379,7 @@ static void php_hashcontext_ctor(INTERNAL_FUNCTION_PARAMETERS, zval *objval) {
if (ZSTR_LEN(key) > (size_t)ops->block_size) {
/* Reduce the key first */
- ops->hash_update(context, (unsigned char *) ZSTR_VAL(key), (unsigned int) ZSTR_LEN(key));
+ ops->hash_update(context, (unsigned char *) ZSTR_VAL(key), ZSTR_LEN(key));
ops->hash_final((unsigned char *) K, context);
/* Make the context ready to start over */
ops->hash_init(context);
@@ -427,7 +427,7 @@ PHP_FUNCTION(hash_update)
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
PHP_HASHCONTEXT_VERIFY("hash_update", hash);
- hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(data), (unsigned int) ZSTR_LEN(data));
+ hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(data), ZSTR_LEN(data));
RETURN_TRUE;
}
@@ -462,7 +462,7 @@ PHP_FUNCTION(hash_update_stream)
/* Nada mas */
RETURN_LONG(didread);
}
- hash->ops->hash_update(hash->context, (unsigned char *) buf, (unsigned int) n);
+ hash->ops->hash_update(hash->context, (unsigned char *) buf, n);
length -= n;
didread += n;
}
@@ -498,7 +498,7 @@ PHP_FUNCTION(hash_update_file)
}
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- hash->ops->hash_update(hash->context, (unsigned char *) buf, (unsigned int) n);
+ hash->ops->hash_update(hash->context, (unsigned char *) buf, n);
}
php_stream_close(stream);
@@ -671,7 +671,7 @@ PHP_FUNCTION(hash_hkdf)
// Expand
returnval = zend_string_alloc(length, 0);
digest = emalloc(ops->digest_size);
- for (i = 1, rounds = (int)(length - 1) / ops->digest_size + 1; i <= rounds; i++) {
+ for (i = 1, rounds = (length - 1) / ops->digest_size + 1; i <= rounds; i++) {
// chr(i)
unsigned char c[1];
c[0] = (i & 0xFF);
@@ -685,7 +685,7 @@ PHP_FUNCTION(hash_hkdf)
}
if (info != NULL && ZSTR_LEN(info) > 0) {
- ops->hash_update(context, (unsigned char *) ZSTR_VAL(info), (unsigned int) ZSTR_LEN(info));
+ ops->hash_update(context, (unsigned char *) ZSTR_VAL(info), ZSTR_LEN(info));
}
ops->hash_update(context, c, 1);
@@ -831,7 +831,7 @@ PHP_FUNCTION(hash_pbkdf2)
if (raw_output) {
memcpy(ZSTR_VAL(returnval), result, length);
} else {
- php_hash_bin2hex(ZSTR_VAL(returnval), result, (unsigned int) digest_length);
+ php_hash_bin2hex(ZSTR_VAL(returnval), result, digest_length);
}
ZSTR_VAL(returnval)[length] = 0;
efree(result);
@@ -1083,8 +1083,8 @@ PHP_FUNCTION(mhash_keygen_s2k)
for (j=0;j<i;j++) {
ops->hash_update(context, &null, 1);
}
- ops->hash_update(context, (unsigned char *)padded_salt, (unsigned int) salt_len);
- ops->hash_update(context, (unsigned char *)password, (unsigned int) password_len);
+ ops->hash_update(context, (unsigned char *)padded_salt, salt_len);
+ ops->hash_update(context, (unsigned char *)password, password_len);
ops->hash_final((unsigned char *)digest, context);
memcpy( &key[i*block_size], digest, block_size);
}
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index 352f7364bb..e18de57d9d 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -256,9 +256,9 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp
if ((MAX32 - context->count[0]) < (len * 8)) {
context->count[1]++;
context->count[0] = MAX32 - context->count[0];
- context->count[0] = (uint32_t)(len * 8) - context->count[0];
+ context->count[0] = (len * 8) - context->count[0];
} else {
- context->count[0] += (uint32_t) (len * 8);
+ context->count[0] += len * 8;
}
if (context->length + len < 32) {
diff --git a/ext/hash/hash_md.c b/ext/hash/hash_md.c
index be66f6a9cd..3cbd00a215 100644
--- a/ext/hash/hash_md.c
+++ b/ext/hash/hash_md.c
@@ -679,7 +679,7 @@ PHP_HASH_API void PHP_MD2Update(PHP_MD2_CTX *context, const unsigned char *buf,
/* Copy remaining data to buffer */
if (p < e) {
memcpy(context->buffer, p, e - p);
- context->in_buffer = (char)(e - p);
+ context->in_buffer = e - p;
}
}
diff --git a/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c
index e8628ad7fa..bab15c505a 100644
--- a/ext/hash/hash_snefru.c
+++ b/ext/hash/hash_snefru.c
@@ -142,9 +142,9 @@ PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char
if ((MAX32 - context->count[1]) < (len * 8)) {
context->count[0]++;
context->count[1] = MAX32 - context->count[1];
- context->count[1] = (uint32_t) (len * 8) - context->count[1];
+ context->count[1] = (len * 8) - context->count[1];
} else {
- context->count[1] += (uint32_t) (len * 8);
+ context->count[1] += len * 8;
}
if (context->length + len < 32) {
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index 0a2acbcd6d..720045f821 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -197,7 +197,7 @@ PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *i
{
if (context->length + len < 64) {
memcpy(&context->buffer[context->length], input, len);
- context->length += (unsigned int) len;
+ context->length += len;
} else {
size_t i = 0, r = (context->length + len) % 64;
@@ -216,7 +216,7 @@ PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *i
}
ZEND_SECURE_ZERO(&context->buffer[r], 64-r);
memcpy(context->buffer, &input[i], r);
- context->length = (unsigned int) r;
+ context->length = r;
}
}