summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--src/sp_php_compat.h9
2 files changed, 14 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 8fcb297..e4986e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,10 @@ src/tests/*/*.log
19src/tests/*/*.out 19src/tests/*/*.out
20src/tests/*/*.sh 20src/tests/*/*.sh
21src/tests/*/*.php 21src/tests/*/*.php
22src/tests/*/phpt.*
23
24.vscode/
25
22# generated by re2c or copied from cached version 26# generated by re2c or copied from cached version
23src/sp_config_scanner.c 27src/sp_config_scanner.c
24# Files generated by phpize, configure and make 28# Files generated by phpize, configure and make
@@ -47,4 +51,5 @@ src/Makefile.objects
47src/missing 51src/missing
48src/mkinstalldirs 52src/mkinstalldirs
49src/run-tests.php 53src/run-tests.php
54src/*.dep
50doc/build/ 55doc/build/
diff --git a/src/sp_php_compat.h b/src/sp_php_compat.h
index d1102a8..04914b4 100644
--- a/src/sp_php_compat.h
+++ b/src/sp_php_compat.h
@@ -100,6 +100,7 @@ static zend_always_inline void zend_string_efree(zend_string *s)
100#endif 100#endif
101 101
102// copied from PHP 8.0.11 sources, ext/hash/hash.c 102// copied from PHP 8.0.11 sources, ext/hash/hash.c
103// slightly modified for PHP 8.1 compatibility
103 104
104static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const size_t length) { 105static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const size_t length) {
105 size_t i; 106 size_t i;
@@ -112,7 +113,11 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
112 memset(K, 0, ops->block_size); 113 memset(K, 0, ops->block_size);
113 if (key_len > ops->block_size) { 114 if (key_len > ops->block_size) {
114 /* Reduce the key first */ 115 /* Reduce the key first */
116#if PHP_VERSION_ID < 80100
115 ops->hash_init(context); 117 ops->hash_init(context);
118#else
119 ops->hash_init(context, NULL);
120#endif
116 ops->hash_update(context, key, key_len); 121 ops->hash_update(context, key, key_len);
117 ops->hash_final(K, context); 122 ops->hash_final(K, context);
118 } else { 123 } else {
@@ -123,7 +128,11 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
123} 128}
124 129
125static 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) { 130static 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) {
131#if PHP_VERSION_ID < 80100
126 ops->hash_init(context); 132 ops->hash_init(context);
133#else
134 ops->hash_init(context, NULL);
135#endif
127 ops->hash_update(context, key, ops->block_size); 136 ops->hash_update(context, key, ops->block_size);
128 ops->hash_update(context, data, data_size); 137 ops->hash_update(context, data, data_size);
129 ops->hash_final(final, context); 138 ops->hash_final(final, context);