Make WordPress Core


Ignore:
Timestamp:
03/24/2022 03:18:31 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Update sodium_compat to v1.17.1.

The latest version of sodium_compat includes further improvements for PHP 8.1 compatibility.

Release notes:
https://github.com/paragonie/sodium_compat/releases/tag/v1.17.1

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

Follow-up to [49741], [51002], [51591].

Props jrf, paragoninitiativeenterprises.
Fixes #55453.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519.php

    r46586 r52988  
    326326        $f[9] = $f[9]->subInt64($carry9->shiftLeft(25));
    327327
    328         /** @var int $h0 */
    329328        $h0 = $f[0]->toInt32()->toInt();
    330         /** @var int $h1 */
    331329        $h1 = $f[1]->toInt32()->toInt();
    332         /** @var int $h2 */
    333330        $h2 = $f[2]->toInt32()->toInt();
    334         /** @var int $h3 */
    335331        $h3 = $f[3]->toInt32()->toInt();
    336         /** @var int $h4 */
    337332        $h4 = $f[4]->toInt32()->toInt();
    338         /** @var int $h5 */
    339333        $h5 = $f[5]->toInt32()->toInt();
    340         /** @var int $h6 */
    341334        $h6 = $f[6]->toInt32()->toInt();
    342         /** @var int $h7 */
    343335        $h7 = $f[7]->toInt32()->toInt();
    344         /** @var int $h8 */
    345336        $h8 = $f[8]->toInt32()->toInt();
    346         /** @var int $h9 */
    347337        $h9 = $f[9]->toInt32()->toInt();
    348338
     
    419409            $zero = str_repeat("\x00", 32);
    420410        }
    421         /** @var string $str */
    422411        $str = self::fe_tobytes($f);
    423412        /** @var string $zero */
     
    498487        $g8_19 = $g8->mulInt(19, 5);
    499488        $g9_19 = $g9->mulInt(19, 5);
    500         /** @var ParagonIE_Sodium_Core32_Int64 $f1_2 */
    501489        $f1_2 = $f1->shiftLeft(1);
    502         /** @var ParagonIE_Sodium_Core32_Int64 $f3_2 */
    503490        $f3_2 = $f3->shiftLeft(1);
    504         /** @var ParagonIE_Sodium_Core32_Int64 $f5_2 */
    505491        $f5_2 = $f5->shiftLeft(1);
    506         /** @var ParagonIE_Sodium_Core32_Int64 $f7_2 */
    507492        $f7_2 = $f7->shiftLeft(1);
    508         /** @var ParagonIE_Sodium_Core32_Int64 $f9_2 */
    509493        $f9_2 = $f9->shiftLeft(1);
    510494        $f0g0    = $f0->mulInt64($g0, 27);
     
    776760    public static function fe_sq(ParagonIE_Sodium_Core32_Curve25519_Fe $f)
    777761    {
    778         /** @var ParagonIE_Sodium_Core32_Int64 $f0 */
    779762        $f0 = $f[0]->toInt64();
    780         /** @var ParagonIE_Sodium_Core32_Int64 $f1 */
    781763        $f1 = $f[1]->toInt64();
    782         /** @var ParagonIE_Sodium_Core32_Int64 $f2 */
    783764        $f2 = $f[2]->toInt64();
    784         /** @var ParagonIE_Sodium_Core32_Int64 $f3 */
    785765        $f3 = $f[3]->toInt64();
    786         /** @var ParagonIE_Sodium_Core32_Int64 $f4 */
    787766        $f4 = $f[4]->toInt64();
    788         /** @var ParagonIE_Sodium_Core32_Int64 $f5 */
    789767        $f5 = $f[5]->toInt64();
    790         /** @var ParagonIE_Sodium_Core32_Int64 $f6 */
    791768        $f6 = $f[6]->toInt64();
    792         /** @var ParagonIE_Sodium_Core32_Int64 $f7 */
    793769        $f7 = $f[7]->toInt64();
    794         /** @var ParagonIE_Sodium_Core32_Int64 $f8 */
    795770        $f8 = $f[8]->toInt64();
    796         /** @var ParagonIE_Sodium_Core32_Int64 $f9 */
    797771        $f9 = $f[9]->toInt64();
    798772
    799         /** @var ParagonIE_Sodium_Core32_Int64 $f0_2 */
    800773        $f0_2 = $f0->shiftLeft(1);
    801774        $f1_2 = $f1->shiftLeft(1);
     
    811784        $f8_19 = $f8->mulInt(19, 5);
    812785        $f9_38 = $f9->mulInt(38, 6);
    813         /** @var ParagonIE_Sodium_Core32_Int64 $f0f0*/
     786
    814787        $f0f0    = $f0->mulInt64($f0, 28);
    815788        $f0f1_2  = $f0_2->mulInt64($f1, 28);
     
    980953    public static function fe_sq2(ParagonIE_Sodium_Core32_Curve25519_Fe $f)
    981954    {
    982         /** @var ParagonIE_Sodium_Core32_Int64 $f0 */
    983955        $f0 = $f[0]->toInt64();
    984         /** @var ParagonIE_Sodium_Core32_Int64 $f1 */
    985956        $f1 = $f[1]->toInt64();
    986         /** @var ParagonIE_Sodium_Core32_Int64 $f2 */
    987957        $f2 = $f[2]->toInt64();
    988         /** @var ParagonIE_Sodium_Core32_Int64 $f3 */
    989958        $f3 = $f[3]->toInt64();
    990         /** @var ParagonIE_Sodium_Core32_Int64 $f4 */
    991959        $f4 = $f[4]->toInt64();
    992         /** @var ParagonIE_Sodium_Core32_Int64 $f5 */
    993960        $f5 = $f[5]->toInt64();
    994         /** @var ParagonIE_Sodium_Core32_Int64 $f6 */
    995961        $f6 = $f[6]->toInt64();
    996         /** @var ParagonIE_Sodium_Core32_Int64 $f7 */
    997962        $f7 = $f[7]->toInt64();
    998         /** @var ParagonIE_Sodium_Core32_Int64 $f8 */
    999963        $f8 = $f[8]->toInt64();
    1000         /** @var ParagonIE_Sodium_Core32_Int64 $f9 */
    1001964        $f9 = $f[9]->toInt64();
    1002965
     
    14801443        static $d = null;
    14811444        if (!$d) {
    1482             /** @var ParagonIE_Sodium_Core32_Curve25519_Fe $d */
    14831445            $d = ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray(
    14841446                array(
     
    14961458            );
    14971459        }
     1460        /** @var ParagonIE_Sodium_Core32_Curve25519_Fe $d */
    14981461
    14991462        # fe_frombytes(h->Y,s);
     
    18341797    public static function equal($b, $c)
    18351798    {
    1836         return (int) ((($b ^ $c) - 1 & 0xffffffff) >> 31);
     1799        $b0 = $b & 0xffff;
     1800        $b1 = ($b >> 16) & 0xffff;
     1801        $c0 = $c & 0xffff;
     1802        $c1 = ($c >> 16) & 0xffff;
     1803
     1804        $d0 = (($b0 ^ $c0) - 1) >> 31;
     1805        $d1 = (($b1 ^ $c1) - 1) >> 31;
     1806        return ($d0 & $d1) & 1;
    18371807    }
    18381808
     
    18511821        }
    18521822        /** @var string $char */
    1853         /** @var int $x */
    18541823        $x = self::chrToInt(self::substr($char, 0, 1));
    18551824        return (int) ($x >> 31);
     
    19571926
    19581927        $bnegative = self::negative($b);
    1959         /** @var int $babs */
    19601928        $babs = $b - (((-$bnegative) & $b) << 1);
    19611929
     
    19651933                $t,
    19661934                $base[$pos][$i],
    1967                 self::equal($babs, $i + 1)
     1935                -self::equal($babs, $i + 1)
    19681936            );
    19691937        }
     
    22312199        for ($i = 0; $i < 63; ++$i) {
    22322200            $e[$i] += $carry;
    2233             /** @var int $carry */
    22342201            $carry = $e[$i] + 8;
    2235             /** @var int $carry */
    22362202            $carry >>= 4;
    22372203            $e[$i] -= $carry << 4;
     
    31413107    public static function ge_mul_l(ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A)
    31423108    {
    3143         /** @var array<int, int> $aslide */
    31443109        $aslide = array(
    31453110            13, 0, 0, 0, 0, -1, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0,
Note: See TracChangeset for help on using the changeset viewer.