From 7963580d72a358975133f86f01de2d2eab08ba38 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Fri, 13 Jul 2018 10:36:50 +0200 Subject: Massively optimize how rules are handled This commit does a lot of things: - Use hashtables instead of lists to store the rules - Rules that can be applied at launch time won't be tried at runtime - Improve feedback when writing nonsensical rules - Make intensive use of `zend_string` instead of `char*`--- src/sp_unserialize.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/sp_unserialize.c') diff --git a/src/sp_unserialize.c b/src/sp_unserialize.c index 60ef7be..db99389 100644 --- a/src/sp_unserialize.c +++ b/src/sp_unserialize.c @@ -18,8 +18,9 @@ PHP_FUNCTION(sp_serialize) { ZVAL_STRING(&func_name, "hash_hmac"); ZVAL_STRING(¶ms[0], "sha256"); params[1] = *return_value; - ZVAL_STRING(¶ms[2], - SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key); + ZVAL_STRING( + ¶ms[2], + ZSTR_VAL(SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key)); call_user_function(CG(function_table), NULL, &func_name, &hmac, 3, params); size_t len = Z_STRLEN_P(return_value) + Z_STRLEN(hmac); @@ -66,8 +67,9 @@ PHP_FUNCTION(sp_unserialize) { zval params[3]; ZVAL_STRING(¶ms[0], "sha256"); ZVAL_STRING(¶ms[1], serialized_str); - ZVAL_STRING(¶ms[2], - SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key); + ZVAL_STRING( + ¶ms[2], + ZSTR_VAL(SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key)); call_user_function(CG(function_table), NULL, &func_name, &expected_hmac, 3, params); @@ -113,4 +115,4 @@ int hook_serialize(void) { PHP_FN(sp_unserialize)); return SUCCESS; -} \ No newline at end of file +} -- cgit v1.3