diff --git a/include/functions.inc b/include/functions.inc index 7c2dcfb116212ac54102f8dadd40b2c4931ec4b4..0d8768596ba38dd58020295fa401b6cbb63a0a50 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1931,38 +1931,6 @@ function load_all_classes () } } -if (!function_exists('random_int')) { - // PHP<7, we fallback on openssl_random_pseudo_bytes - function random_int ($min, $max) - { - $range = $max - $min; - if ($range <= 0) { - throw new Exception('Invalid range passed to random_int'); - } - - $log = log($range, 2); - // length in bytes - $nbBytes = (int) ($log / 8) + 1; - // length in bits - $nbBits = (int) $log + 1; - // set all lower bits to 1 - $filter = pow(2, $nbBits) - 1; - if ($filter >= PHP_INT_MAX) { - $filter = PHP_INT_MAX; - } - do { - $randomBytes = openssl_random_pseudo_bytes($nbBytes, $strong); - if (!$strong || ($randomBytes === FALSE)) { - throw new Exception('Failed to get random bytes'); - } - $rnd = hexdec(bin2hex($randomBytes)); - // discard irrelevant bits - $rnd = $rnd & $filter; - } while ($rnd > $range); - return $min + $rnd; - } -} - function ldap_escape_f ($str, $ignore = '') { return ldap_escape($str, $ignore, LDAP_ESCAPE_FILTER); diff --git a/include/variables_common.inc b/include/variables_common.inc index ad2547b512da10b512d5892d2fcce4842b9a38ec..f79605da8624944e9e09a00d7b589c7370fd02d9 100644 --- a/include/variables_common.inc +++ b/include/variables_common.inc @@ -73,7 +73,7 @@ define("CONFIGRDN", "cn=config,ou=fusiondirectory,"); /*! Define FusionDirectory /*! * \brief Minimum PHPĀ version */ -define('PHP_MIN_VERSION', '5.6.0'); +define('PHP_MIN_VERSION', '7.0.0'); /*! * \brief Toggle crashing on PHP error, used for test suites diff --git a/setup/class_setupStepChecks.inc b/setup/class_setupStepChecks.inc index 6d9ecd4b6bfa70d8aaab288e8b3c1720f9522d57..fda940146cb6453a794a665f5dd2e32534186b41 100644 --- a/setup/class_setupStepChecks.inc +++ b/setup/class_setupStepChecks.inc @@ -95,14 +95,6 @@ class setupStepChecks extends setupStep $M = TRUE; $basic_checks[] = ['NAME' => $N , 'DESC' => $D , 'RESULT' => $R , 'SOLUTION' => $S , 'MUST' => $M ]; - /* Pseudo-random check */ - $N = _('Checking cryptographically secure pseudo-random integers'); - $D = _('You must use PHP>=7 or have openssl module activated so that FusionDirectory can generate cryptographically secure pseudo-random integers.'); - $S = _('Please upgrade to PHP7 or activate openssl module.'); - $R = (is_callable('random_int') || is_callable('openssl_random_pseudo_bytes')); - $M = TRUE; - $basic_checks[] = ['NAME' => $N , 'DESC' => $D , 'RESULT' => $R , 'SOLUTION' => $S , 'MUST' => $M ]; - /* Check for json support */ $N = msgPool::checkingFor('json'); $D = _('FusionDirectory requires this module to encode variables for javascript use.');