com php-src: rely on provided openssl.cnf to avoid possible failure with system defaults: ext/openssl/tests/001.phpt ext/openssl/tests/o penssl_free_key.phpt

[email protected] (Remi Collet)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    1ffb1b95974e1eb3b0aedfb7a4278a89fc7a6326
Author:    Remi Collet <[email protected]>         Mon, 13 Mar 2017 08:17:42 +0100
Parents:   fbf0e0587f8455525466e6d4ab2c1f0fc24bfe26
Branches:  PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=1ffb1b95974e1eb3b0aedfb7a4278a89fc7a6326

Log:
rely on provided openssl.cnf to avoid possible failure with system defaults

Changed paths:
  M  ext/openssl/tests/001.phpt
  M  ext/openssl/tests/openssl_free_key.phpt


Diff:
diff --git a/ext/openssl/tests/001.phpt b/ext/openssl/tests/001.phpt
index d62612b..2d0aa90 100644
--- a/ext/openssl/tests/001.phpt
+++ b/ext/openssl/tests/001.phpt
@@ -18,7 +18,8 @@ for ($z = "", $i = 0; $i < 1024; $i++) {
 		usleep($i);
 }
 
-$privkey = openssl_pkey_new();
+$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
+$privkey = openssl_pkey_new($conf);
 
 if ($privkey === false)
 	die("failed to create private key");
@@ -30,7 +31,7 @@ if ($key_file_name === false)
 
 echo "Export key to file\n";
 
-openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
+openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
 
 echo "Load key from file - array syntax\n";
 
diff --git a/ext/openssl/tests/openssl_free_key.phpt b/ext/openssl/tests/openssl_free_key.phpt
index 816f7cf..ea79ce7 100644
--- a/ext/openssl/tests/openssl_free_key.phpt
+++ b/ext/openssl/tests/openssl_free_key.phpt
@@ -22,7 +22,8 @@ for ($z = "", $i = 0; $i < 1024; $i++) {
         usleep($i);
 }
 
-$privkey = openssl_pkey_new();
+$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
+$privkey = openssl_pkey_new($conf);
 
 if ($privkey === false)
     die("failed to create private key");
@@ -34,7 +35,7 @@ if ($key_file_name === false)
 
 echo "Export key to file\n";
 
-openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
+openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
 
 echo "Load key from file - array syntax\n";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.