git subrepo commit (merge) mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "02ae5285"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "649a5c01"
git-subrepo: version: "0.4.3"
origin: "???"
commit: "???"
Change-Id: I870ad468fba026cc5abf3c5699ed1e12ff28b32b
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php
index 8dba7fc..088edab 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php
@@ -4,11 +4,19 @@
class CSRNGProvider implements IRNGProvider
{
- public function getRandomBytes($bytecount) {
+ /**
+ * {@inheritdoc}
+ */
+ public function getRandomBytes($bytecount)
+ {
return random_bytes($bytecount); // PHP7+
}
-
- public function isCryptographicallySecure() {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isCryptographicallySecure()
+ {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/HashRNGProvider.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/HashRNGProvider.php
index eb42577..d17a5f8 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/HashRNGProvider.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/HashRNGProvider.php
@@ -1,28 +1,43 @@
<?php
+
namespace RobThree\Auth\Providers\Rng;
class HashRNGProvider implements IRNGProvider
{
+ /** @var string */
private $algorithm;
-
- function __construct($algorithm = 'sha256' ) {
+
+ /**
+ * @param string $algorithm
+ */
+ public function __construct($algorithm = 'sha256')
+ {
$algos = array_values(hash_algos());
- if (!in_array($algorithm, $algos, true))
- throw new \RNGException('Unsupported algorithm specified');
+ if (!in_array($algorithm, $algos, true)) {
+ throw new RNGException('Unsupported algorithm specified');
+ }
$this->algorithm = $algorithm;
}
-
- public function getRandomBytes($bytecount) {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getRandomBytes($bytecount)
+ {
$result = '';
$hash = mt_rand();
for ($i = 0; $i < $bytecount; $i++) {
- $hash = hash($this->algorithm, $hash.mt_rand(), true);
- $result .= $hash[mt_rand(0, strlen($hash)-1)];
+ $hash = hash($this->algorithm, $hash . mt_rand(), true);
+ $result .= $hash[mt_rand(0, strlen($hash) - 1)];
}
return $result;
}
-
- public function isCryptographicallySecure() {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isCryptographicallySecure()
+ {
return false;
}
}
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php
index 6be2800..e4e71c2 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php
@@ -4,6 +4,15 @@
interface IRNGProvider
{
+ /**
+ * @param int $bytecount the number of bytes of randomness to return
+ *
+ * @return string the random bytes
+ */
public function getRandomBytes($bytecount);
+
+ /**
+ * @return bool whether this provider is cryptographically secure
+ */
public function isCryptographicallySecure();
-}
\ No newline at end of file
+}
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php
index 0eeab2c..d1b6430 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php
@@ -4,20 +4,34 @@
class MCryptRNGProvider implements IRNGProvider
{
+ /** @var int */
private $source;
-
- function __construct($source = MCRYPT_DEV_URANDOM) {
+
+ /**
+ * @param int $source
+ */
+ public function __construct($source = MCRYPT_DEV_URANDOM)
+ {
$this->source = $source;
}
-
- public function getRandomBytes($bytecount) {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getRandomBytes($bytecount)
+ {
$result = @mcrypt_create_iv($bytecount, $this->source);
- if ($result === false)
- throw new \RNGException('mcrypt_create_iv returned an invalid value');
+ if ($result === false) {
+ throw new RNGException('mcrypt_create_iv returned an invalid value');
+ }
return $result;
}
-
- public function isCryptographicallySecure() {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isCryptographicallySecure()
+ {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php
index dc66c64..eb82b3b 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php
@@ -4,22 +4,37 @@
class OpenSSLRNGProvider implements IRNGProvider
{
+ /** @var bool */
private $requirestrong;
-
- function __construct($requirestrong = true) {
+
+ /**
+ * @param bool $requirestrong
+ */
+ public function __construct($requirestrong = true)
+ {
$this->requirestrong = $requirestrong;
}
-
- public function getRandomBytes($bytecount) {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getRandomBytes($bytecount)
+ {
$result = openssl_random_pseudo_bytes($bytecount, $crypto_strong);
- if ($this->requirestrong && ($crypto_strong === false))
- throw new \RNGException('openssl_random_pseudo_bytes returned non-cryptographically strong value');
- if ($result === false)
- throw new \RNGException('openssl_random_pseudo_bytes returned an invalid value');
+ if ($this->requirestrong && ($crypto_strong === false)) {
+ throw new RNGException('openssl_random_pseudo_bytes returned non-cryptographically strong value');
+ }
+ if ($result === false) {
+ throw new RNGException('openssl_random_pseudo_bytes returned an invalid value');
+ }
return $result;
}
-
- public function isCryptographicallySecure() {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isCryptographicallySecure()
+ {
return $this->requirestrong;
}
-}
\ No newline at end of file
+}
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php
index eb5e913..f9a11ac 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php
@@ -1,5 +1,7 @@
<?php
+namespace RobThree\Auth\Providers\Rng;
+
use RobThree\Auth\TwoFactorAuthException;
-class RNGException extends TwoFactorAuthException {}
\ No newline at end of file
+class RNGException extends TwoFactorAuthException {}