summaryrefslogtreecommitdiff
path: root/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2016-02-20 19:38:18 +0000
committerGreg Roach <fisharebest@gmail.com>2016-02-20 19:38:33 +0000
commit2e5db07900b2a67aca60359c9cce26fdc1f64cee (patch)
treef3952a40d122e8a56832f0b13b17baf2f5d7eeb7 /vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
parentd47c04065834d2f8391fd14c2da3a14d52448117 (diff)
downloadwebtrees-2e5db07900b2a67aca60359c9cce26fdc1f64cee.tar.gz
webtrees-2e5db07900b2a67aca60359c9cce26fdc1f64cee.tar.bz2
webtrees-2e5db07900b2a67aca60359c9cce26fdc1f64cee.zip
Update dependencies
Diffstat (limited to 'vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php')
-rw-r--r--vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
index 5a1b688f60..7ac9d9105f 100644
--- a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
+++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
@@ -48,6 +48,7 @@ function random_bytes($bytes)
'random_bytes(): $bytes must be an integer'
);
}
+
if ($bytes < 1) {
throw new Error(
'Length must be greater than 0'
@@ -55,14 +56,17 @@ function random_bytes($bytes)
}
$buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
- if ($buf !== false) {
- if (RandomCompat_strlen($buf) === $bytes) {
- /**
- * Return our random entropy buffer here:
- */
- return $buf;
- }
+ if (
+ $buf !== false
+ &&
+ RandomCompat_strlen($buf) === $bytes
+ ) {
+ /**
+ * Return our random entropy buffer here:
+ */
+ return $buf;
}
+
/**
* If we reach here, PHP has failed us.
*/