Skip to content

Commit d8ccffa

Browse files
committedOct 30, 2017
Extend and speed up pkey export tests
1 parent e78e839 commit d8ccffa

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed
 

‎ext/openssl/tests/001.phpt

+2-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
99
<?php
1010
echo "Creating private key\n";
1111

12-
/* stack up some entropy; performance is not critical,
13-
* and being slow will most likely even help the test.
14-
*/
15-
for ($z = "", $i = 0; $i < 1024; $i++) {
16-
$z .= $i * $i;
17-
if (function_exists("usleep"))
18-
usleep($i);
19-
}
20-
2112
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
2213
$privkey = openssl_pkey_new($conf);
2314

@@ -32,6 +23,7 @@ if ($key_file_name === false)
3223
echo "Export key to file\n";
3324

3425
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
26+
var_dump(is_resource($privkey));
3527

3628
echo "Load key from file - array syntax\n";
3729

@@ -69,6 +61,7 @@ echo "OK!\n";
6961
--EXPECT--
7062
Creating private key
7163
Export key to file
64+
bool(true)
7265
Load key from file - array syntax
7366
Load key using direct syntax
7467
Load key manually and use string syntax

‎ext/openssl/tests/openssl_pkey_export_basic.phpt

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $tempname = tempnam(sys_get_temp_dir(), 'openssl_ec');
3737
var_dump(openssl_pkey_export_to_file($key, $tempname, NULL, $config_arg));
3838
$details = openssl_pkey_get_details(openssl_pkey_get_private('file://' . $tempname));
3939
var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
40-
40+
var_dump(is_resource($key));
4141
// Clean the temporary file
4242
@unlink($tempname);
4343

@@ -52,3 +52,4 @@ resource(%d) of type (OpenSSL key)
5252
bool(true)
5353
bool(true)
5454
bool(true)
55+
bool(true)

0 commit comments

Comments
 (0)
Please sign in to comment.