Skip to content

Commit 8f69ca8

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 793fd6b + 2e02579 commit 8f69ca8

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ PHP NEWS
2222
. Fixed bug #78015 (Incorrect evaluation of expressions involving partials
2323
arrays in SCCP). (Nikita)
2424

25+
- OpenSSL:
26+
. Fixed bug #78079 (openssl_encrypt_ccm.phpt fails with OpenSSL 1.1.1c).
27+
(Jakub Zelenka)
28+
2529
- Sockets:
2630
. Fixed bug #78038 (Socket_select fails when resource array contains
2731
references). (Nikita)

ext/openssl/openssl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6496,7 +6496,10 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type,
64966496
return FAILURE;
64976497
}
64986498
if (mode->is_single_run_aead && enc) {
6499-
EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, NULL);
6499+
if (!EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, NULL)) {
6500+
php_error_docref(NULL, E_WARNING, "Setting tag length for AEAD cipher failed");
6501+
return FAILURE;
6502+
}
65006503
} else if (!enc && tag && tag_len > 0) {
65016504
if (!mode->is_aead) {
65026505
php_error_docref(NULL, E_WARNING, "The tag cannot be used because the cipher method does not support AEAD");

ext/openssl/tests/openssl_encrypt_ccm.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ foreach ($tests as $idx => $test) {
2424
// Empty IV error
2525
var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
2626

27-
// Test setting different IV length and unlimeted tag
28-
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 10), $tag, '', 1024));
27+
// Test setting different IV length and tag length
28+
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 10), $tag, '', 14));
2929
var_dump(strlen($tag));
30+
31+
// Test setting invalid tag length
32+
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 16), $tag, '', 1024));
3033
?>
3134
--EXPECTF--
3235
TEST 0
@@ -36,4 +39,7 @@ bool(true)
3639
Warning: openssl_encrypt(): Setting of IV length for AEAD mode failed in %s on line %d
3740
bool(false)
3841
string(8) "p/lvgA=="
39-
int(1024)
42+
int(14)
43+
44+
Warning: openssl_encrypt(): Setting of IV length for AEAD mode failed in %s on line %d
45+
bool(false)

0 commit comments

Comments
 (0)