Make WordPress Core


Ignore:
Timestamp:
07/18/2024 12:58:40 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Update sodium_compat to v1.21.1.

The latest version of sodium_compat includes support for AEGIS and preliminary support for PHP 8.4.

Additionally, the PHP 8.2+ SensitiveParameter attribute is now applied where appropriate to functions in the public API. This attribute is used to mark parameters that are sensitive and should be redacted from stack traces.

References:

Follow-up to [49741], [51002], [51591], [52988], [54150], [54310], [55699].

Props jrf, dd32, paragoninitiativeenterprises.
Fixes #61686.

File:
1 edited

Legend:

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

    r54310 r58752  
    6060    const CRYPTO_AEAD_AES256GCM_NPUBBYTES = 12;
    6161    const CRYPTO_AEAD_AES256GCM_ABYTES = 16;
     62    const CRYPTO_AEAD_AEGIS128L_KEYBYTES = 16;
     63    const CRYPTO_AEAD_AEGIS128L_NSECBYTES = 0;
     64    const CRYPTO_AEAD_AEGIS128L_NPUBBYTES = 16;
     65    const CRYPTO_AEAD_AEGIS128L_ABYTES = 32;
     66    const CRYPTO_AEAD_AEGIS256_KEYBYTES = 32;
     67    const CRYPTO_AEAD_AEGIS256_NSECBYTES = 0;
     68    const CRYPTO_AEAD_AEGIS256_NPUBBYTES = 32;
     69    const CRYPTO_AEAD_AEGIS256_ABYTES = 32;
    6270    const CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES = 32;
    6371    const CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES = 0;
     
    156164     * @throws SodiumException
    157165     */
    158     public static function add(&$val, $addv)
    159     {
     166    public static function add(
     167        #[\SensitiveParameter]
     168        &$val,
     169        #[\SensitiveParameter]
     170        $addv
     171    ) {
    160172        $val_len = ParagonIE_Sodium_Core_Util::strlen($val);
    161173        $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv);
     
    182194     * @throws SodiumException
    183195     */
    184     public static function base642bin($encoded, $variant, $ignore = '')
    185     {
     196    public static function base642bin(
     197        #[\SensitiveParameter]
     198        $encoded,
     199        $variant,
     200        $ignore = ''
     201    ) {
    186202        /* Type checks: */
    187203        ParagonIE_Sodium_Core_Util::declareScalarType($encoded, 'string', 1);
     
    225241     * @throws SodiumException
    226242     */
    227     public static function bin2base64($decoded, $variant)
    228     {
     243    public static function bin2base64(
     244        #[\SensitiveParameter]
     245        $decoded,
     246        $variant
     247    ) {
    229248        /* Type checks: */
    230249        ParagonIE_Sodium_Core_Util::declareScalarType($decoded, 'string', 1);
     
    258277     * @psalm-suppress MixedArgument
    259278     */
    260     public static function bin2hex($string)
    261     {
     279    public static function bin2hex(
     280        #[\SensitiveParameter]
     281        $string
     282    ) {
    262283        /* Type checks: */
    263284        ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1);
     
    285306     * @psalm-suppress MixedArgument
    286307     */
    287     public static function compare($left, $right)
    288     {
     308    public static function compare(
     309        #[\SensitiveParameter]
     310        $left,
     311        #[\SensitiveParameter]
     312        $right
     313    ) {
    289314        /* Type checks: */
    290315        ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1);
     
    298323        }
    299324        return ParagonIE_Sodium_Core_Util::compare($left, $right);
     325    }
     326
     327    /**
     328     * Authenticated Encryption with Associated Data: Decryption
     329     *
     330     * Algorithm:
     331     *     AEGIS-128L
     332     *
     333     * @param string $ciphertext Encrypted message (with MAC appended)
     334     * @param string $assocData  Authenticated Associated Data (unencrypted)
     335     * @param string $nonce      Number to be used only Once; must be 32 bytes
     336     * @param string $key        Encryption key
     337     *
     338     * @return string            The original plaintext message
     339     * @throws SodiumException
     340     * @throws TypeError
     341     * @psalm-suppress MixedArgument
     342     * @psalm-suppress MixedInferredReturnType
     343     * @psalm-suppress MixedReturnStatement
     344     */
     345    public static function crypto_aead_aegis128l_decrypt(
     346        $ciphertext = '',
     347        $assocData = '',
     348        $nonce = '',
     349        #[\SensitiveParameter]
     350        $key = ''
     351    ) {
     352        ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
     353        ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
     354        ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 3);
     355        ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 4);
     356
     357        /* Input validation: */
     358        if (ParagonIE_Sodium_Core_Util::strlen($nonce) !== self::CRYPTO_AEAD_AEGIS128L_NPUBBYTES) {
     359            throw new SodiumException('Nonce must be CRYPTO_AEAD_AEGIS_128L_NPUBBYTES long');
     360        }
     361        if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_AEAD_AEGIS128L_KEYBYTES) {
     362            throw new SodiumException('Key must be CRYPTO_AEAD_AEGIS128L_KEYBYTES long');
     363        }
     364        $ct_length = ParagonIE_Sodium_Core_Util::strlen($ciphertext);
     365        if ($ct_length < self::CRYPTO_AEAD_AEGIS128L_ABYTES) {
     366            throw new SodiumException('Message must be at least CRYPTO_AEAD_AEGIS128L_ABYTES long');
     367        }
     368
     369        $ct = ParagonIE_Sodium_Core_Util::substr(
     370            $ciphertext,
     371            0,
     372            $ct_length - self::CRYPTO_AEAD_AEGIS128L_ABYTES
     373        );
     374        $tag = ParagonIE_Sodium_Core_Util::substr(
     375            $ciphertext,
     376            $ct_length - self::CRYPTO_AEAD_AEGIS128L_ABYTES,
     377            self::CRYPTO_AEAD_AEGIS128L_ABYTES
     378        );
     379        return ParagonIE_Sodium_Core_AEGIS128L::decrypt($ct, $tag, $assocData, $key, $nonce);
     380    }
     381
     382    /**
     383     * Authenticated Encryption with Associated Data: Encryption
     384     *
     385     * Algorithm:
     386     *     AEGIS-128L
     387     *
     388     * @param string $plaintext Message to be encrypted
     389     * @param string $assocData Authenticated Associated Data (unencrypted)
     390     * @param string $nonce     Number to be used only Once; must be 32 bytes
     391     * @param string $key       Encryption key
     392     *
     393     * @return string           Ciphertext with 32-byte authentication tag appended
     394     * @throws SodiumException
     395     * @throws TypeError
     396     * @psalm-suppress MixedArgument
     397     */
     398    public static function crypto_aead_aegis128l_encrypt(
     399        #[\SensitiveParameter]
     400        $plaintext = '',
     401        $assocData = '',
     402        $nonce = '',
     403        #[\SensitiveParameter]
     404        $key = ''
     405    ) {
     406        ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
     407        ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
     408        ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 3);
     409        ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 4);
     410
     411        /* Input validation: */
     412        if (ParagonIE_Sodium_Core_Util::strlen($nonce) !== self::CRYPTO_AEAD_AEGIS128L_NPUBBYTES) {
     413            throw new SodiumException('Nonce must be CRYPTO_AEAD_AEGIS128L_KEYBYTES long');
     414        }
     415        if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_AEAD_AEGIS128L_KEYBYTES) {
     416            throw new SodiumException('Key must be CRYPTO_AEAD_AEGIS128L_KEYBYTES long');
     417        }
     418
     419        list($ct, $tag) = ParagonIE_Sodium_Core_AEGIS128L::encrypt($plaintext, $assocData, $key, $nonce);
     420        return $ct . $tag;
     421    }
     422
     423    /**
     424     * Return a secure random key for use with the AEGIS-128L
     425     * symmetric AEAD interface.
     426     *
     427     * @return string
     428     * @throws Exception
     429     * @throws Error
     430     */
     431    public static function crypto_aead_aegis128l_keygen()
     432    {
     433        return random_bytes(self::CRYPTO_AEAD_AEGIS128L_KEYBYTES);
     434    }
     435
     436    /**
     437     * Authenticated Encryption with Associated Data: Decryption
     438     *
     439     * Algorithm:
     440     *     AEGIS-256
     441     *
     442     * @param string $ciphertext Encrypted message (with MAC appended)
     443     * @param string $assocData  Authenticated Associated Data (unencrypted)
     444     * @param string $nonce      Number to be used only Once; must be 32 bytes
     445     * @param string $key        Encryption key
     446     *
     447     * @return string            The original plaintext message
     448     * @throws SodiumException
     449     * @throws TypeError
     450     * @psalm-suppress MixedArgument
     451     * @psalm-suppress MixedInferredReturnType
     452     * @psalm-suppress MixedReturnStatement
     453     */
     454    public static function crypto_aead_aegis256_decrypt(
     455        $ciphertext = '',
     456        $assocData = '',
     457        $nonce = '',
     458        #[\SensitiveParameter]
     459        $key = ''
     460    ) {
     461        ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
     462        ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
     463        ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 3);
     464        ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 4);
     465
     466        /* Input validation: */
     467        if (ParagonIE_Sodium_Core_Util::strlen($nonce) !== self::CRYPTO_AEAD_AEGIS256_NPUBBYTES) {
     468            throw new SodiumException('Nonce must be CRYPTO_AEAD_AEGIS256_NPUBBYTES long');
     469        }
     470        if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_AEAD_AEGIS256_KEYBYTES) {
     471            throw new SodiumException('Key must be CRYPTO_AEAD_AEGIS256_KEYBYTES long');
     472        }
     473        $ct_length = ParagonIE_Sodium_Core_Util::strlen($ciphertext);
     474        if ($ct_length < self::CRYPTO_AEAD_AEGIS256_ABYTES) {
     475            throw new SodiumException('Message must be at least CRYPTO_AEAD_AEGIS256_ABYTES long');
     476        }
     477
     478        $ct = ParagonIE_Sodium_Core_Util::substr(
     479            $ciphertext,
     480            0,
     481            $ct_length - self::CRYPTO_AEAD_AEGIS256_ABYTES
     482        );
     483        $tag = ParagonIE_Sodium_Core_Util::substr(
     484            $ciphertext,
     485            $ct_length - self::CRYPTO_AEAD_AEGIS256_ABYTES,
     486            self::CRYPTO_AEAD_AEGIS256_ABYTES
     487        );
     488        return ParagonIE_Sodium_Core_AEGIS256::decrypt($ct, $tag, $assocData, $key, $nonce);
     489    }
     490
     491    /**
     492     * Authenticated Encryption with Associated Data: Encryption
     493     *
     494     * Algorithm:
     495     *     AEGIS-256
     496     *
     497     * @param string $plaintext Message to be encrypted
     498     * @param string $assocData Authenticated Associated Data (unencrypted)
     499     * @param string $nonce Number to be used only Once; must be 32 bytes
     500     * @param string $key Encryption key
     501     *
     502     * @return string           Ciphertext with 32-byte authentication tag appended
     503     * @throws SodiumException
     504     * @throws TypeError
     505     * @psalm-suppress MixedArgument
     506     */
     507    public static function crypto_aead_aegis256_encrypt(
     508        #[\SensitiveParameter]
     509        $plaintext = '',
     510        $assocData = '',
     511        $nonce = '',
     512        #[\SensitiveParameter]
     513        $key = ''
     514    ) {
     515        ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
     516        ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
     517        ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 3);
     518        ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 4);
     519
     520        /* Input validation: */
     521        if (ParagonIE_Sodium_Core_Util::strlen($nonce) !== self::CRYPTO_AEAD_AEGIS256_NPUBBYTES) {
     522            throw new SodiumException('Nonce must be CRYPTO_AEAD_AEGIS128L_KEYBYTES long');
     523        }
     524        if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_AEAD_AEGIS256_KEYBYTES) {
     525            throw new SodiumException('Key must be CRYPTO_AEAD_AEGIS128L_KEYBYTES long');
     526        }
     527
     528        list($ct, $tag) = ParagonIE_Sodium_Core_AEGIS256::encrypt($plaintext, $assocData, $key, $nonce);
     529        return $ct . $tag;
     530    }
     531
     532    /**
     533     * Return a secure random key for use with the AEGIS-256
     534     * symmetric AEAD interface.
     535     *
     536     * @return string
     537     * @throws Exception
     538     * @throws Error
     539     */
     540    public static function crypto_aead_aegis256_keygen()
     541    {
     542        return random_bytes(self::CRYPTO_AEAD_AEGIS256_KEYBYTES);
    300543    }
    301544
     
    352595        $assocData = '',
    353596        $nonce = '',
     597        #[\SensitiveParameter]
    354598        $key = ''
    355599    ) {
     
    409653     */
    410654    public static function crypto_aead_aes256gcm_encrypt(
     655        #[\SensitiveParameter]
    411656        $plaintext = '',
    412657        $assocData = '',
    413658        $nonce = '',
     659        #[\SensitiveParameter]
    414660        $key = ''
    415661    ) {
     
    485731        $assocData = '',
    486732        $nonce = '',
     733        #[\SensitiveParameter]
    487734        $key = ''
    488735    ) {
     
    562809     */
    563810    public static function crypto_aead_chacha20poly1305_encrypt(
     811        #[\SensitiveParameter]
    564812        $plaintext = '',
    565813        $assocData = '',
    566814        $nonce = '',
     815        #[\SensitiveParameter]
    567816        $key = ''
    568817    ) {
     
    639888        $assocData = '',
    640889        $nonce = '',
     890        #[\SensitiveParameter]
    641891        $key = ''
    642892    ) {
     
    729979     */
    730980    public static function crypto_aead_chacha20poly1305_ietf_encrypt(
     981        #[\SensitiveParameter]
    731982        $plaintext = '',
    732983        $assocData = '',
    733984        $nonce = '',
     985        #[\SensitiveParameter]
    734986        $key = ''
    735987    ) {
     
    8201072        $assocData = '',
    8211073        $nonce = '',
     1074        #[\SensitiveParameter]
    8221075        $key = '',
    8231076        $dontFallback = false
     
    8921145     */
    8931146    public static function crypto_aead_xchacha20poly1305_ietf_encrypt(
     1147        #[\SensitiveParameter]
    8941148        $plaintext = '',
    8951149        $assocData = '',
    8961150        $nonce = '',
     1151        #[\SensitiveParameter]
    8971152        $key = '',
    8981153        $dontFallback = false
     
    9721227     * @psalm-suppress MixedArgument
    9731228     */
    974     public static function crypto_auth($message, $key)
    975     {
     1229    public static function crypto_auth(
     1230        $message,
     1231        #[\SensitiveParameter]
     1232        $key
     1233    ) {
    9761234        /* Type checks: */
    9771235        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    10171275     * @psalm-suppress MixedArgument
    10181276     */
    1019     public static function crypto_auth_verify($mac, $message, $key)
    1020     {
     1277    public static function crypto_auth_verify(
     1278        $mac,
     1279        $message,
     1280        #[\SensitiveParameter]
     1281        $key
     1282    ) {
    10211283        /* Type checks: */
    10221284        ParagonIE_Sodium_Core_Util::declareScalarType($mac, 'string', 1);
     
    10611323     * @psalm-suppress MixedArgument
    10621324     */
    1063     public static function crypto_box($plaintext, $nonce, $keypair)
    1064     {
     1325    public static function crypto_box(
     1326        $plaintext,
     1327        $nonce,
     1328        #[\SensitiveParameter]
     1329        $keypair
     1330    ) {
    10651331        /* Type checks: */
    10661332        ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
     
    11051371     * @psalm-suppress MixedArgument
    11061372     */
    1107     public static function crypto_box_seal($plaintext, $publicKey)
    1108     {
     1373    public static function crypto_box_seal(
     1374        #[\SensitiveParameter]
     1375        $plaintext,
     1376        $publicKey
     1377    ) {
    11091378        /* Type checks: */
    11101379        ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
     
    11431412     * @psalm-suppress MixedReturnStatement
    11441413     */
    1145     public static function crypto_box_seal_open($ciphertext, $keypair)
    1146     {
     1414    public static function crypto_box_seal_open(
     1415        $ciphertext,
     1416        #[\SensitiveParameter]
     1417        $keypair
     1418    ) {
    11471419        /* Type checks: */
    11481420        ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
     
    12061478     * @psalm-suppress MixedArgument
    12071479     */
    1208     public static function crypto_box_keypair_from_secretkey_and_publickey($secretKey, $publicKey)
    1209     {
     1480    public static function crypto_box_keypair_from_secretkey_and_publickey(
     1481        #[\SensitiveParameter]
     1482        $secretKey,
     1483        $publicKey
     1484    ) {
    12101485        /* Type checks: */
    12111486        ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1);
     
    12451520     * @psalm-suppress MixedReturnStatement
    12461521     */
    1247     public static function crypto_box_open($ciphertext, $nonce, $keypair)
    1248     {
     1522    public static function crypto_box_open(
     1523        $ciphertext,
     1524        $nonce,
     1525        #[\SensitiveParameter]
     1526        $keypair
     1527    ) {
    12491528        /* Type checks: */
    12501529        ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
     
    12881567     * @psalm-suppress MixedArgument
    12891568     */
    1290     public static function crypto_box_publickey($keypair)
    1291     {
     1569    public static function crypto_box_publickey(
     1570        #[\SensitiveParameter]
     1571        $keypair
     1572    ) {
    12921573        /* Type checks: */
    12931574        ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
     
    13191600     * @psalm-suppress MixedArgument
    13201601     */
    1321     public static function crypto_box_publickey_from_secretkey($secretKey)
    1322     {
     1602    public static function crypto_box_publickey_from_secretkey(
     1603        #[\SensitiveParameter]
     1604        $secretKey
     1605    ) {
    13231606        /* Type checks: */
    13241607        ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1);
     
    13501633     * @psalm-suppress MixedArgument
    13511634     */
    1352     public static function crypto_box_secretkey($keypair)
    1353     {
     1635    public static function crypto_box_secretkey(
     1636        #[\SensitiveParameter]
     1637        $keypair
     1638    ) {
    13541639        /* Type checks: */
    13551640        ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
     
    13821667     * @psalm-suppress UndefinedFunction
    13831668     */
    1384     public static function crypto_box_seed_keypair($seed)
    1385     {
     1669    public static function crypto_box_seed_keypair(
     1670        #[\SensitiveParameter]
     1671        $seed
     1672    ) {
    13861673        /* Type checks: */
    13871674        ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1);
     
    14121699     * @psalm-suppress MixedArgument
    14131700     */
    1414     public static function crypto_generichash($message, $key = '', $length = self::CRYPTO_GENERICHASH_BYTES)
    1415     {
     1701    public static function crypto_generichash(
     1702        $message,
     1703        #[\SensitiveParameter]
     1704        $key = '',
     1705        $length = self::CRYPTO_GENERICHASH_BYTES
     1706    ) {
    14161707        /* Type checks: */
    14171708        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    14561747     * @psalm-suppress ConflictingReferenceConstraint
    14571748     */
    1458     public static function crypto_generichash_final(&$ctx, $length = self::CRYPTO_GENERICHASH_BYTES)
    1459     {
     1749    public static function crypto_generichash_final(
     1750        #[\SensitiveParameter]
     1751        &$ctx,
     1752        $length = self::CRYPTO_GENERICHASH_BYTES
     1753    ) {
    14601754        /* Type checks: */
    14611755        ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1);
     
    15011795     * @psalm-suppress MixedArgument
    15021796     */
    1503     public static function crypto_generichash_init($key = '', $length = self::CRYPTO_GENERICHASH_BYTES)
    1504     {
     1797    public static function crypto_generichash_init(
     1798        #[\SensitiveParameter]
     1799        $key = '',
     1800        $length = self::CRYPTO_GENERICHASH_BYTES
     1801    ) {
    15051802        /* Type checks: */
    15061803        if (is_null($key)) {
     
    15461843     */
    15471844    public static function crypto_generichash_init_salt_personal(
     1845        #[\SensitiveParameter]
    15481846        $key = '',
    15491847        $length = self::CRYPTO_GENERICHASH_BYTES,
     
    15921890     * @psalm-suppress ReferenceConstraintViolation
    15931891     */
    1594     public static function crypto_generichash_update(&$ctx, $message)
    1595     {
     1892    public static function crypto_generichash_update(
     1893        #[\SensitiveParameter]
     1894        &$ctx,
     1895        $message
     1896    ) {
    15961897        /* Type checks: */
    15971898        ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1);
     
    16361937        $subkey_id,
    16371938        $context,
     1939        #[\SensitiveParameter]
    16381940        $key
    16391941    ) {
     
    17132015     * @psalm-suppress MixedArgument
    17142016     */
    1715     public static function crypto_kx($my_secret, $their_public, $client_public, $server_public, $dontFallback = false)
    1716     {
     2017    public static function crypto_kx(
     2018        #[\SensitiveParameter]
     2019        $my_secret,
     2020        $their_public,
     2021        $client_public,
     2022        $server_public,
     2023        $dontFallback = false
     2024    ) {
    17172025        /* Type checks: */
    17182026        ParagonIE_Sodium_Core_Util::declareScalarType($my_secret, 'string', 1);
     
    17752083     * @throws SodiumException
    17762084     */
    1777     public static function crypto_kx_seed_keypair($seed)
    1778     {
     2085    public static function crypto_kx_seed_keypair(
     2086        #[\SensitiveParameter]
     2087        $seed
     2088    ) {
    17792089        ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1);
    17802090
     
    18072117     * @throws SodiumException
    18082118     */
    1809     public static function crypto_kx_client_session_keys($keypair, $serverPublicKey)
    1810     {
     2119    public static function crypto_kx_client_session_keys(
     2120        #[\SensitiveParameter]
     2121        $keypair,
     2122        $serverPublicKey
     2123    ) {
    18112124        ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
    18122125        ParagonIE_Sodium_Core_Util::declareScalarType($serverPublicKey, 'string', 2);
     
    18492162     * @throws SodiumException
    18502163     */
    1851     public static function crypto_kx_server_session_keys($keypair, $clientPublicKey)
    1852     {
     2164    public static function crypto_kx_server_session_keys(
     2165        #[\SensitiveParameter]
     2166        $keypair,
     2167        $clientPublicKey
     2168    ) {
    18532169        ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
    18542170        ParagonIE_Sodium_Core_Util::declareScalarType($clientPublicKey, 'string', 2);
     
    18902206     * @throws SodiumException
    18912207     */
    1892     public static function crypto_kx_secretkey($kp)
    1893     {
     2208    public static function crypto_kx_secretkey(
     2209        #[\SensitiveParameter]
     2210        $kp
     2211    ) {
    18942212        return ParagonIE_Sodium_Core_Util::substr(
    18952213            $kp,
     
    19252243     * @psalm-suppress MixedArgument
    19262244     */
    1927     public static function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $alg = null)
    1928     {
     2245    public static function crypto_pwhash(
     2246        $outlen,
     2247        #[\SensitiveParameter]
     2248        $passwd,
     2249        $salt,
     2250        $opslimit,
     2251        $memlimit,
     2252        $alg = null
     2253    ) {
    19292254        ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1);
    19302255        ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2);
     
    19772302     * @psalm-suppress MixedArgument
    19782303     */
    1979     public static function crypto_pwhash_str($passwd, $opslimit, $memlimit)
    1980     {
     2304    public static function crypto_pwhash_str(
     2305        #[\SensitiveParameter]
     2306        $passwd,
     2307        $opslimit,
     2308        $memlimit
     2309    ) {
    19812310        ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1);
    19822311        ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2);
     
    20042333     * @throws SodiumException
    20052334     */
    2006     public static function crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit)
    2007     {
     2335    public static function crypto_pwhash_str_needs_rehash(
     2336        #[\SensitiveParameter]
     2337        $hash,
     2338        $opslimit,
     2339        $memlimit
     2340    ) {
    20082341        ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 1);
    20092342        ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2);
     
    20332366     * @psalm-suppress MixedArgument
    20342367     */
    2035     public static function crypto_pwhash_str_verify($passwd, $hash)
    2036     {
     2368    public static function crypto_pwhash_str_verify(
     2369        #[\SensitiveParameter]
     2370        $passwd,
     2371        #[\SensitiveParameter]
     2372        $hash
     2373    ) {
    20372374        ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1);
    20382375        ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 2);
     
    20602397     * @throws TypeError
    20612398     */
    2062     public static function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit)
    2063     {
     2399    public static function crypto_pwhash_scryptsalsa208sha256(
     2400        $outlen,
     2401        #[\SensitiveParameter]
     2402        $passwd,
     2403        $salt,
     2404        $opslimit,
     2405        $memlimit
     2406    ) {
    20642407        ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1);
    20652408        ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2);
     
    21202463     * @throws TypeError
    21212464     */
    2122     public static function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit)
    2123     {
     2465    public static function crypto_pwhash_scryptsalsa208sha256_str(
     2466        #[\SensitiveParameter]
     2467        $passwd,
     2468        $opslimit,
     2469        $memlimit
     2470    ) {
    21242471        ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1);
    21252472        ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2);
     
    21542501     * @throws TypeError
    21552502     */
    2156     public static function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash)
    2157     {
     2503    public static function crypto_pwhash_scryptsalsa208sha256_str_verify(
     2504        #[\SensitiveParameter]
     2505        $passwd,
     2506        #[\SensitiveParameter]
     2507        $hash
     2508    ) {
    21582509        ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1);
    21592510        ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 2);
     
    21912542     * @psalm-suppress MixedArgument
    21922543     */
    2193     public static function crypto_scalarmult($secretKey, $publicKey)
    2194     {
     2544    public static function crypto_scalarmult(
     2545        #[\SensitiveParameter]
     2546        $secretKey,
     2547        $publicKey
     2548    ) {
    21952549        /* Type checks: */
    21962550        ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1);
     
    22352589     * @psalm-suppress MixedArgument
    22362590     */
    2237     public static function crypto_scalarmult_base($secretKey)
    2238     {
     2591    public static function crypto_scalarmult_base(
     2592        #[\SensitiveParameter]
     2593        $secretKey
     2594    ) {
    22392595        /* Type checks: */
    22402596        ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1);
     
    22732629     * @psalm-suppress MixedArgument
    22742630     */
    2275     public static function crypto_secretbox($plaintext, $nonce, $key)
    2276     {
     2631    public static function crypto_secretbox(
     2632        #[\SensitiveParameter]
     2633        $plaintext,
     2634        $nonce,
     2635        #[\SensitiveParameter]
     2636        $key
     2637    ) {
    22772638        /* Type checks: */
    22782639        ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
     
    23132674     * @psalm-suppress MixedReturnStatement
    23142675     */
    2315     public static function crypto_secretbox_open($ciphertext, $nonce, $key)
    2316     {
     2676    public static function crypto_secretbox_open(
     2677        $ciphertext,
     2678        $nonce,
     2679        #[\SensitiveParameter]
     2680        $key
     2681    ) {
    23172682        /* Type checks: */
    23182683        ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
     
    23992764     * @psalm-suppress MixedArgument
    24002765     */
    2401     public static function crypto_secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key)
    2402     {
     2766    public static function crypto_secretbox_xchacha20poly1305_open(
     2767        $ciphertext,
     2768        $nonce,
     2769        #[\SensitiveParameter]
     2770        $key
     2771    ) {
    24032772        /* Type checks: */
    24042773        ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
     
    24262795     * @throws SodiumException
    24272796     */
    2428     public static function crypto_secretstream_xchacha20poly1305_init_push($key)
    2429     {
     2797    public static function crypto_secretstream_xchacha20poly1305_init_push(
     2798        #[\SensitiveParameter]
     2799        $key
     2800    ) {
    24302801        if (PHP_INT_SIZE === 4) {
    24312802            return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_init_push($key);
     
    24402811     * @throws Exception
    24412812     */
    2442     public static function crypto_secretstream_xchacha20poly1305_init_pull($header, $key)
    2443     {
     2813    public static function crypto_secretstream_xchacha20poly1305_init_pull(
     2814        $header,
     2815        #[\SensitiveParameter]
     2816        $key
     2817    ) {
    24442818        if (ParagonIE_Sodium_Core_Util::strlen($header) < self::CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES) {
    24452819            throw new SodiumException(
     
    24612835     * @throws SodiumException
    24622836     */
    2463     public static function crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0)
    2464     {
     2837    public static function crypto_secretstream_xchacha20poly1305_push(
     2838        #[\SensitiveParameter]
     2839        &$state,
     2840        #[\SensitiveParameter]
     2841        $msg,
     2842        $aad = '',
     2843        $tag = 0
     2844    ) {
    24652845        if (PHP_INT_SIZE === 4) {
    24662846            return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_push(
     
    24862866     * @throws SodiumException
    24872867     */
    2488     public static function crypto_secretstream_xchacha20poly1305_pull(&$state, $msg, $aad = '')
    2489     {
     2868    public static function crypto_secretstream_xchacha20poly1305_pull(
     2869        #[\SensitiveParameter]
     2870        &$state,
     2871        $msg,
     2872        $aad = ''
     2873    ) {
    24902874        if (PHP_INT_SIZE === 4) {
    24912875            return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_pull(
     
    25162900     * @throws SodiumException
    25172901     */
    2518     public static function crypto_secretstream_xchacha20poly1305_rekey(&$state)
    2519     {
     2902    public static function crypto_secretstream_xchacha20poly1305_rekey(
     2903        #[\SensitiveParameter]
     2904        &$state
     2905    ) {
    25202906        if (PHP_INT_SIZE === 4) {
    25212907            ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_rekey($state);
     
    25372923     * @psalm-suppress MixedReturnStatement
    25382924     */
    2539     public static function crypto_shorthash($message, $key)
    2540     {
     2925    public static function crypto_shorthash(
     2926        $message,
     2927        #[\SensitiveParameter]
     2928        $key
     2929    ) {
    25412930        /* Type checks: */
    25422931        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    25872976     * @psalm-suppress MixedReturnStatement
    25882977     */
    2589     public static function crypto_sign($message, $secretKey)
    2590     {
     2978    public static function crypto_sign(
     2979        $message,
     2980        #[\SensitiveParameter]
     2981        $secretKey
     2982    ) {
    25912983        /* Type checks: */
    25922984        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    26233015     * @psalm-suppress MixedReturnStatement
    26243016     */
    2625     public static function crypto_sign_open($signedMessage, $publicKey)
    2626     {
     3017    public static function crypto_sign_open(
     3018        $signedMessage,
     3019        $publicKey
     3020    ) {
    26273021        /* Type checks: */
    26283022        ParagonIE_Sodium_Core_Util::declareScalarType($signedMessage, 'string', 1);
     
    26803074     * @throws SodiumException
    26813075     */
    2682     public static function crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk)
    2683     {
     3076    public static function crypto_sign_keypair_from_secretkey_and_publickey(
     3077        #[\SensitiveParameter]
     3078        $sk,
     3079        $pk
     3080    )  {
    26843081        ParagonIE_Sodium_Core_Util::declareScalarType($sk, 'string', 1);
    26853082        ParagonIE_Sodium_Core_Util::declareScalarType($pk, 'string', 1);
     
    27093106     * @psalm-suppress MixedArgument
    27103107     */
    2711     public static function crypto_sign_seed_keypair($seed)
    2712     {
     3108    public static function crypto_sign_seed_keypair(
     3109        #[\SensitiveParameter]
     3110        $seed
     3111    ) {
    27133112        ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1);
    27143113
     
    27383137     * @psalm-suppress MixedArgument
    27393138     */
    2740     public static function crypto_sign_publickey($keypair)
    2741     {
     3139    public static function crypto_sign_publickey(
     3140        #[\SensitiveParameter]
     3141        $keypair
     3142    ) {
    27423143        /* Type checks: */
    27433144        ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
     
    27693170     * @psalm-suppress MixedArgument
    27703171     */
    2771     public static function crypto_sign_publickey_from_secretkey($secretKey)
    2772     {
     3172    public static function crypto_sign_publickey_from_secretkey(
     3173        #[\SensitiveParameter]
     3174        $secretKey
     3175    ) {
    27733176        /* Type checks: */
    27743177        ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1);
     
    28003203     * @psalm-suppress MixedArgument
    28013204     */
    2802     public static function crypto_sign_secretkey($keypair)
    2803     {
     3205    public static function crypto_sign_secretkey(
     3206        #[\SensitiveParameter]
     3207        $keypair
     3208    ) {
    28043209        /* Type checks: */
    28053210        ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
     
    28343239     * @psalm-suppress MixedArgument
    28353240     */
    2836     public static function crypto_sign_detached($message, $secretKey)
    2837     {
     3241    public static function crypto_sign_detached(
     3242        $message,
     3243        #[\SensitiveParameter]
     3244        $secretKey
     3245    ) {
    28383246        /* Type checks: */
    28393247        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    29423350     * @psalm-suppress MixedArgument
    29433351     */
    2944     public static function crypto_sign_ed25519_sk_to_curve25519($sk)
    2945     {
     3352    public static function crypto_sign_ed25519_sk_to_curve25519(
     3353        #[\SensitiveParameter]
     3354        $sk
     3355    ) {
    29463356        /* Type checks: */
    29473357        ParagonIE_Sodium_Core_Util::declareScalarType($sk, 'string', 1);
     
    29843394     * @psalm-suppress MixedArgument
    29853395     */
    2986     public static function crypto_stream($len, $nonce, $key)
    2987     {
     3396    public static function crypto_stream(
     3397        $len,
     3398        $nonce,
     3399        #[\SensitiveParameter]
     3400        $key
     3401    ) {
    29883402        /* Type checks: */
    29893403        ParagonIE_Sodium_Core_Util::declareScalarType($len, 'int', 1);
     
    30313445     * @psalm-suppress MixedArgument
    30323446     */
    3033     public static function crypto_stream_xor($message, $nonce, $key)
    3034     {
     3447    public static function crypto_stream_xor(
     3448        #[\SensitiveParameter]
     3449        $message,
     3450        $nonce,
     3451        #[\SensitiveParameter]
     3452        $key
     3453    ) {
    30353454        /* Type checks: */
    30363455        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    30863505     * @psalm-suppress MixedArgument
    30873506     */
    3088     public static function crypto_stream_xchacha20($len, $nonce, $key, $dontFallback = false)
    3089     {
     3507    public static function crypto_stream_xchacha20(
     3508        $len,
     3509        $nonce,
     3510        #[\SensitiveParameter]
     3511        $key,
     3512        $dontFallback = false
     3513    ) {
    30903514        /* Type checks: */
    30913515        ParagonIE_Sodium_Core_Util::declareScalarType($len, 'int', 1);
     
    31313555     * @psalm-suppress MixedArgument
    31323556     */
    3133     public static function crypto_stream_xchacha20_xor($message, $nonce, $key, $dontFallback = false)
    3134     {
     3557    public static function crypto_stream_xchacha20_xor(
     3558        #[\SensitiveParameter]
     3559        $message,
     3560        $nonce,
     3561        #[\SensitiveParameter]
     3562        $key,
     3563        $dontFallback = false
     3564    ) {
    31353565        /* Type checks: */
    31363566        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    31773607     * @psalm-suppress MixedArgument
    31783608     */
    3179     public static function crypto_stream_xchacha20_xor_ic($message, $nonce, $counter, $key, $dontFallback = false)
    3180     {
     3609    public static function crypto_stream_xchacha20_xor_ic(
     3610        #[\SensitiveParameter]
     3611        $message,
     3612        $nonce,
     3613        $counter,
     3614        #[\SensitiveParameter]
     3615        $key,
     3616        $dontFallback = false
     3617    ) {
    31813618        /* Type checks: */
    31823619        ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
     
    32273664     * @psalm-suppress MixedArgument
    32283665     */
    3229     public static function hex2bin($string, $ignore = '')
    3230     {
     3666    public static function hex2bin(
     3667        #[\SensitiveParameter]
     3668        $string,
     3669        $ignore = ''
     3670    ) {
    32313671        /* Type checks: */
    32323672        ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1);
     
    32543694     * @psalm-suppress MixedArgument
    32553695     */
    3256     public static function increment(&$var)
    3257     {
     3696    public static function increment(
     3697        #[\SensitiveParameter]
     3698        &$var
     3699    ) {
    32583700        /* Type checks: */
    32593701        ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1);
     
    32883730     * @throws SodiumException
    32893731     */
    3290     public static function is_zero($str)
    3291     {
     3732    public static function is_zero(
     3733        #[\SensitiveParameter]
     3734        $str
     3735    ) {
    32923736        $d = 0;
    32933737        for ($i = 0; $i < 32; ++$i) {
     
    33433787     * @psalm-suppress MixedArgument
    33443788     */
    3345     public static function memcmp($left, $right)
    3346     {
     3789    public static function memcmp(
     3790        #[\SensitiveParameter]
     3791        $left,
     3792        #[\SensitiveParameter]
     3793        $right
     3794    ) {
    33473795        /* Type checks: */
    33483796        ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1);
     
    33723820     * @psalm-suppress TooFewArguments
    33733821     */
    3374     public static function memzero(&$var)
    3375     {
     3822    public static function memzero(
     3823        #[\SensitiveParameter]
     3824        &$var
     3825    ) {
    33763826        /* Type checks: */
    33773827        ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1);
     
    34033853     * @throws SodiumException
    34043854     */
    3405     public static function pad($unpadded, $blockSize, $dontFallback = false)
    3406     {
     3855    public static function pad(
     3856        #[\SensitiveParameter]
     3857        $unpadded,
     3858        $blockSize,
     3859        $dontFallback = false
     3860    ) {
    34073861        /* Type checks: */
    34083862        ParagonIE_Sodium_Core_Util::declareScalarType($unpadded, 'string', 1);
     
    34893943     * @throws SodiumException
    34903944     */
    3491     public static function unpad($padded, $blockSize, $dontFallback = false)
    3492     {
     3945    public static function unpad(
     3946        #[\SensitiveParameter]
     3947        $padded,
     3948        $blockSize,
     3949        $dontFallback = false
     3950    ) {
    34933951        /* Type checks: */
    34943952        ParagonIE_Sodium_Core_Util::declareScalarType($padded, 'string', 1);
     
    36444102     * @throws SodiumException
    36454103     */
    3646     public static function ristretto255_is_valid_point($p, $dontFallback = false)
    3647     {
     4104    public static function ristretto255_is_valid_point(
     4105        #[\SensitiveParameter]
     4106        $p,
     4107        $dontFallback = false
     4108    ) {
    36484109        if (self::useNewSodiumAPI() && !$dontFallback) {
    36494110            return sodium_crypto_core_ristretto255_is_valid_point($p);
     
    36684129     * @throws SodiumException
    36694130     */
    3670     public static function ristretto255_add($p, $q, $dontFallback = false)
    3671     {
     4131    public static function ristretto255_add(
     4132        #[\SensitiveParameter]
     4133        $p,
     4134        #[\SensitiveParameter]
     4135        $q,
     4136        $dontFallback = false
     4137    ) {
    36724138        if (self::useNewSodiumAPI() && !$dontFallback) {
    36734139            return sodium_crypto_core_ristretto255_add($p, $q);
     
    36834149     * @throws SodiumException
    36844150     */
    3685     public static function ristretto255_sub($p, $q, $dontFallback = false)
    3686     {
     4151    public static function ristretto255_sub(
     4152        #[\SensitiveParameter]
     4153        $p,
     4154        #[\SensitiveParameter]
     4155        $q,
     4156        $dontFallback = false
     4157    ) {
    36874158        if (self::useNewSodiumAPI() && !$dontFallback) {
    36884159            return sodium_crypto_core_ristretto255_sub($p, $q);
     
    36984169     * @throws SodiumException
    36994170     */
    3700     public static function ristretto255_from_hash($r, $dontFallback = false)
    3701     {
     4171    public static function ristretto255_from_hash(
     4172        #[\SensitiveParameter]
     4173        $r,
     4174        $dontFallback = false
     4175    ) {
    37024176        if (self::useNewSodiumAPI() && !$dontFallback) {
    37034177            return sodium_crypto_core_ristretto255_from_hash($r);
     
    37404214     * @throws SodiumException
    37414215     */
    3742     public static function ristretto255_scalar_invert($s, $dontFallback = false)
    3743     {
     4216    public static function ristretto255_scalar_invert(
     4217        #[\SensitiveParameter]
     4218        $s,
     4219        $dontFallback = false
     4220    ) {
    37444221        if (self::useNewSodiumAPI() && !$dontFallback) {
    37454222            return sodium_crypto_core_ristretto255_scalar_invert($s);
     
    37534230     * @throws SodiumException
    37544231     */
    3755     public static function ristretto255_scalar_negate($s, $dontFallback = false)
    3756     {
     4232    public static function ristretto255_scalar_negate(
     4233        #[\SensitiveParameter]
     4234        $s,
     4235        $dontFallback = false
     4236    ) {
    37574237        if (self::useNewSodiumAPI() && !$dontFallback) {
    37584238            return sodium_crypto_core_ristretto255_scalar_negate($s);
     
    37674247     * @throws SodiumException
    37684248     */
    3769     public static function ristretto255_scalar_complement($s, $dontFallback = false)
    3770     {
     4249    public static function ristretto255_scalar_complement(
     4250        #[\SensitiveParameter]
     4251        $s,
     4252        $dontFallback = false
     4253    ) {
    37714254        if (self::useNewSodiumAPI() && !$dontFallback) {
    37724255            return sodium_crypto_core_ristretto255_scalar_complement($s);
     
    37824265     * @throws SodiumException
    37834266     */
    3784     public static function ristretto255_scalar_add($x, $y, $dontFallback = false)
    3785     {
     4267    public static function ristretto255_scalar_add(
     4268        #[\SensitiveParameter]
     4269        $x,
     4270        #[\SensitiveParameter]
     4271        $y,
     4272        $dontFallback = false
     4273    ) {
    37864274        if (self::useNewSodiumAPI() && !$dontFallback) {
    37874275            return sodium_crypto_core_ristretto255_scalar_add($x, $y);
     
    37974285     * @throws SodiumException
    37984286     */
    3799     public static function ristretto255_scalar_sub($x, $y, $dontFallback = false)
    3800     {
     4287    public static function ristretto255_scalar_sub(
     4288        #[\SensitiveParameter]
     4289        $x,
     4290        #[\SensitiveParameter]
     4291        $y,
     4292        $dontFallback = false
     4293    ) {
    38014294        if (self::useNewSodiumAPI() && !$dontFallback) {
    38024295            return sodium_crypto_core_ristretto255_scalar_sub($x, $y);
     
    38124305     * @throws SodiumException
    38134306     */
    3814     public static function ristretto255_scalar_mul($x, $y, $dontFallback = false)
    3815     {
     4307    public static function ristretto255_scalar_mul(
     4308        #[\SensitiveParameter]
     4309        $x,
     4310        #[\SensitiveParameter]
     4311        $y,
     4312        $dontFallback = false
     4313    ) {
    38164314        if (self::useNewSodiumAPI() && !$dontFallback) {
    38174315            return sodium_crypto_core_ristretto255_scalar_mul($x, $y);
     
    38274325     * @throws SodiumException
    38284326     */
    3829     public static function scalarmult_ristretto255($n, $p, $dontFallback = false)
    3830     {
     4327    public static function scalarmult_ristretto255(
     4328        #[\SensitiveParameter]
     4329        $n,
     4330        #[\SensitiveParameter]
     4331        $p,
     4332        $dontFallback = false
     4333    ) {
    38314334        if (self::useNewSodiumAPI() && !$dontFallback) {
    38324335            return sodium_crypto_scalarmult_ristretto255($n, $p);
     
    38424345     * @throws SodiumException
    38434346     */
    3844     public static function scalarmult_ristretto255_base($n, $dontFallback = false)
    3845     {
     4347    public static function scalarmult_ristretto255_base(
     4348        #[\SensitiveParameter]
     4349        $n,
     4350        $dontFallback = false
     4351    ) {
    38464352        if (self::useNewSodiumAPI() && !$dontFallback) {
    38474353            return sodium_crypto_scalarmult_ristretto255_base($n);
     
    38564362     * @throws SodiumException
    38574363     */
    3858     public static function ristretto255_scalar_reduce($s, $dontFallback = false)
    3859     {
     4364    public static function ristretto255_scalar_reduce(
     4365        #[\SensitiveParameter]
     4366        $s,
     4367        $dontFallback = false
     4368    ) {
    38604369        if (self::useNewSodiumAPI() && !$dontFallback) {
    38614370            return sodium_crypto_core_ristretto255_scalar_reduce($s);
     
    39114420     * @throws SodiumException
    39124421     */
    3913     public static function sub(&$val, $addv)
    3914     {
     4422    public static function sub(
     4423        #[\SensitiveParameter]
     4424        &$val,
     4425        #[\SensitiveParameter]
     4426        $addv
     4427    ) {
    39154428        $val_len = ParagonIE_Sodium_Core_Util::strlen($val);
    39164429        $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv);
Note: See TracChangeset for help on using the changeset viewer.