Upgrade/Install: Update sodium_compat to v1.14.0.

This includes improved PHP 8 support and more inclusive language.

A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.13.0...v1.14.0

Follow-up to [48121], [49056], [49057].

Props jrf.
Fixes #51925.
Built from https://develop.svn.wordpress.org/trunk@49741


git-svn-id: http://core.svn.wordpress.org/trunk@49464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-12-03 17:41:07 +00:00
parent 4dd08e20b8
commit 203b48f281
6 changed files with 26 additions and 17 deletions

View File

@ -54,7 +54,7 @@
"paragonie/random_compat": ">=1"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5|^6|^7"
"phpunit/phpunit": "^3|^4|^5|^6|^7|^8|^9"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",

View File

@ -14,8 +14,9 @@ class ParagonIE_Sodium_Core_SipHash extends ParagonIE_Sodium_Core_Util
/**
* @internal You should not use this directly from another application
*
* @param int[] $v
* @return int[]
* @param array<array-key, int> $v
* @return array<array-key, int>
*
*/
public static function sipRound(array $v)
{
@ -26,27 +27,27 @@ class ParagonIE_Sodium_Core_SipHash extends ParagonIE_Sodium_Core_Util
);
# v1=ROTL(v1,13);
list($v[2], $v[3]) = self::rotl_64($v[2], $v[3], 13);
list($v[2], $v[3]) = self::rotl_64((int) $v[2], (int) $v[3], 13);
# v1 ^= v0;
$v[2] ^= $v[0];
$v[3] ^= $v[1];
$v[2] = (int) $v[2] ^ (int) $v[0];
$v[3] = (int) $v[3] ^ (int) $v[1];
# v0=ROTL(v0,32);
list($v[0], $v[1]) = self::rotl_64((int) $v[0], (int) $v[1], 32);
# v2 += v3;
list($v[4], $v[5]) = self::add(
array($v[4], $v[5]),
array($v[6], $v[7])
array((int) $v[4], (int) $v[5]),
array((int) $v[6], (int) $v[7])
);
# v3=ROTL(v3,16);
list($v[6], $v[7]) = self::rotl_64($v[6], $v[7], 16);
list($v[6], $v[7]) = self::rotl_64((int) $v[6], (int) $v[7], 16);
# v3 ^= v2;
$v[6] ^= $v[4];
$v[7] ^= $v[5];
$v[6] = (int) $v[6] ^ (int) $v[4];
$v[7] = (int) $v[7] ^ (int) $v[5];
# v0 += v3;
list($v[0], $v[1]) = self::add(
@ -58,8 +59,8 @@ class ParagonIE_Sodium_Core_SipHash extends ParagonIE_Sodium_Core_Util
list($v[6], $v[7]) = self::rotl_64((int) $v[6], (int) $v[7], 21);
# v3 ^= v0;
$v[6] ^= $v[0];
$v[7] ^= $v[1];
$v[6] = (int) $v[6] ^ (int) $v[0];
$v[7] = (int) $v[7] ^ (int) $v[1];
# v2 += v1;
list($v[4], $v[5]) = self::add(
@ -71,8 +72,8 @@ class ParagonIE_Sodium_Core_SipHash extends ParagonIE_Sodium_Core_Util
list($v[2], $v[3]) = self::rotl_64((int) $v[2], (int) $v[3], 17);
# v1 ^= v2;;
$v[2] ^= $v[4];
$v[3] ^= $v[5];
$v[2] = (int) $v[2] ^ (int) $v[4];
$v[3] = (int) $v[3] ^ (int) $v[5];
# v2=ROTL(v2,32)
list($v[4], $v[5]) = self::rotl_64((int) $v[4], (int) $v[5], 32);

View File

@ -903,6 +903,9 @@ abstract class ParagonIE_Sodium_Core_Util
*
* @internal You should not use this directly from another application
*
* Note: MB_OVERLOAD_STRING === 2, but we don't reference the constant
* (for nuisance-free PHP 8 support)
*
* @return bool
*/
protected static function isMbStringOverride()
@ -913,7 +916,8 @@ abstract class ParagonIE_Sodium_Core_Util
$mbstring = extension_loaded('mbstring')
&& defined('MB_OVERLOAD_STRING')
&&
((int) (ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING);
((int) (ini_get('mbstring.func_overload')) & 2);
// MB_OVERLOAD_STRING === 2
}
/** @var bool $mbstring */

View File

@ -243,6 +243,7 @@ class ParagonIE_Sodium_File extends ParagonIE_Sodium_Core_Util
ParagonIE_Sodium_Compat::memzero($nonce);
ParagonIE_Sodium_Compat::memzero($ephKeypair);
} catch (SodiumException $ex) {
/** @psalm-suppress PossiblyUndefinedVariable */
unset($ephKeypair);
}
return $res;
@ -541,6 +542,7 @@ class ParagonIE_Sodium_File extends ParagonIE_Sodium_Core_Util
try {
ParagonIE_Sodium_Compat::memzero($key);
} catch (SodiumException $ex) {
/** @psalm-suppress PossiblyUndefinedVariable */
unset($key);
}
return $res;

View File

@ -102,6 +102,7 @@ class SplFixedArray implements Iterator, ArrayAccess, Countable
*/
public function offsetGet($index)
{
/** @psalm-suppress MixedReturnStatement */
return $this->internalArray[(int) $index];
}
@ -142,6 +143,7 @@ class SplFixedArray implements Iterator, ArrayAccess, Countable
*/
public function current()
{
/** @psalm-suppress MixedReturnStatement */
return current($this->internalArray);
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-49739';
$wp_version = '5.7-alpha-49741';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.