From e22065c7ba31d000e93f57dce8a2caae50375d5e Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Tue, 30 Nov 2021 12:57:06 +0100 Subject: php 8.1 compatibility --- src/sp_php_compat.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/sp_php_compat.h') 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) #endif // copied from PHP 8.0.11 sources, ext/hash/hash.c +// slightly modified for PHP 8.1 compatibility static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const size_t length) { size_t i; @@ -112,7 +113,11 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops * memset(K, 0, ops->block_size); if (key_len > ops->block_size) { /* Reduce the key first */ +#if PHP_VERSION_ID < 80100 ops->hash_init(context); +#else + ops->hash_init(context, NULL); +#endif ops->hash_update(context, key, key_len); ops->hash_final(K, context); } else { @@ -123,7 +128,11 @@ 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) { +#if PHP_VERSION_ID < 80100 ops->hash_init(context); +#else + ops->hash_init(context, NULL); +#endif ops->hash_update(context, key, ops->block_size); ops->hash_update(context, data, data_size); ops->hash_final(final, context); -- cgit v1.3