Make WordPress Core

Changeset 61419


Ignore:
Timestamp:
12/30/2025 10:53:23 PM (2 months ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Update sodium_compat to v1.24.0.

The latest version includes a security fix to ensure that the public key is on the prime order subgroup.

References:

Follow-up to [55699], [58752], [58753], [60787], [60905].

Props paragoninitiativeenterprises, johnbillion, SergeyBiryukov.
Fixes #64462.

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

Legend:

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

    r60905 r61419  
    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_Core_Curve25519_Ge_P3 $A
     114     * @return bool
     115     *
     116     * @throws SodiumException
     117     */
     118    public static function is_on_main_subgroup(ParagonIE_Sodium_Core_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(self::substr($pk, 0, 32));
    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
     
    288303        }
    289304        if ((self::chrToInt($sig[63]) & 240) && self::check_S_lt_L(self::substr($sig, 32, 32))) {
    290             throw new SodiumException('S < L - Invalid signature');
     305            throw new SodiumException('S >= L - Invalid signature');
    291306        }
    292307        if (self::small_order($sig)) {
     
    312327        /** @var ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A */
    313328        $A = self::ge_frombytes_negate_vartime($pk);
     329        if (!self::is_on_main_subgroup($A)) {
     330            throw new SodiumException('Public key is not on a member of the main subgroup');
     331        }
    314332
    315333        /** @var string $hDigest */
  • trunk/src/wp-includes/sodium_compat/src/File.php

    r60905 r61419  
    787787        ParagonIE_Sodium_Compat::$fastMult = true;
    788788
     789        if (ParagonIE_Sodium_Core_Ed25519::small_order($publicKey)) {
     790            throw new SodiumException('Public key has small order');
     791        }
    789792        /** @var ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A */
    790793        $A = ParagonIE_Sodium_Core_Ed25519::ge_frombytes_negate_vartime($publicKey);
     794        if (!ParagonIE_Sodium_Core_Ed25519::is_on_main_subgroup($A)) {
     795            throw new SodiumException('Public key is not on a member of the main subgroup');
     796        }
    791797
    792798        $hs = hash_init('sha512');
Note: See TracChangeset for help on using the changeset viewer.