aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/passwords/driver/argon2i.php
diff options
context:
space:
mode:
authorrxu <rxu@mail.ru>2019-12-26 19:44:22 +0700
committerrxu <rxu@mail.ru>2019-12-26 19:44:22 +0700
commit186a3d40c60b4d5f11e6f399737557ef08913078 (patch)
treeee4bb48711a3aa18b43d6ae70ec7cc5a116705f8 /phpBB/phpbb/passwords/driver/argon2i.php
parent230472de4529c4a9c0468488bee0edc6f08086c6 (diff)
downloadforums-186a3d40c60b4d5f11e6f399737557ef08913078.tar
forums-186a3d40c60b4d5f11e6f399737557ef08913078.tar.gz
forums-186a3d40c60b4d5f11e6f399737557ef08913078.tar.bz2
forums-186a3d40c60b4d5f11e6f399737557ef08913078.tar.xz
forums-186a3d40c60b4d5f11e6f399737557ef08913078.zip
[ticket/16266] Fix argon2 driver issue for Sodium implementation
PHPBB3-16266
Diffstat (limited to 'phpBB/phpbb/passwords/driver/argon2i.php')
-rw-r--r--phpBB/phpbb/passwords/driver/argon2i.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/phpBB/phpbb/passwords/driver/argon2i.php b/phpBB/phpbb/passwords/driver/argon2i.php
index 49d7d6393e..3babbaa780 100644
--- a/phpBB/phpbb/passwords/driver/argon2i.php
+++ b/phpBB/phpbb/passwords/driver/argon2i.php
@@ -37,10 +37,21 @@ class argon2i extends base_native
{
parent::__construct($config, $helper);
- // Don't allow cost factors to be below default settings
- $this->memory_cost = max($memory_cost, 1024);
- $this->threads = max($threads, 2);
- $this->time_cost = max($time_cost, 2);
+ if ($this->is_sodium())
+ {
+ // For Sodium implementation, set special cost factor values (since PHP 7.4)
+ // See https://wiki.php.net/rfc/sodium.argon.hash and PHPBB3-16266
+ $this->memory_cost = max($memory_cost, 256*1024);
+ $this->threads = 1;
+ $this->time_cost = max($time_cost, 3);
+ }
+ else
+ {
+ // Otherwise don't allow cost factors to be below default settings
+ $this->memory_cost = max($memory_cost, 1024);
+ $this->threads = max($threads, 2);
+ $this->time_cost = max($time_cost, 2);
+ }
}
/**