Make WordPress Core

Changeset 63397


Ignore:
Timestamp:
08/29/2026 06:23:22 PM (7 days ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Update sodium_compat to v1.24.1.

The latest version includes a fix for Ed25519 main subgroup validation.

References:

Developed in https://github.com/WordPress/wordpress-develop/pull/13290.

Follow-up to r55699, r58752, r58753, r60787, r60905, r61419.

Props paragoninitiativeenterprises, wprashed, SergeyBiryukov.
Fixes #65903.

Location:
trunk/src/wp-includes/sodium_compat/src
Files:
5 edited

Legend:

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

    r60905 r63397  
    29002900                $t = self::ge_sub($u, $Ai[(int)(-$aslide[$i] / 2)]);
    29012901            }
     2902            $r = self::ge_p1p1_to_p3($t);
    29022903        }
    29032904
  • trunk/src/wp-includes/sodium_compat/src/Core/Ed25519.php

    r61419 r63397  
    120120        $p1 = self::ge_mul_l($A);
    121121        $t = self::fe_sub($p1->Y, $p1->Z);
    122         return self::fe_isnonzero($p1->X) && self::fe_isnonzero($t);
     122        return !self::fe_isnonzero($p1->X) && !self::fe_isnonzero($t);
    123123    }
    124124
  • trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519.php

    r52988 r63397  
    31553155                $t = self::ge_sub($u, $Ai[(int)(-$aslide[$i] / 2)]);
    31563156            }
     3157            $r = self::ge_p1p1_to_p3($t);
    31573158        }
    31583159        # ge_p1p1_to_p3(r, &t);
  • trunk/src/wp-includes/sodium_compat/src/Core32/Ed25519.php

    r54150 r63397  
    108108
    109109    /**
     110     * Returns TRUE if $A represents a point on the order of the Edwards25519 prime order subgroup.
     111     * Returns FALSE if $A is on a different subgroup.
     112     *
     113     * @param ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A
     114     * @return bool
     115     *
     116     * @throws SodiumException
     117     */
     118    public static function is_on_main_subgroup(ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A)
     119    {
     120        $p1 = self::ge_mul_l($A);
     121        $t = self::fe_sub($p1->Y, $p1->Z);
     122        return !self::fe_isnonzero($p1->X) && !self::fe_isnonzero($t);
     123    }
     124
     125    /**
    110126     * @param string $pk
    111127     * @return string
     
    119135        }
    120136        $A = self::ge_frombytes_negate_vartime($pk);
    121         $p1 = self::ge_mul_l($A);
    122         if (!self::fe_isnonzero($p1->X)) {
    123             throw new SodiumException('Unexpected zero result');
     137        if (!self::is_on_main_subgroup($A)) {
     138            throw new SodiumException('Public key is not on a member of the main subgroup');
    124139        }
    125140
     
    308323        /** @var ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A */
    309324        $A = self::ge_frombytes_negate_vartime($pk);
     325        if (!self::is_on_main_subgroup($A)) {
     326            throw new SodiumException('Public key is not on a member of the main subgroup');
     327        }
    310328
    311329        /** @var string $hDigest */
  • trunk/src/wp-includes/sodium_compat/src/File.php

    r61419 r63397  
    13301330        ParagonIE_Sodium_Compat::$fastMult = true;
    13311331
     1332        if (ParagonIE_Sodium_Core32_Ed25519::small_order($publicKey)) {
     1333            throw new SodiumException('Public key has small order');
     1334        }
    13321335        /** @var ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A */
    13331336        $A = ParagonIE_Sodium_Core32_Ed25519::ge_frombytes_negate_vartime($publicKey);
     1337        if (!ParagonIE_Sodium_Core32_Ed25519::is_on_main_subgroup($A)) {
     1338            throw new SodiumException('Public key is not on a member of the main subgroup');
     1339        }
    13341340
    13351341        $hs = hash_init('sha512');
Note: See TracChangeset for help on using the changeset viewer.