mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: fix bug #61930: openssl corrupts ssl key resource when using openssl_get_publickey()
This commit is contained in:
commit
0841eca580
2 changed files with 26 additions and 0 deletions
|
@ -3214,6 +3214,7 @@ PHP_FUNCTION(openssl_pkey_get_public)
|
||||||
if (pkey == NULL) {
|
if (pkey == NULL) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
zend_list_addref(Z_LVAL_P(return_value));
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -3250,6 +3251,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
|
||||||
if (pkey == NULL) {
|
if (pkey == NULL) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
zend_list_addref(Z_LVAL_P(return_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
24
ext/openssl/tests/bug61930.phpt
Normal file
24
ext/openssl/tests/bug61930.phpt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #61930: openssl corrupts ssl key resource when using openssl_get_publickey()
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded("openssl")) die("skip");
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$cert = file_get_contents(__DIR__.'/cert.crt');
|
||||||
|
|
||||||
|
$data = <<<DATA
|
||||||
|
Please verify me
|
||||||
|
DATA;
|
||||||
|
|
||||||
|
$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
|
||||||
|
|
||||||
|
$key = openssl_get_publickey($cert);
|
||||||
|
var_dump(openssl_get_publickey($key));
|
||||||
|
var_dump(openssl_verify($data, base64_decode($sig), $key));
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
resource(%d) of type (OpenSSL key)
|
||||||
|
int(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue