Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ PHP_MINIT_FUNCTION(crypto)
zend_class_entry ce;

/* Register base exception */
#if PHP_VERSION_ID < 70000
PHP_CRYPTO_EXCEPTION_REGISTER_CE(ce, Crypto, zend_exception_get_default(TSRMLS_C));
#else
PHP_CRYPTO_EXCEPTION_REGISTER_CE(ce, Crypto, zend_ce_exception);
#endif

/* Init OpenSSL algorithms */
OpenSSL_add_all_algorithms();
Expand Down
10 changes: 9 additions & 1 deletion crypto_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,11 @@ PHP_MINIT_FUNCTION(crypto_cipher)
static inline void php_crypto_cipher_set_algorithm_name(zval *object,
char *algorithm, phpc_str_size_t algorithm_len TSRMLS_DC)
{
#if PHP_VERSION_ID < 80200
php_strtoupper(algorithm, algorithm_len);
#else
zend_str_toupper(algorithm, algorithm_len);
#endif
zend_update_property_stringl(php_crypto_cipher_ce, PHPC_OBJ_FOR_PROP(object),
"algorithm", sizeof("algorithm")-1, algorithm, algorithm_len TSRMLS_CC);
}
Expand All @@ -513,10 +517,14 @@ PHP_CRYPTO_API const EVP_CIPHER *php_crypto_get_cipher_algorithm(
return NULL;
}

#if PHP_VERSION_ID < 80200
php_strtoupper(algorithm, algorithm_len);
#else
zend_str_toupper(algorithm, algorithm_len);
#endif
cipher = EVP_get_cipherbyname(algorithm);
if (!cipher) {
php_strtolower(algorithm, algorithm_len);
zend_str_tolower(algorithm, algorithm_len);
cipher = EVP_get_cipherbyname(algorithm);
}
return cipher;
Expand Down
4 changes: 4 additions & 0 deletions crypto_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ PHP_MINIT_FUNCTION(crypto_hash)
static inline void php_crypto_hash_set_algorithm_name(zval *object,
char *algorithm, phpc_str_size_t algorithm_len TSRMLS_DC)
{
#if PHP_VERSION_ID < 80200
php_strtoupper(algorithm, algorithm_len);
#else
zend_str_toupper(algorithm, algorithm_len);
#endif
zend_update_property_stringl(php_crypto_hash_ce, PHPC_OBJ_FOR_PROP(object),
"algorithm", sizeof("algorithm")-1, algorithm, algorithm_len TSRMLS_CC);
}
Expand Down
Loading