diff options
author | Ivan Tcholakov <ivantcholakov@gmail.com> | 2015-11-24 18:50:43 +0200 |
---|---|---|
committer | Ivan Tcholakov <ivantcholakov@gmail.com> | 2015-11-24 18:50:43 +0200 |
commit | 8a79828ee331ce0cc8c7dedc7e6c849718c67112 (patch) | |
tree | 76c77c5ab6f6a6cc65a06e94d1e29e3d598b2bed | |
parent | 02113cb2183dd9226ef3e2afae5fc3e36fb78f22 (diff) | |
download | gibberish-aes-php-8a79828ee331ce0cc8c7dedc7e6c849718c67112.zip gibberish-aes-php-8a79828ee331ce0cc8c7dedc7e6c849718c67112.tar.gz gibberish-aes-php-8a79828ee331ce0cc8c7dedc7e6c849718c67112.tar.bz2 |
openssl_random_pseudo_bytes(): Check the crypto-strong flag.
-rw-r--r-- | GibberishAES.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/GibberishAES.php b/GibberishAES.php index 1e0c60f..e84a09b 100644 --- a/GibberishAES.php +++ b/GibberishAES.php @@ -305,7 +305,12 @@ class GibberishAES { protected static function random_bytes($length) { if (self::openssl_random_pseudo_bytes_exists()) { - return openssl_random_pseudo_bytes($length); + + $rnd = openssl_random_pseudo_bytes($length, $crypto_strong); + + if ($crypto_strong) { + return $rnd; + } } if (self::mcrypt_dev_urandom_exists()) { |