WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/09/2019 04:44:58 PM (15 months ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Update sodium_compat to v1.12.1.

This includes a speedup for signature verification on most platforms and bugfixes for 32-bit platforms.

Props paragoninitiativeenterprises, lukaswaudentio.
Merges [46858] to the 5.3 branch.
Fixes #48371.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/sodium_compat/src/Core/XChaCha20.php

    r44953 r46859  
    4040     * @internal You should not use this directly from another application
    4141     *
     42     * @param int $len
     43     * @param string $nonce
     44     * @param string $key
     45     * @return string
     46     * @throws SodiumException
     47     * @throws TypeError
     48     */
     49    public static function ietfStream($len = 64, $nonce = '', $key = '')
     50    {
     51        if (self::strlen($nonce) !== 24) {
     52            throw new SodiumException('Nonce must be 24 bytes long');
     53        }
     54        return self::encryptBytes(
     55            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
     56                self::hChaCha20(
     57                    self::substr($nonce, 0, 16),
     58                    $key
     59                ),
     60                "\x00\x00\x00\x00" . self::substr($nonce, 16, 8)
     61            ),
     62            str_repeat("\x00", $len)
     63        );
     64    }
     65
     66    /**
     67     * @internal You should not use this directly from another application
     68     *
    4269     * @param string $message
    4370     * @param string $nonce
     
    6289        );
    6390    }
     91
     92    /**
     93     * @internal You should not use this directly from another application
     94     *
     95     * @param string $message
     96     * @param string $nonce
     97     * @param string $key
     98     * @param string $ic
     99     * @return string
     100     * @throws SodiumException
     101     * @throws TypeError
     102     */
     103    public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
     104    {
     105        if (self::strlen($nonce) !== 24) {
     106            throw new SodiumException('Nonce must be 24 bytes long');
     107        }
     108        return self::encryptBytes(
     109            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
     110                self::hChaCha20(self::substr($nonce, 0, 16), $key),
     111                "\x00\x00\x00\x00" . self::substr($nonce, 16, 8),
     112                $ic
     113            ),
     114            $message
     115        );
     116    }
    64117}
Note: See TracChangeset for help on using the changeset viewer.