1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 08:17:47 +02:00

Merge branch '3.3.x'

This commit is contained in:
Marc Alexander
2020-01-06 12:01:26 +01:00
13 changed files with 119 additions and 31 deletions

View File

@@ -56,7 +56,7 @@ class update_hashes extends \phpbb\cron\task\base
foreach ($defaults as $type)
{
if ($hashing_algorithms[$type]->is_supported())
if ($hashing_algorithms[$type]->is_supported() && !$hashing_algorithms[$type] instanceof \phpbb\passwords\driver\base_native)
{
$this->default_type = $type;
break;

View File

@@ -0,0 +1,37 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\migration\data\v330;
class v330 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return version_compare($this->config['version'], '3.3.0', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\v329',
'\phpbb\db\migration\data\v330\v330rc1',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.3.0')),
);
}
}

View File

@@ -37,23 +37,15 @@ class argon2i extends base_native
{
parent::__construct($config, $helper);
// Workaround to prevent "Use of undefined constant" warning on some unsupported PHP installations
if (!defined('PASSWORD_ARGON2I'))
{
define('PASSWORD_ARGON2_DEFAULT_MEMORY_COST', 1024);
define('PASSWORD_ARGON2_DEFAULT_TIME_COST', 2);
define('PASSWORD_ARGON2_DEFAULT_THREADS', 1);
}
/**
* For Sodium implementation of argon2 algorithm (since PHP 7.4), set special value of 1 for "threads" cost factor
* See https://wiki.php.net/rfc/sodium.argon.hash and PHPBB3-16266
* Don't allow cost factors to be below default settings where possible
*/
$this->memory_cost = max($memory_cost, PASSWORD_ARGON2_DEFAULT_MEMORY_COST);
$this->time_cost = max($time_cost, PASSWORD_ARGON2_DEFAULT_TIME_COST);
$this->memory_cost = max($memory_cost, defined('PASSWORD_ARGON2_DEFAULT_MEMORY_COST') ? PASSWORD_ARGON2_DEFAULT_MEMORY_COST : 1024);
$this->time_cost = max($time_cost, defined('PASSWORD_ARGON2_DEFAULT_TIME_COST') ? PASSWORD_ARGON2_DEFAULT_TIME_COST : 2);
$this->threads = (defined('PASSWORD_ARGON2_PROVIDER') && PASSWORD_ARGON2_PROVIDER == 'sodium') ?
PASSWORD_ARGON2_DEFAULT_THREADS : max($threads, PASSWORD_ARGON2_DEFAULT_THREADS);
PASSWORD_ARGON2_DEFAULT_THREADS : max($threads, defined('PASSWORD_ARGON2_DEFAULT_THREADS') ? PASSWORD_ARGON2_DEFAULT_THREADS : 1);
}
/**