summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2015-09-27 12:09:46 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2015-09-27 12:09:46 +0200
commitae2c4c820d9aca6ad7eac272e9c18f72c15dc04a (patch)
treec6b133c7b1d76f452d41ff9631e857188974902d
parent6245c6234249410e049cbf6eb925941af0a704c8 (diff)
parent74116250c103acec51ba89d325427261b3ea0272 (diff)
downloadsymfony-security-ae2c4c820d9aca6ad7eac272e9c18f72c15dc04a.zip
symfony-security-ae2c4c820d9aca6ad7eac272e9c18f72c15dc04a.tar.gz
symfony-security-ae2c4c820d9aca6ad7eac272e9c18f72c15dc04a.tar.bz2
Merge branch '2.7' into 2.8
* 2.7: Detect Mintty for color support on Windows Detect Mintty for color support on Windows Add a group for tests of the finder against the FTP server Fix license headers Forbid serializing a Crawler Fix phpdoc block of NativeSessionStorage class Added exception when setAutoInitialize is called when locked [FrameworkBundle] Advanced search templates of bundles [Security] Allow user providers to be defined in many files Use random_bytes function if it is available for random number generation
-rw-r--r--Core/Util/SecureRandom.php8
-rw-r--r--composer.json4
2 files changed, 10 insertions, 2 deletions
diff --git a/Core/Util/SecureRandom.php b/Core/Util/SecureRandom.php
index f4167e4..65722ce 100644
--- a/Core/Util/SecureRandom.php
+++ b/Core/Util/SecureRandom.php
@@ -43,9 +43,9 @@ final class SecureRandom implements SecureRandomInterface
$this->logger = $logger;
// determine whether to use OpenSSL
- if (!function_exists('openssl_random_pseudo_bytes')) {
+ if (!function_exists('random_bytes') && !function_exists('openssl_random_pseudo_bytes')) {
if (null !== $this->logger) {
- $this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
+ $this->logger->notice('It is recommended that you install the "paragonie/random_compat" library or enable the "openssl" extension for random number generation.');
}
$this->useOpenSsl = false;
} else {
@@ -58,6 +58,10 @@ final class SecureRandom implements SecureRandomInterface
*/
public function nextBytes($nbBytes)
{
+ if (function_exists('random_bytes')) {
+ return random_bytes($nbBytes);
+ }
+
// try OpenSSL
if ($this->useOpenSsl) {
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
diff --git a/composer.json b/composer.json
index 708c60f..cc3a319 100644
--- a/composer.json
+++ b/composer.json
@@ -41,10 +41,14 @@
"symfony/expression-language": "~2.6|~3.0.0"
},
"suggest": {
+ "symfony/class-loader": "For using the ACL generateSql script",
+ "symfony/finder": "For using the ACL generateSql script",
+ "symfony/form": "",
"symfony/validator": "For using the user password constraint",
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs",
"symfony/expression-language": "For using the expression voter",
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
+ "paragonie/random_compat": ""
},
"autoload": {
"psr-4": { "Symfony\\Component\\Security\\": "" }