File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ PHP NEWS
12
12
- Mbstring:
13
13
. mb_split() can now handle empty matches like preg_split() does. (Moriyoshi)
14
14
15
+ - OpenSSL:
16
+ . Fixed bug #61930 (openssl corrupts ssl key resource when using
17
+ openssl_get_publickey()). (Stas)
18
+
15
19
- SPL:
16
20
. Fixed bug #64228 (RecursiveDirectoryIterator always assumes SKIP_DOTS).
17
21
(patch by kriss@krizalys.com, Laruence)
Original file line number Diff line number Diff line change @@ -3204,6 +3204,7 @@ PHP_FUNCTION(openssl_pkey_get_public)
3204
3204
if (pkey == NULL ) {
3205
3205
RETURN_FALSE ;
3206
3206
}
3207
+ zend_list_addref (Z_LVAL_P (return_value ));
3207
3208
}
3208
3209
/* }}} */
3209
3210
@@ -3240,6 +3241,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
3240
3241
if (pkey == NULL ) {
3241
3242
RETURN_FALSE ;
3242
3243
}
3244
+ zend_list_addref (Z_LVAL_P (return_value ));
3243
3245
}
3244
3246
3245
3247
/* }}} */
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #61930: openssl corrupts ssl key resource when using openssl_get_publickey()
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ("openssl " )) die ("skip " );
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ $ cert = file_get_contents (__DIR__ .'/cert.crt ' );
10
+
11
+ $ data = <<<DATA
12
+ Please verify me
13
+ DATA ;
14
+
15
+ $ sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A= ' ;
16
+
17
+ $ key = openssl_get_publickey ($ cert );
18
+ var_dump (openssl_get_publickey ($ key ));
19
+ var_dump (openssl_verify ($ data , base64_decode ($ sig ), $ key ));
20
+ ?>
21
+ --EXPECTF--
22
+ resource(%d) of type (OpenSSL key)
23
+ int(1)
24
+
You can’t perform that action at this time.
0 commit comments