Bug #78444 [NEW]: openssl_pkey_new generates OpenSSL errors with OpenSSL 1.1.1
| From: | jmaguire at duo dot com | Date: | Thu, 22 Aug 2019 14:38:53 +0000 |
| Subject: | Bug #78444 [NEW]: openssl_pkey_new generates OpenSSL errors with OpenSSL 1.1.1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222366@lists.php.net to get a copy of this message | ||
From: jmaguire at duo dot com
Operating system: Linux/Windows
PHP version: 7.3.8
Package: OpenSSL related
Bug Type: Bug
Bug description:openssl_pkey_new generates OpenSSL errors with OpenSSL 1.1.1
Description:
------------
If a .rnd file does not exist in the user's directory, openssl_pkey_new
will generate an error: error:2406F079:random number
generator:RAND_load_file:Cannot open file
The .rnd file will be created, and the operation appears to work, but
this causes issues when trying to detect errors in the OpenSSL pkey
creation.
Subsequent calls to openssl_pkey_new succeed, as the .rnd file is
created successfully.
It seems that running, e.g.
openssl genrsa -des3 -out private.pem 2048
at the command line does not create or need this .rnd file anymore.
Test script:
---------------
<?php
unlink(getenv('HOME') . '/.rnd');
openssl_pkey_new();
while ($err = openssl_error_string()) {
echo $err . PHP_EOL;
}
Expected result:
----------------
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
Actual result:
--------------
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:2406F079:random number generator:RAND_load_file:Cannot open file
--
Edit bug report at https://bugs.php.net/bug.php?id=78444&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78444&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78444&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78444&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78444&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78444&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78444&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78444&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78444&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78444&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78444&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78444&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78444&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78444&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78444&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78444&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78444&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78444&r=mysqlcfg