summaryrefslogtreecommitdiff
path: root/ext/hash
diff options
context:
space:
mode:
Diffstat (limited to 'ext/hash')
-rw-r--r--ext/hash/hash.c14
-rw-r--r--ext/hash/hash_gost.c4
-rw-r--r--ext/hash/hash_snefru.c4
-rw-r--r--ext/hash/package.xml94
4 files changed, 11 insertions, 105 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 5932ad9c6a..5a4204a81c 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -98,7 +98,7 @@ PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *o
{
size_t algo_len = strlen(algo);
char *lower = zend_str_tolower_dup(algo, algo_len);
- zend_hash_str_add_ptr(&php_hash_hashtable, lower, algo_len, (void *) ops);
+ zend_hash_add_ptr(&php_hash_hashtable, zend_string_init_interned(lower, algo_len, 1), (void *) ops);
efree(lower);
}
/* }}} */
@@ -357,7 +357,7 @@ static void php_hashcontext_ctor(INTERNAL_FUNCTION_PARAMETERS, zval *objval) {
zval_dtor(return_value);
RETURN_FALSE;
}
- if (!key || (ZSTR_LEN(key) <= 0)) {
+ if (!key || (ZSTR_LEN(key) == 0)) {
/* Note: a zero length key is no key at all */
php_error_docref(NULL, E_WARNING, "HMAC requested without a key");
zval_dtor(return_value);
@@ -887,7 +887,7 @@ static PHP_METHOD(HashContext, __construct) {
}
/* }}} */
-static zend_function_entry php_hashcontext_methods[] = {
+static const zend_function_entry php_hashcontext_methods[] = {
PHP_ME(HashContext, __construct, NULL, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR)
PHP_FE_END
};
@@ -1106,11 +1106,11 @@ PHP_FUNCTION(mhash_keygen_s2k)
/* {{{ php_hashcontext_create */
static zend_object* php_hashcontext_create(zend_class_entry *ce) {
- php_hashcontext_object *objval = ecalloc(1,
- sizeof(php_hashcontext_object) + zend_object_properties_size(ce));
- zend_object *zobj = &(objval->std);
+ php_hashcontext_object *objval = zend_object_alloc(sizeof(php_hashcontext_object), ce);
+ zend_object *zobj = &objval->std;
zend_object_std_init(zobj, ce);
+ object_properties_init(zobj, ce);
zobj->handlers = &php_hashcontext_handlers;
return zobj;
@@ -1430,7 +1430,7 @@ ZEND_END_ARG_INFO()
/* {{{ hash_functions[]
*/
-const zend_function_entry hash_functions[] = {
+static const zend_function_entry hash_functions[] = {
PHP_FE(hash, arginfo_hash)
PHP_FE(hash_file, arginfo_hash_file)
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index e00a55ed96..2561e6187c 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -265,7 +265,7 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp
if (context->length + len < 32) {
memcpy(&context->buffer[context->length], input, len);
- context->length += len;
+ context->length += (unsigned char)len;
} else {
size_t i = 0, r = (context->length + len) % 32;
@@ -281,7 +281,7 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp
memcpy(context->buffer, input + i, r);
ZEND_SECURE_ZERO(&context->buffer[r], 32 - r);
- context->length = r;
+ context->length = (unsigned char)r;
}
}
diff --git a/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c
index 5de2a283ff..1b44d37aea 100644
--- a/ext/hash/hash_snefru.c
+++ b/ext/hash/hash_snefru.c
@@ -151,7 +151,7 @@ PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char
if (context->length + len < 32) {
memcpy(&context->buffer[context->length], input, len);
- context->length += len;
+ context->length += (unsigned char)len;
} else {
size_t i = 0, r = (context->length + len) % 32;
@@ -167,7 +167,7 @@ PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char
memcpy(context->buffer, input + i, r);
ZEND_SECURE_ZERO(&context->buffer[r], 32 - r);
- context->length = r;
+ context->length = (unsigned char)r;
}
}
diff --git a/ext/hash/package.xml b/ext/hash/package.xml
deleted file mode 100644
index 25a598a4a1..0000000000
--- a/ext/hash/package.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<package version="1.0">
- <name>hash</name>
- <summary>pHASH Message Digest Framework</summary>
- <description>
- Native implementations of common message digest algorithms using a generic factory method
- </description>
- <license>PHP</license>
- <maintainers>
- <maintainer>
- <user>pollita</user>
- <name>Sara Golemon</name>
- <email>pollita@php.net</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>mike</user>
- <name>Michael Wallner</name>
- <email>mike@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
-
- <release>
- <version>1.1</version>
- <state>stable</state>
- <date>2005-12-00</date>
- <notes>
-Fixed PECL bug #6183 - haval source file entries missing in package.xml
-
-Supported Algorithms:
- * md4, md5
- * sha1, sha256, sha384, sha512
- * ripemd128, ripemd160
- * tiger128, tiger160, tiger192 (3 and 4 passes)
- * haval128, haval160, haval192, haval224, haval256 (3, 4 and 5 passes)
- * crc32, crc32b, adler32, gost, snefru, whirlpool
- </notes>
- </release>
-
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="config.w32"/>
- <file role="src" name="hash.c"/>
- <file role="src" name="php_hash.h"/>
- <file role="src" name="hash_md.c"/>
- <file role="src" name="php_hash_md.h"/>
- <file role="src" name="hash_sha.c"/>
- <file role="src" name="php_hash_sha.h"/>
- <file role="src" name="hash_ripemd.c"/>
- <file role="src" name="php_hash_ripemd.h"/>
- <file role="src" name="hash_whirlpool.c"/>
- <file role="src" name="php_hash_whirlpool.h"/>
- <file role="src" name="php_hash_whirlpool_tables.h"/>
- <file role="src" name="hash_tiger.c"/>
- <file role="src" name="php_hash_tiger.h"/>
- <file role="src" name="php_hash_tiger_tables.h"/>
- <file role="src" name="hash_snefru.c"/>
- <file role="src" name="php_hash_snefru.h"/>
- <file role="src" name="php_hash_snefru_tables.h"/>
- <file role="src" name="hash_gost.c"/>
- <file role="src" name="php_hash_gost.h"/>
- <file role="src" name="php_hash_gost_tables.h"/>
- <file role="src" name="hash_adler32.c"/>
- <file role="src" name="php_hash_adler32.h"/>
- <file role="src" name="hash_crc32.c"/>
- <file role="src" name="php_hash_crc32.h"/>
- <file role="src" name="php_hash_crc32_tables.h"/>
- <file role="src" name="hash_haval.c"/>
- <file role="src" name="php_hash_haval.h"/>
- <file role="doc" name="README"/>
- <dir role="test" name="tests">
- <file role="test" name="hmac-md5.phpt"/>
- <file role="test" name="md4.phpt"/>
- <file role="test" name="md5.phpt"/>
- <file role="test" name="sha1.phpt"/>
- <file role="test" name="sha256.phpt"/>
- <file role="test" name="sha384.phpt"/>
- <file role="test" name="sha512.phpt"/>
- <file role="test" name="ripemd128.phpt"/>
- <file role="test" name="ripemd160.phpt"/>
- <file role="test" name="haval.phpt"/>
- <file role="test" name="tiger.phpt"/>
- <file role="test" name="whirlpool.phpt"/>
- <file role="test" name="gost.phpt"/>
- <file role="test" name="snefru.phpt"/>
- <file role="test" name="crc32.phpt"/>
- <file role="test" name="adler32.phpt"/>
- </dir>
- </filelist>
-
-</package>
-<!--
-vim: et ts=1 sw=1
--->