wp/wp-includes/sodium_compat/lib/stream-xchacha20.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
     8      * @param string $key
     8      * @param string $key
     9      * @return string
     9      * @return string
    10      * @throws SodiumException
    10      * @throws SodiumException
    11      * @throws TypeError
    11      * @throws TypeError
    12      */
    12      */
    13     function sodium_crypto_stream_xchacha20($len, $nonce, $key)
    13     function sodium_crypto_stream_xchacha20(
    14     {
    14         $len,
       
    15         $nonce,
       
    16         #[\SensitiveParameter]
       
    17         $key
       
    18     ) {
    15         return ParagonIE_Sodium_Compat::crypto_stream_xchacha20($len, $nonce, $key, true);
    19         return ParagonIE_Sodium_Compat::crypto_stream_xchacha20($len, $nonce, $key, true);
    16     }
    20     }
    17 }
    21 }
    18 if (!is_callable('sodium_crypto_stream_xchacha20_keygen')) {
    22 if (!is_callable('sodium_crypto_stream_xchacha20_keygen')) {
    19     /**
    23     /**
    34      * @param string $key
    38      * @param string $key
    35      * @return string
    39      * @return string
    36      * @throws SodiumException
    40      * @throws SodiumException
    37      * @throws TypeError
    41      * @throws TypeError
    38      */
    42      */
    39     function sodium_crypto_stream_xchacha20_xor($message, $nonce, $key)
    43     function sodium_crypto_stream_xchacha20_xor(
    40     {
    44         #[\SensitiveParameter]
       
    45         $message,
       
    46         $nonce,
       
    47         #[\SensitiveParameter]
       
    48         $key
       
    49     ) {
    41         return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor($message, $nonce, $key, true);
    50         return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor($message, $nonce, $key, true);
    42     }
    51     }
    43 }
    52 }
    44 if (!is_callable('sodium_crypto_stream_xchacha20_xor_ic')) {
    53 if (!is_callable('sodium_crypto_stream_xchacha20_xor_ic')) {
    45     /**
    54     /**
    50      * @param string $key
    59      * @param string $key
    51      * @return string
    60      * @return string
    52      * @throws SodiumException
    61      * @throws SodiumException
    53      * @throws TypeError
    62      * @throws TypeError
    54      */
    63      */
    55     function sodium_crypto_stream_xchacha20_xor_ic($message, $nonce, $counter, $key)
    64     function sodium_crypto_stream_xchacha20_xor_ic(
    56     {
    65         #[\SensitiveParameter]
       
    66         $message,
       
    67         $nonce,
       
    68         $counter,
       
    69         #[\SensitiveParameter]
       
    70         $key
       
    71     ) {
    57         return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor_ic($message, $nonce, $counter, $key, true);
    72         return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor_ic($message, $nonce, $counter, $key, true);
    58     }
    73     }
    59 }
    74 }