Skip to content
Snippets Groups Projects
Commit 33e72c57 authored by Olav Morken's avatar Olav Morken
Browse files

Utilities: Use openssl_random_pseudo_bytes for in generateRandomBytes().

Fixes issue 403.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2969 44740490-163a-0410-bde0-09ae8108e29a
parent f21cba1e
No related branches found
No related tags found
No related merge requests found
...@@ -1006,6 +1006,10 @@ class SimpleSAML_Utilities { ...@@ -1006,6 +1006,10 @@ class SimpleSAML_Utilities {
static $fp = NULL; static $fp = NULL;
assert('is_int($length)'); assert('is_int($length)');
if (function_exists('openssl_random_pseudo_bytes')) {
return openssl_random_pseudo_bytes($length);
}
if($fp === NULL) { if($fp === NULL) {
if (@file_exists('/dev/urandom')) { if (@file_exists('/dev/urandom')) {
$fp = @fopen('/dev/urandom', 'rb'); $fp = @fopen('/dev/urandom', 'rb');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment