mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #15332: Always check for availability of openssl_pseudo_random_bytes
, even if LibreSSL is available
This commit is contained in:
@ -478,12 +478,12 @@ class Security extends Component
|
||||
|
||||
// Since 5.4.0, openssl_random_pseudo_bytes() reads from CryptGenRandom on Windows instead
|
||||
// of using OpenSSL library. LibreSSL is OK everywhere but don't use OpenSSL on non-Windows.
|
||||
if ($this->_useLibreSSL
|
||||
if (function_exists('openssl_random_pseudo_bytes')
|
||||
&& ($this->_useLibreSSL
|
||||
|| (
|
||||
DIRECTORY_SEPARATOR !== '/'
|
||||
&& substr_compare(PHP_OS, 'win', 0, 3, true) === 0
|
||||
&& function_exists('openssl_random_pseudo_bytes')
|
||||
)
|
||||
))
|
||||
) {
|
||||
$key = openssl_random_pseudo_bytes($length, $cryptoStrong);
|
||||
if ($cryptoStrong === false) {
|
||||
|
Reference in New Issue
Block a user