Lines Matching refs:hash
233 PHP_HASH_API int php_hash_serialize_spec(const php_hashcontext_object *hash, zval *zv, const char *… in php_hash_serialize_spec() argument
236 unsigned char *buf = (unsigned char *) hash->context; in php_hash_serialize_spec()
245 if (pos + count * sz > hash->ops->context_size) { in php_hash_serialize_spec()
268 if (*spec == '.' && align_to(pos, max_alignment) != hash->ops->context_size) { in php_hash_serialize_spec()
281 PHP_HASH_API int php_hash_unserialize_spec(php_hashcontext_object *hash, const zval *zv, const char… in php_hash_unserialize_spec() argument
284 unsigned char *buf = (unsigned char *) hash->context; in php_hash_unserialize_spec()
292 if (pos + count * sz > hash->ops->context_size) { in php_hash_unserialize_spec()
328 if (*spec == '.' && align_to(pos, max_alignment) != hash->ops->context_size) { in php_hash_unserialize_spec()
335 PHP_HASH_API int php_hash_serialize(const php_hashcontext_object *hash, zend_long *magic, zval *zv)… in php_hash_serialize() argument
337 if (hash->ops->serialize_spec) { in php_hash_serialize()
339 return php_hash_serialize_spec(hash, zv, hash->ops->serialize_spec); in php_hash_serialize()
346 PHP_HASH_API int php_hash_unserialize(php_hashcontext_object *hash, zend_long magic, const zval *zv… in php_hash_unserialize() argument
348 if (hash->ops->serialize_spec in php_hash_unserialize()
350 return php_hash_unserialize_spec(hash, zv, hash->ops->serialize_spec); in php_hash_unserialize()
423 PHP_FUNCTION(hash) in PHP_FUNCTION() argument
619 php_hashcontext_object *hash; in PHP_FUNCTION() local
645 hash = php_hashcontext_from_object(Z_OBJ_P(return_value)); in PHP_FUNCTION()
650 hash->ops = ops; in PHP_FUNCTION()
651 hash->context = context; in PHP_FUNCTION()
652 hash->options = options; in PHP_FUNCTION()
653 hash->key = NULL; in PHP_FUNCTION()
677 hash->key = (unsigned char *) K; in PHP_FUNCTION()
682 #define PHP_HASHCONTEXT_VERIFY(hash) { \ argument
683 if (!hash->context) { \
693 php_hashcontext_object *hash; in PHP_FUNCTION() local
700 hash = php_hashcontext_from_object(Z_OBJ_P(zhash)); in PHP_FUNCTION()
701 PHP_HASHCONTEXT_VERIFY(hash); in PHP_FUNCTION()
702 hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(data), ZSTR_LEN(data)); in PHP_FUNCTION()
712 php_hashcontext_object *hash; in PHP_FUNCTION() local
720 hash = php_hashcontext_from_object(Z_OBJ_P(zhash)); in PHP_FUNCTION()
721 PHP_HASHCONTEXT_VERIFY(hash); in PHP_FUNCTION()
736 hash->ops->hash_update(hash->context, (unsigned char *) buf, n); in PHP_FUNCTION()
749 php_hashcontext_object *hash; in PHP_FUNCTION() local
760 hash = php_hashcontext_from_object(Z_OBJ_P(zhash)); in PHP_FUNCTION()
761 PHP_HASHCONTEXT_VERIFY(hash); in PHP_FUNCTION()
771 hash->ops->hash_update(hash->context, (unsigned char *) buf, n); in PHP_FUNCTION()
783 php_hashcontext_object *hash; in PHP_FUNCTION() local
792 hash = php_hashcontext_from_object(Z_OBJ_P(zhash)); in PHP_FUNCTION()
793 PHP_HASHCONTEXT_VERIFY(hash); in PHP_FUNCTION()
795 digest_len = hash->ops->digest_size; in PHP_FUNCTION()
797 hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context); in PHP_FUNCTION()
798 if (hash->options & PHP_HASH_HMAC) { in PHP_FUNCTION()
802 block_size = hash->ops->block_size; in PHP_FUNCTION()
804 hash->key[i] ^= 0x6A; in PHP_FUNCTION()
808 hash->ops->hash_init(hash->context, NULL); in PHP_FUNCTION()
809 hash->ops->hash_update(hash->context, hash->key, hash->ops->block_size); in PHP_FUNCTION()
810 hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(digest), hash->ops->digest_size); in PHP_FUNCTION()
811 hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context); in PHP_FUNCTION()
814 ZEND_SECURE_ZERO(hash->key, hash->ops->block_size); in PHP_FUNCTION()
815 efree(hash->key); in PHP_FUNCTION()
816 hash->key = NULL; in PHP_FUNCTION()
821 efree(hash->context); in PHP_FUNCTION()
822 hash->context = NULL; in PHP_FUNCTION()
1380 php_hashcontext_object *hash = php_hashcontext_from_object(obj); in php_hashcontext_dtor() local
1382 if (hash->context) { in php_hashcontext_dtor()
1383 efree(hash->context); in php_hashcontext_dtor()
1384 hash->context = NULL; in php_hashcontext_dtor()
1387 if (hash->key) { in php_hashcontext_dtor()
1388 ZEND_SECURE_ZERO(hash->key, hash->ops->block_size); in php_hashcontext_dtor()
1389 efree(hash->key); in php_hashcontext_dtor()
1390 hash->key = NULL; in php_hashcontext_dtor()
1456 php_hashcontext_object *hash = php_hashcontext_from_object(Z_OBJ_P(object)); in PHP_METHOD() local
1466 if (!hash->ops->hash_serialize) { in PHP_METHOD()
1468 } else if (hash->options & PHP_HASH_HMAC) { in PHP_METHOD()
1473 ZVAL_STRING(&tmp, hash->ops->algo); in PHP_METHOD()
1476 ZVAL_LONG(&tmp, hash->options); in PHP_METHOD()
1479 if (hash->ops->hash_serialize(hash, &magic, &tmp) != SUCCESS) { in PHP_METHOD()
1488 ZVAL_ARR(&tmp, zend_std_get_properties(&hash->std)); in PHP_METHOD()
1495 …zend_throw_exception_ex(NULL, 0, "HashContext for algorithm \"%s\" cannot be serialized", hash->op… in PHP_METHOD()
1504 php_hashcontext_object *hash = php_hashcontext_from_object(Z_OBJ_P(object)); in PHP_METHOD() local
1515 if (hash->context) { in PHP_METHOD()
1551 hash->ops = ops; in PHP_METHOD()
1552 hash->context = php_hash_alloc_context(ops); in PHP_METHOD()
1553 hash->options = options; in PHP_METHOD()
1554 ops->hash_init(hash->context, NULL); in PHP_METHOD()
1556 unserialize_result = ops->hash_unserialize(hash, magic, hash_zv); in PHP_METHOD()
1564 object_properties_load(&hash->std, Z_ARRVAL_P(members_zv)); in PHP_METHOD()
1569 PHP_MINIT_FUNCTION(hash) in PHP_MINIT_FUNCTION() argument
1657 PHP_MSHUTDOWN_FUNCTION(hash) in PHP_MSHUTDOWN_FUNCTION() argument
1666 PHP_MINFO_FUNCTION(hash) in PHP_MINFO_FUNCTION() argument
1697 PHP_MINIT(hash),
1698 PHP_MSHUTDOWN(hash),
1701 PHP_MINFO(hash),