- Timestamp:
- 07/18/2024 12:58:40 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/sodium_compat/lib/sodium_compat.php
r54310 r58752 21 21 * @throws \TypeError 22 22 */ 23 function bin2hex($string) 24 { 23 function bin2hex( 24 #[\SensitiveParameter] 25 $string 26 ) { 25 27 return ParagonIE_Sodium_Compat::bin2hex($string); 26 28 } … … 35 37 * @throws \TypeError 36 38 */ 37 function compare($a, $b) 38 { 39 function compare( 40 #[\SensitiveParameter] 41 $a, 42 #[\SensitiveParameter] 43 $b 44 ) { 39 45 return ParagonIE_Sodium_Compat::compare($a, $b); 40 46 } … … 49 55 * @return string|bool 50 56 */ 51 function crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) 52 { 57 function crypto_aead_aes256gcm_decrypt( 58 $message, 59 $assocData, 60 $nonce, 61 #[\SensitiveParameter] 62 $key 63 ) { 53 64 try { 54 65 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); … … 71 82 * @throws \TypeError 72 83 */ 73 function crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) 74 { 84 function crypto_aead_aes256gcm_encrypt( 85 #[\SensitiveParameter] 86 $message, 87 $assocData, 88 $nonce, 89 #[\SensitiveParameter] 90 $key 91 ) { 75 92 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); 76 93 } … … 95 112 * @return string|bool 96 113 */ 97 function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) 98 { 114 function crypto_aead_chacha20poly1305_decrypt( 115 $message, 116 $assocData, 117 $nonce, 118 #[\SensitiveParameter] 119 $key 120 ) { 99 121 try { 100 122 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); … … 117 139 * @throws \TypeError 118 140 */ 119 function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) 120 { 141 function crypto_aead_chacha20poly1305_encrypt( 142 #[\SensitiveParameter] 143 $message, 144 $assocData, 145 $nonce, 146 #[\SensitiveParameter] 147 $key 148 ) { 121 149 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); 122 150 } … … 131 159 * @return string|bool 132 160 */ 133 function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) 134 { 161 function crypto_aead_chacha20poly1305_ietf_decrypt( 162 $message, 163 $assocData, 164 $nonce, 165 #[\SensitiveParameter] 166 $key 167 ) { 135 168 try { 136 169 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); … … 153 186 * @throws \TypeError 154 187 */ 155 function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) 156 { 188 function crypto_aead_chacha20poly1305_ietf_encrypt( 189 #[\SensitiveParameter] 190 $message, 191 $assocData, 192 $nonce, 193 #[\SensitiveParameter] 194 $key 195 ) { 157 196 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); 158 197 } … … 167 206 * @throws \TypeError 168 207 */ 169 function crypto_auth($message, $key) 170 { 208 function crypto_auth( 209 $message, 210 #[\SensitiveParameter] 211 $key 212 ) { 171 213 return ParagonIE_Sodium_Compat::crypto_auth($message, $key); 172 214 } … … 182 224 * @throws \TypeError 183 225 */ 184 function crypto_auth_verify($mac, $message, $key) 185 { 226 function crypto_auth_verify( 227 $mac, 228 $message, 229 #[\SensitiveParameter] 230 $key 231 ) { 186 232 return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); 187 233 } … … 197 243 * @throws \TypeError 198 244 */ 199 function crypto_box($message, $nonce, $kp) 200 { 245 function crypto_box( 246 #[\SensitiveParameter] 247 $message, 248 $nonce, 249 #[\SensitiveParameter] 250 $kp 251 ) { 201 252 return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); 202 253 } … … 223 274 * @throws \TypeError 224 275 */ 225 function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) 226 { 276 function crypto_box_keypair_from_secretkey_and_publickey( 277 #[\SensitiveParameter] 278 $sk, 279 $pk 280 ) { 227 281 return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); 228 282 } … … 236 290 * @return string|bool 237 291 */ 238 function crypto_box_open($message, $nonce, $kp) 239 { 292 function crypto_box_open( 293 #[\SensitiveParameter] 294 $message, 295 $nonce, 296 #[\SensitiveParameter] 297 $kp 298 ) { 240 299 try { 241 300 return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); … … 255 314 * @throws \TypeError 256 315 */ 257 function crypto_box_publickey($keypair) 258 { 316 function crypto_box_publickey( 317 #[\SensitiveParameter] 318 $keypair 319 ) { 259 320 return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); 260 321 } … … 268 329 * @throws \TypeError 269 330 */ 270 function crypto_box_publickey_from_secretkey($sk) 271 { 331 function crypto_box_publickey_from_secretkey( 332 #[\SensitiveParameter] 333 $sk 334 ) { 272 335 return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); 273 336 } … … 282 345 * @throws \TypeError 283 346 */ 284 function crypto_box_seal($message, $publicKey) 285 { 347 function crypto_box_seal( 348 #[\SensitiveParameter] 349 $message, 350 $publicKey 351 ) { 286 352 return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); 287 353 } … … 294 360 * @return string|bool 295 361 */ 296 function crypto_box_seal_open($message, $kp) 297 { 362 function crypto_box_seal_open( 363 $message, 364 #[\SensitiveParameter] 365 $kp 366 ) { 298 367 try { 299 368 return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); … … 313 382 * @throws \TypeError 314 383 */ 315 function crypto_box_secretkey($keypair) 316 { 384 function crypto_box_secretkey( 385 #[\SensitiveParameter] 386 $keypair 387 ) { 317 388 return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); 318 389 } … … 328 399 * @throws \TypeError 329 400 */ 330 function crypto_generichash($message, $key = null, $outLen = 32) 331 { 401 function crypto_generichash( 402 $message, 403 #[\SensitiveParameter] 404 $key = null, 405 $outLen = 32 406 ) { 332 407 return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); 333 408 } … … 342 417 * @throws \TypeError 343 418 */ 344 function crypto_generichash_final(&$ctx, $outputLength = 32) 345 { 419 function crypto_generichash_final( 420 #[\SensitiveParameter] 421 &$ctx, 422 $outputLength = 32 423 ) { 346 424 return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); 347 425 } … … 356 434 * @throws \TypeError 357 435 */ 358 function crypto_generichash_init($key = null, $outLen = 32) 359 { 436 function crypto_generichash_init( 437 #[\SensitiveParameter] 438 $key = null, 439 $outLen = 32 440 ) { 360 441 return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); 361 442 } … … 370 451 * @throws \TypeError 371 452 */ 372 function crypto_generichash_update(&$ctx, $message = '') 373 { 453 function crypto_generichash_update( 454 #[\SensitiveParameter] 455 &$ctx, 456 $message = '' 457 ) { 374 458 ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); 375 459 } … … 386 470 * @throws \TypeError 387 471 */ 388 function crypto_kx($my_secret, $their_public, $client_public, $server_public) 389 { 472 function crypto_kx( 473 #[\SensitiveParameter] 474 $my_secret, 475 $their_public, 476 $client_public, 477 $server_public 478 ) { 390 479 return ParagonIE_Sodium_Compat::crypto_kx( 391 480 $my_secret, … … 409 498 * @throws \TypeError 410 499 */ 411 function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) 412 { 500 function crypto_pwhash( 501 $outlen, 502 #[\SensitiveParameter] 503 $passwd, 504 $salt, 505 $opslimit, 506 $memlimit 507 ) { 413 508 return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); 414 509 } … … 424 519 * @throws \TypeError 425 520 */ 426 function crypto_pwhash_str($passwd, $opslimit, $memlimit) 427 { 521 function crypto_pwhash_str( 522 #[\SensitiveParameter] 523 $passwd, 524 $opslimit, 525 $memlimit 526 ) { 428 527 return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); 429 528 } … … 438 537 * @throws \TypeError 439 538 */ 440 function crypto_pwhash_str_verify($passwd, $hash) 441 { 539 function crypto_pwhash_str_verify( 540 #[\SensitiveParameter] 541 $passwd, 542 #[\SensitiveParameter] 543 $hash 544 ) { 442 545 return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); 443 546 } … … 455 558 * @throws \TypeError 456 559 */ 457 function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) 458 { 560 function crypto_pwhash_scryptsalsa208sha256( 561 $outlen, 562 #[\SensitiveParameter] 563 $passwd, 564 #[\SensitiveParameter] 565 $salt, 566 $opslimit, 567 $memlimit 568 ) { 459 569 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); 460 570 } … … 470 580 * @throws \TypeError 471 581 */ 472 function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) 473 { 582 function crypto_pwhash_scryptsalsa208sha256_str( 583 #[\SensitiveParameter] 584 $passwd, 585 $opslimit, 586 $memlimit 587 ) { 474 588 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); 475 589 } … … 484 598 * @throws \TypeError 485 599 */ 486 function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) 487 { 600 function crypto_pwhash_scryptsalsa208sha256_str_verify( 601 #[\SensitiveParameter] 602 $passwd, 603 #[\SensitiveParameter] 604 $hash 605 ) { 488 606 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); 489 607 } … … 498 616 * @throws \TypeError 499 617 */ 500 function crypto_scalarmult($n, $p) 501 { 618 function crypto_scalarmult( 619 #[\SensitiveParameter] 620 $n, 621 $p 622 ) { 502 623 return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); 503 624 } … … 511 632 * @throws \TypeError 512 633 */ 513 function crypto_scalarmult_base($n) 514 { 634 function crypto_scalarmult_base( 635 #[\SensitiveParameter] 636 $n 637 ) { 515 638 return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); 516 639 } … … 526 649 * @throws \TypeError 527 650 */ 528 function crypto_secretbox($message, $nonce, $key) 529 { 651 function crypto_secretbox( 652 #[\SensitiveParameter] 653 $message, 654 $nonce, 655 #[\SensitiveParameter] 656 $key 657 ) { 530 658 return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); 531 659 } … … 539 667 * @return string|bool 540 668 */ 541 function crypto_secretbox_open($message, $nonce, $key) 542 { 669 function crypto_secretbox_open( 670 $message, 671 $nonce, 672 #[\SensitiveParameter] 673 $key 674 ) { 543 675 try { 544 676 return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); … … 559 691 * @throws \TypeError 560 692 */ 561 function crypto_shorthash($message, $key = '') 562 { 693 function crypto_shorthash( 694 $message, 695 #[\SensitiveParameter] 696 $key = '' 697 ) { 563 698 return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); 564 699 } … … 573 708 * @throws \TypeError 574 709 */ 575 function crypto_sign($message, $sk) 576 { 710 function crypto_sign( 711 $message, 712 #[\SensitiveParameter] 713 $sk 714 ) { 577 715 return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); 578 716 } … … 587 725 * @throws \TypeError 588 726 */ 589 function crypto_sign_detached($message, $sk) 590 { 727 function crypto_sign_detached( 728 $message, 729 #[\SensitiveParameter] 730 $sk 731 ) { 591 732 return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); 592 733 } … … 630 771 * @throws \TypeError 631 772 */ 632 function crypto_sign_publickey($keypair) 633 { 773 function crypto_sign_publickey( 774 #[\SensitiveParameter] 775 $keypair 776 ) { 634 777 return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); 635 778 } … … 643 786 * @throws \TypeError 644 787 */ 645 function crypto_sign_publickey_from_secretkey($sk) 646 { 788 function crypto_sign_publickey_from_secretkey( 789 #[\SensitiveParameter] 790 $sk 791 ) { 647 792 return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); 648 793 } … … 656 801 * @throws \TypeError 657 802 */ 658 function crypto_sign_secretkey($keypair) 659 { 803 function crypto_sign_secretkey( 804 #[\SensitiveParameter] 805 $keypair 806 ) { 660 807 return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); 661 808 } … … 669 816 * @throws \TypeError 670 817 */ 671 function crypto_sign_seed_keypair($seed) 672 { 818 function crypto_sign_seed_keypair( 819 #[\SensitiveParameter] 820 $seed 821 ) { 673 822 return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); 674 823 } … … 710 859 * @throws \TypeError 711 860 */ 712 function crypto_sign_ed25519_sk_to_curve25519($sk) 713 { 861 function crypto_sign_ed25519_sk_to_curve25519( 862 #[\SensitiveParameter] 863 $sk 864 ) { 714 865 return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); 715 866 } … … 725 876 * @throws \TypeError 726 877 */ 727 function crypto_stream($len, $nonce, $key) 728 { 878 function crypto_stream( 879 $len, 880 $nonce, 881 #[\SensitiveParameter] 882 $key 883 ) { 729 884 return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); 730 885 } … … 740 895 * @throws \TypeError 741 896 */ 742 function crypto_stream_xor($message, $nonce, $key) 743 { 897 function crypto_stream_xor( 898 #[\SensitiveParameter] 899 $message, 900 $nonce, 901 #[\SensitiveParameter] 902 $key 903 ) { 744 904 return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); 745 905 } … … 753 913 * @throws \TypeError 754 914 */ 755 function hex2bin($string) 756 { 915 function hex2bin( 916 #[\SensitiveParameter] 917 $string 918 ) { 757 919 return ParagonIE_Sodium_Compat::hex2bin($string); 758 920 } … … 767 929 * @throws \TypeError 768 930 */ 769 function memcmp($a, $b) 770 { 931 function memcmp( 932 #[\SensitiveParameter] 933 $a, 934 #[\SensitiveParameter] 935 $b 936 ) { 771 937 return ParagonIE_Sodium_Compat::memcmp($a, $b); 772 938 } … … 784 950 * @psalm-suppress ReferenceConstraintViolation 785 951 */ 786 function memzero(&$str) 787 { 952 function memzero( 953 #[\SensitiveParameter] 954 &$str 955 ) { 788 956 ParagonIE_Sodium_Compat::memzero($str); 789 957 }
Note: See TracChangeset
for help on using the changeset viewer.