wp/wp-includes/sodium_compat/lib/ristretto255.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    45      * @param string $p
    45      * @param string $p
    46      * @param string $q
    46      * @param string $q
    47      * @return string
    47      * @return string
    48      * @throws SodiumException
    48      * @throws SodiumException
    49      */
    49      */
    50     function sodium_crypto_core_ristretto255_add($p, $q)
    50     function sodium_crypto_core_ristretto255_add(
    51     {
    51         #[\SensitiveParameter]
       
    52         $p,
       
    53         #[\SensitiveParameter]
       
    54         $q
       
    55     ) {
    52         return ParagonIE_Sodium_Compat::ristretto255_add($p, $q, true);
    56         return ParagonIE_Sodium_Compat::ristretto255_add($p, $q, true);
    53     }
    57     }
    54 }
    58 }
    55 if (!is_callable('sodium_crypto_core_ristretto255_from_hash')) {
    59 if (!is_callable('sodium_crypto_core_ristretto255_from_hash')) {
    56     /**
    60     /**
    58      *
    62      *
    59      * @param string $s
    63      * @param string $s
    60      * @return string
    64      * @return string
    61      * @throws SodiumException
    65      * @throws SodiumException
    62      */
    66      */
    63     function sodium_crypto_core_ristretto255_from_hash($s)
    67     function sodium_crypto_core_ristretto255_from_hash(
    64     {
    68         #[\SensitiveParameter]
       
    69         $s
       
    70     ) {
    65         return ParagonIE_Sodium_Compat::ristretto255_from_hash($s, true);
    71         return ParagonIE_Sodium_Compat::ristretto255_from_hash($s, true);
    66     }
    72     }
    67 }
    73 }
    68 if (!is_callable('sodium_crypto_core_ristretto255_is_valid_point')) {
    74 if (!is_callable('sodium_crypto_core_ristretto255_is_valid_point')) {
    69     /**
    75     /**
    71      *
    77      *
    72      * @param string $s
    78      * @param string $s
    73      * @return bool
    79      * @return bool
    74      * @throws SodiumException
    80      * @throws SodiumException
    75      */
    81      */
    76     function sodium_crypto_core_ristretto255_is_valid_point($s)
    82     function sodium_crypto_core_ristretto255_is_valid_point(
    77     {
    83         #[\SensitiveParameter]
       
    84         $s
       
    85     ) {
    78         return ParagonIE_Sodium_Compat::ristretto255_is_valid_point($s, true);
    86         return ParagonIE_Sodium_Compat::ristretto255_is_valid_point($s, true);
    79     }
    87     }
    80 }
    88 }
    81 if (!is_callable('sodium_crypto_core_ristretto255_random')) {
    89 if (!is_callable('sodium_crypto_core_ristretto255_random')) {
    82     /**
    90     /**
    97      * @param string $x
   105      * @param string $x
    98      * @param string $y
   106      * @param string $y
    99      * @return string
   107      * @return string
   100      * @throws SodiumException
   108      * @throws SodiumException
   101      */
   109      */
   102     function sodium_crypto_core_ristretto255_scalar_add($x, $y)
   110     function sodium_crypto_core_ristretto255_scalar_add(
   103     {
   111         #[\SensitiveParameter]
       
   112         $x,
       
   113         #[\SensitiveParameter]
       
   114         $y
       
   115     ) {
   104         return ParagonIE_Sodium_Compat::ristretto255_scalar_add($x, $y, true);
   116         return ParagonIE_Sodium_Compat::ristretto255_scalar_add($x, $y, true);
   105     }
   117     }
   106 }
   118 }
   107 if (!is_callable('sodium_crypto_core_ristretto255_scalar_complement')) {
   119 if (!is_callable('sodium_crypto_core_ristretto255_scalar_complement')) {
   108     /**
   120     /**
   110      *
   122      *
   111      * @param string $s
   123      * @param string $s
   112      * @return string
   124      * @return string
   113      * @throws SodiumException
   125      * @throws SodiumException
   114      */
   126      */
   115     function sodium_crypto_core_ristretto255_scalar_complement($s)
   127     function sodium_crypto_core_ristretto255_scalar_complement(
   116     {
   128         #[\SensitiveParameter]
       
   129         $s
       
   130     ) {
   117         return ParagonIE_Sodium_Compat::ristretto255_scalar_complement($s, true);
   131         return ParagonIE_Sodium_Compat::ristretto255_scalar_complement($s, true);
   118     }
   132     }
   119 }
   133 }
   120 if (!is_callable('sodium_crypto_core_ristretto255_scalar_invert')) {
   134 if (!is_callable('sodium_crypto_core_ristretto255_scalar_invert')) {
   121     /**
   135     /**
   123      *
   137      *
   124      * @param string $p
   138      * @param string $p
   125      * @return string
   139      * @return string
   126      * @throws SodiumException
   140      * @throws SodiumException
   127      */
   141      */
   128     function sodium_crypto_core_ristretto255_scalar_invert($p)
   142     function sodium_crypto_core_ristretto255_scalar_invert(
   129     {
   143         #[\SensitiveParameter]
       
   144         $p
       
   145     ) {
   130         return ParagonIE_Sodium_Compat::ristretto255_scalar_invert($p, true);
   146         return ParagonIE_Sodium_Compat::ristretto255_scalar_invert($p, true);
   131     }
   147     }
   132 }
   148 }
   133 if (!is_callable('sodium_crypto_core_ristretto255_scalar_mul')) {
   149 if (!is_callable('sodium_crypto_core_ristretto255_scalar_mul')) {
   134     /**
   150     /**
   137      * @param string $x
   153      * @param string $x
   138      * @param string $y
   154      * @param string $y
   139      * @return string
   155      * @return string
   140      * @throws SodiumException
   156      * @throws SodiumException
   141      */
   157      */
   142     function sodium_crypto_core_ristretto255_scalar_mul($x, $y)
   158     function sodium_crypto_core_ristretto255_scalar_mul(
   143     {
   159         #[\SensitiveParameter]
       
   160         $x,
       
   161         #[\SensitiveParameter]
       
   162         $y
       
   163     ) {
   144         return ParagonIE_Sodium_Compat::ristretto255_scalar_mul($x, $y, true);
   164         return ParagonIE_Sodium_Compat::ristretto255_scalar_mul($x, $y, true);
   145     }
   165     }
   146 }
   166 }
   147 if (!is_callable('sodium_crypto_core_ristretto255_scalar_negate')) {
   167 if (!is_callable('sodium_crypto_core_ristretto255_scalar_negate')) {
   148     /**
   168     /**
   150      *
   170      *
   151      * @param string $s
   171      * @param string $s
   152      * @return string
   172      * @return string
   153      * @throws SodiumException
   173      * @throws SodiumException
   154      */
   174      */
   155     function sodium_crypto_core_ristretto255_scalar_negate($s)
   175     function sodium_crypto_core_ristretto255_scalar_negate(
   156     {
   176         #[\SensitiveParameter]
       
   177         $s
       
   178     ) {
   157         return ParagonIE_Sodium_Compat::ristretto255_scalar_negate($s, true);
   179         return ParagonIE_Sodium_Compat::ristretto255_scalar_negate($s, true);
   158     }
   180     }
   159 }
   181 }
   160 if (!is_callable('sodium_crypto_core_ristretto255_scalar_random')) {
   182 if (!is_callable('sodium_crypto_core_ristretto255_scalar_random')) {
   161     /**
   183     /**
   175      *
   197      *
   176      * @param string $s
   198      * @param string $s
   177      * @return string
   199      * @return string
   178      * @throws SodiumException
   200      * @throws SodiumException
   179      */
   201      */
   180     function sodium_crypto_core_ristretto255_scalar_reduce($s)
   202     function sodium_crypto_core_ristretto255_scalar_reduce(
   181     {
   203         #[\SensitiveParameter]
       
   204         $s
       
   205     ) {
   182         return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce($s, true);
   206         return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce($s, true);
   183     }
   207     }
   184 }
   208 }
   185 if (!is_callable('sodium_crypto_core_ristretto255_scalar_sub')) {
   209 if (!is_callable('sodium_crypto_core_ristretto255_scalar_sub')) {
   186     /**
   210     /**
   189      * @param string $x
   213      * @param string $x
   190      * @param string $y
   214      * @param string $y
   191      * @return string
   215      * @return string
   192      * @throws SodiumException
   216      * @throws SodiumException
   193      */
   217      */
   194     function sodium_crypto_core_ristretto255_scalar_sub($x, $y)
   218     function sodium_crypto_core_ristretto255_scalar_sub(
   195     {
   219         #[\SensitiveParameter]
       
   220         $x,
       
   221         #[\SensitiveParameter]
       
   222         $y
       
   223     ) {
   196         return ParagonIE_Sodium_Compat::ristretto255_scalar_sub($x, $y, true);
   224         return ParagonIE_Sodium_Compat::ristretto255_scalar_sub($x, $y, true);
   197     }
   225     }
   198 }
   226 }
   199 if (!is_callable('sodium_crypto_core_ristretto255_sub')) {
   227 if (!is_callable('sodium_crypto_core_ristretto255_sub')) {
   200     /**
   228     /**
   203      * @param string $p
   231      * @param string $p
   204      * @param string $q
   232      * @param string $q
   205      * @return string
   233      * @return string
   206      * @throws SodiumException
   234      * @throws SodiumException
   207      */
   235      */
   208     function sodium_crypto_core_ristretto255_sub($p, $q)
   236     function sodium_crypto_core_ristretto255_sub(
   209     {
   237         #[\SensitiveParameter]
       
   238         $p,
       
   239         #[\SensitiveParameter]
       
   240         $q
       
   241     ) {
   210         return ParagonIE_Sodium_Compat::ristretto255_sub($p, $q, true);
   242         return ParagonIE_Sodium_Compat::ristretto255_sub($p, $q, true);
   211     }
   243     }
   212 }
   244 }
   213 if (!is_callable('sodium_crypto_scalarmult_ristretto255')) {
   245 if (!is_callable('sodium_crypto_scalarmult_ristretto255')) {
   214     /**
   246     /**
   217      * @param string $p
   249      * @param string $p
   218      * @return string
   250      * @return string
   219      * @throws SodiumException
   251      * @throws SodiumException
   220      * @throws TypeError
   252      * @throws TypeError
   221      */
   253      */
   222     function sodium_crypto_scalarmult_ristretto255($n, $p)
   254     function sodium_crypto_scalarmult_ristretto255(
   223     {
   255         #[\SensitiveParameter]
       
   256         $n,
       
   257         #[\SensitiveParameter]
       
   258         $p
       
   259     ) {
   224         return ParagonIE_Sodium_Compat::scalarmult_ristretto255($n, $p, true);
   260         return ParagonIE_Sodium_Compat::scalarmult_ristretto255($n, $p, true);
   225     }
   261     }
   226 }
   262 }
   227 if (!is_callable('sodium_crypto_scalarmult_ristretto255_base')) {
   263 if (!is_callable('sodium_crypto_scalarmult_ristretto255_base')) {
   228     /**
   264     /**
   230      * @param string $n
   266      * @param string $n
   231      * @return string
   267      * @return string
   232      * @throws SodiumException
   268      * @throws SodiumException
   233      * @throws TypeError
   269      * @throws TypeError
   234      */
   270      */
   235     function sodium_crypto_scalarmult_ristretto255_base($n)
   271     function sodium_crypto_scalarmult_ristretto255_base(
   236     {
   272         #[\SensitiveParameter]
       
   273         $n
       
   274     ) {
   237         return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base($n, true);
   275         return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base($n, true);
   238     }
   276     }
   239 }
   277 }