@@ -7692,7 +7692,7 @@ static int php_openssl_validate_iv(const char **piv, size_t *piv_len, size_t iv_
76927692 char * iv_new ;
76937693
76947694 if (mode -> is_aead ) {
7695- if (EVP_CIPHER_CTX_ctrl (cipher_ctx , mode -> aead_ivlen_flag , * piv_len , NULL ) != 1 ) {
7695+ if (EVP_CIPHER_CTX_ctrl (cipher_ctx , mode -> aead_ivlen_flag , * piv_len , NULL ) <= 0 ) {
76967696 php_error_docref (NULL , E_WARNING , "Setting of IV length for AEAD mode failed" );
76977697 return FAILURE ;
76987698 }
@@ -7764,15 +7764,15 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type,
77647764 return FAILURE ;
77657765 }
77667766 if (mode -> set_tag_length_always || (enc && mode -> set_tag_length_when_encrypting )) {
7767- if (! EVP_CIPHER_CTX_ctrl (cipher_ctx , mode -> aead_set_tag_flag , tag_len , NULL )) {
7767+ if (EVP_CIPHER_CTX_ctrl (cipher_ctx , mode -> aead_set_tag_flag , tag_len , NULL ) <= 0 ) {
77687768 php_error_docref (NULL , E_WARNING , "Setting tag length for AEAD cipher failed" );
77697769 return FAILURE ;
77707770 }
77717771 }
77727772 if (!enc && tag && tag_len > 0 ) {
77737773 if (!mode -> is_aead ) {
77747774 php_error_docref (NULL , E_WARNING , "The tag cannot be used because the cipher algorithm does not support AEAD" );
7775- } else if (! EVP_CIPHER_CTX_ctrl (cipher_ctx , mode -> aead_set_tag_flag , tag_len , (unsigned char * ) tag )) {
7775+ } else if (EVP_CIPHER_CTX_ctrl (cipher_ctx , mode -> aead_set_tag_flag , tag_len , (unsigned char * ) tag ) <= 0 ) {
77767776 php_error_docref (NULL , E_WARNING , "Setting tag for AEAD cipher decryption failed" );
77777777 return FAILURE ;
77787778 }
@@ -7910,7 +7910,7 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(
79107910 if (mode .is_aead && tag ) {
79117911 zend_string * tag_str = zend_string_alloc (tag_len , 0 );
79127912
7913- if (EVP_CIPHER_CTX_ctrl (cipher_ctx , mode .aead_get_tag_flag , tag_len , ZSTR_VAL (tag_str )) == 1 ) {
7913+ if (EVP_CIPHER_CTX_ctrl (cipher_ctx , mode .aead_get_tag_flag , tag_len , ZSTR_VAL (tag_str )) > 0 ) {
79147914 ZSTR_VAL (tag_str )[tag_len ] = '\0' ;
79157915 ZSTR_LEN (tag_str ) = tag_len ;
79167916 ZEND_TRY_ASSIGN_REF_NEW_STR (tag , tag_str );
0 commit comments