Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Sep 28, 2024
1 parent 6137150 commit 4516e22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions crypto_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ 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 < 80400
#if PHP_VERSION_ID < 80200
php_strtoupper(algorithm, algorithm_len);
#else
zend_str_toupper(algorithm, algorithm_len);
Expand All @@ -517,18 +517,14 @@ PHP_CRYPTO_API const EVP_CIPHER *php_crypto_get_cipher_algorithm(
return NULL;
}

#if PHP_VERSION_ID < 80400
#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) {
#if PHP_VERSION_ID < 80400
php_strtolower(algorithm, algorithm_len);
#else
zend_str_tolower(algorithm, algorithm_len);
#endif
cipher = EVP_get_cipherbyname(algorithm);
}
return cipher;
Expand Down
2 changes: 1 addition & 1 deletion crypto_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ 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 < 80400
#if PHP_VERSION_ID < 80200
php_strtoupper(algorithm, algorithm_len);
#else
zend_str_toupper(algorithm, algorithm_len);
Expand Down

0 comments on commit 4516e22

Please sign in to comment.