diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/sodium_compat/src/Core/BLAKE2b.php --- a/wp/wp-includes/sodium_compat/src/Core/BLAKE2b.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/sodium_compat/src/Core/BLAKE2b.php Tue Sep 27 16:37:53 2022 +0200 @@ -50,6 +50,9 @@ */ public static function new64($high, $low) { + if (PHP_INT_SIZE === 4) { + throw new SodiumException("Error, use 32-bit"); + } $i64 = new SplFixedArray(2); $i64[0] = $high & 0xffffffff; $i64[1] = $low & 0xffffffff; @@ -86,6 +89,9 @@ */ protected static function add64($x, $y) { + if (PHP_INT_SIZE === 4) { + throw new SodiumException("Error, use 32-bit"); + } $l = ($x[1] + $y[1]) & 0xffffffff; return self::new64( (int) ($x[0] + $y[0] + ( @@ -119,6 +125,9 @@ */ protected static function xor64(SplFixedArray $x, SplFixedArray $y) { + if (PHP_INT_SIZE === 4) { + throw new SodiumException("Error, use 32-bit"); + } if (!is_numeric($x[0])) { throw new SodiumException('x[0] is not an integer'); } @@ -147,6 +156,9 @@ */ public static function rotr64($x, $c) { + if (PHP_INT_SIZE === 4) { + throw new SodiumException("Error, use 32-bit"); + } if ($c >= 64) { $c %= 64; } @@ -164,8 +176,8 @@ $l0 = 0; $c = 64 - $c; + /** @var int $c */ if ($c < 32) { - /** @var int $h0 */ $h0 = ((int) ($x[0]) << $c) | ( ( (int) ($x[1]) & ((1 << $c) - 1) @@ -173,10 +185,8 @@ (32 - $c) ) >> (32 - $c) ); - /** @var int $l0 */ $l0 = (int) ($x[1]) << $c; } else { - /** @var int $h0 */ $h0 = (int) ($x[1]) << ($c - 32); } @@ -184,12 +194,9 @@ $c1 = 64 - $c; if ($c1 < 32) { - /** @var int $h1 */ $h1 = (int) ($x[0]) >> $c1; - /** @var int $l1 */ $l1 = ((int) ($x[1]) >> $c1) | ((int) ($x[0]) & ((1 << $c1) - 1)) << (32 - $c1); } else { - /** @var int $l1 */ $l1 = (int) ($x[0]) >> ($c1 - 32); }