Changeset 58752
- Timestamp:
- 07/18/2024 12:58:40 PM (3 months ago)
- Location:
- trunk/src/wp-includes/sodium_compat
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/sodium_compat/autoload.php
r54150 r58752 55 55 require_once dirname(__FILE__) . '/lib/namespaced.php'; 56 56 require_once dirname(__FILE__) . '/lib/sodium_compat.php'; 57 if (!defined('SODIUM_CRYPTO_AEAD_AEGIS128L_KEYBYTES')) { 58 require_once dirname(__FILE__) . '/lib/php84compat_const.php'; 59 } 57 60 } else { 58 61 require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php'; … … 72 75 require_once(dirname(__FILE__) . '/lib/php72compat.php'); 73 76 } 77 if (PHP_VERSION_ID < 80400 || !extension_loaded('sodium')) { 78 require_once dirname(__FILE__) . '/lib/php84compat.php'; 79 } 74 80 require_once(dirname(__FILE__) . '/lib/stream-xchacha20.php'); 75 81 require_once(dirname(__FILE__) . '/lib/ristretto255.php'); -
trunk/src/wp-includes/sodium_compat/lib/php72compat.php
r55699 r58752 15 15 'BASE64_VARIANT_URLSAFE', 16 16 'BASE64_VARIANT_URLSAFE_NO_PADDING', 17 'CRYPTO_AEAD_AES256GCM_KEYBYTES', 18 'CRYPTO_AEAD_AES256GCM_NSECBYTES', 19 'CRYPTO_AEAD_AES256GCM_NPUBBYTES', 20 'CRYPTO_AEAD_AES256GCM_ABYTES', 17 21 'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES', 18 22 'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES', 19 23 'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES', 20 24 'CRYPTO_AEAD_CHACHA20POLY1305_ABYTES', 21 'CRYPTO_AEAD_AES256GCM_KEYBYTES',22 'CRYPTO_AEAD_AES256GCM_NSECBYTES',23 'CRYPTO_AEAD_AES256GCM_NPUBBYTES',24 'CRYPTO_AEAD_AES256GCM_ABYTES',25 25 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES', 26 26 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES', … … 116 116 * @throws SodiumException 117 117 */ 118 function sodium_add(&$string1, $string2) 119 { 118 function sodium_add( 119 #[\SensitiveParameter] 120 &$string1, 121 #[\SensitiveParameter] 122 $string2 123 ) { 120 124 ParagonIE_Sodium_Compat::add($string1, $string2); 121 125 } … … 131 135 * @throws TypeError 132 136 */ 133 function sodium_base642bin($string, $variant, $ignore ='') 134 { 137 function sodium_base642bin( 138 #[\SensitiveParameter] 139 $string, 140 $variant, 141 $ignore ='' 142 ) { 135 143 return ParagonIE_Sodium_Compat::base642bin($string, $variant, $ignore); 136 144 } … … 145 153 * @throws TypeError 146 154 */ 147 function sodium_bin2base64($string, $variant) 148 { 155 function sodium_bin2base64( 156 #[\SensitiveParameter] 157 $string, 158 $variant 159 ) { 149 160 return ParagonIE_Sodium_Compat::bin2base64($string, $variant); 150 161 } … … 158 169 * @throws TypeError 159 170 */ 160 function sodium_bin2hex($string) 161 { 171 function sodium_bin2hex( 172 #[\SensitiveParameter] 173 $string 174 ) { 162 175 return ParagonIE_Sodium_Compat::bin2hex($string); 163 176 } … … 172 185 * @throws TypeError 173 186 */ 174 function sodium_compare($string1, $string2) 175 { 187 function sodium_compare( 188 #[\SensitiveParameter] 189 $string1, 190 #[\SensitiveParameter] 191 $string2 192 ) { 176 193 return ParagonIE_Sodium_Compat::compare($string1, $string2); 177 194 } … … 186 203 * @return string|bool 187 204 */ 188 function sodium_crypto_aead_aes256gcm_decrypt($ciphertext, $additional_data, $nonce, $key) 189 { 205 function sodium_crypto_aead_aes256gcm_decrypt( 206 $ciphertext, 207 $additional_data, 208 $nonce, 209 #[\SensitiveParameter] 210 $key 211 ) { 190 212 try { 191 213 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt( … … 216 238 * @throws TypeError 217 239 */ 218 function sodium_crypto_aead_aes256gcm_encrypt($message, $additional_data, $nonce, $key) 219 { 240 function sodium_crypto_aead_aes256gcm_encrypt( 241 #[\SensitiveParameter] 242 $message, 243 $additional_data, 244 $nonce, 245 #[\SensitiveParameter] 246 $key 247 ) { 220 248 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $additional_data, $nonce, $key); 221 249 } … … 240 268 * @return string|bool 241 269 */ 242 function sodium_crypto_aead_chacha20poly1305_decrypt($ciphertext, $additional_data, $nonce, $key) 243 { 270 function sodium_crypto_aead_chacha20poly1305_decrypt( 271 $ciphertext, 272 $additional_data, 273 $nonce, 274 #[\SensitiveParameter] 275 $key 276 ) { 244 277 try { 245 278 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt( … … 267 300 * @throws TypeError 268 301 */ 269 function sodium_crypto_aead_chacha20poly1305_encrypt($message, $additional_data, $nonce, $key) 270 { 302 function sodium_crypto_aead_chacha20poly1305_encrypt( 303 #[\SensitiveParameter] 304 $message, 305 $additional_data, 306 $nonce, 307 #[\SensitiveParameter] 308 $key 309 ) { 271 310 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt( 272 311 $message, … … 297 336 * @return string|bool 298 337 */ 299 function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $additional_data, $nonce, $key) 300 { 338 function sodium_crypto_aead_chacha20poly1305_ietf_decrypt( 339 $message, 340 $additional_data, 341 $nonce, 342 #[\SensitiveParameter] 343 $key 344 ) { 301 345 try { 302 346 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt( … … 324 368 * @throws TypeError 325 369 */ 326 function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $additional_data, $nonce, $key) 327 { 370 function sodium_crypto_aead_chacha20poly1305_ietf_encrypt( 371 #[\SensitiveParameter] 372 $message, 373 $additional_data, 374 $nonce, 375 #[\SensitiveParameter] 376 $key 377 ) { 328 378 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt( 329 379 $message, … … 354 404 * @return string|bool 355 405 */ 356 function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($ciphertext, $additional_data, $nonce, $key) 357 { 406 function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt( 407 $ciphertext, 408 $additional_data, 409 $nonce, 410 #[\SensitiveParameter] 411 $key 412 ) { 358 413 try { 359 414 return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt( … … 383 438 */ 384 439 function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt( 440 #[\SensitiveParameter] 385 441 $message, 386 442 $additional_data, 387 443 $nonce, 444 #[\SensitiveParameter] 388 445 $key 389 446 ) { … … 417 474 * @throws TypeError 418 475 */ 419 function sodium_crypto_auth($message, $key) 420 { 476 function sodium_crypto_auth( 477 $message, 478 #[\SensitiveParameter] 479 $key 480 ) { 421 481 return ParagonIE_Sodium_Compat::crypto_auth($message, $key); 422 482 } … … 443 503 * @throws TypeError 444 504 */ 445 function sodium_crypto_auth_verify($mac, $message, $key) 446 { 505 function sodium_crypto_auth_verify( 506 $mac, 507 $message, 508 #[\SensitiveParameter] 509 $key 510 ) { 447 511 return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); 448 512 } … … 458 522 * @throws TypeError 459 523 */ 460 function sodium_crypto_box($message, $nonce, $key_pair) 461 { 524 function sodium_crypto_box( 525 #[\SensitiveParameter] 526 $message, 527 $nonce, 528 #[\SensitiveParameter] 529 $key_pair 530 ) { 462 531 return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $key_pair); 463 532 } … … 484 553 * @throws TypeError 485 554 */ 486 function sodium_crypto_box_keypair_from_secretkey_and_publickey($secret_key, $public_key) 487 { 555 function sodium_crypto_box_keypair_from_secretkey_and_publickey( 556 #[\SensitiveParameter] 557 $secret_key, 558 $public_key 559 ) { 488 560 return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($secret_key, $public_key); 489 561 } … … 497 569 * @return string|bool 498 570 */ 499 function sodium_crypto_box_open($ciphertext, $nonce, $key_pair) 500 { 571 function sodium_crypto_box_open( 572 $ciphertext, 573 $nonce, 574 #[\SensitiveParameter] 575 $key_pair 576 ) { 501 577 try { 502 578 return ParagonIE_Sodium_Compat::crypto_box_open($ciphertext, $nonce, $key_pair); … … 516 592 * @throws TypeError 517 593 */ 518 function sodium_crypto_box_publickey($key_pair) 519 { 594 function sodium_crypto_box_publickey( 595 #[\SensitiveParameter] 596 $key_pair 597 ) { 520 598 return ParagonIE_Sodium_Compat::crypto_box_publickey($key_pair); 521 599 } … … 529 607 * @throws TypeError 530 608 */ 531 function sodium_crypto_box_publickey_from_secretkey($secret_key) 532 { 609 function sodium_crypto_box_publickey_from_secretkey( 610 #[\SensitiveParameter] 611 $secret_key 612 ) { 533 613 return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($secret_key); 534 614 } … … 543 623 * @throws TypeError 544 624 */ 545 function sodium_crypto_box_seal($message, $public_key) 546 { 625 function sodium_crypto_box_seal( 626 #[\SensitiveParameter] 627 $message, 628 $public_key 629 ) { 547 630 return ParagonIE_Sodium_Compat::crypto_box_seal($message, $public_key); 548 631 } … … 556 639 * @throws SodiumException 557 640 */ 558 function sodium_crypto_box_seal_open($message, $key_pair) 559 { 641 function sodium_crypto_box_seal_open( 642 $message, 643 #[\SensitiveParameter] 644 $key_pair 645 ) { 560 646 try { 561 647 return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $key_pair); … … 576 662 * @throws TypeError 577 663 */ 578 function sodium_crypto_box_secretkey($key_pair) 579 { 664 function sodium_crypto_box_secretkey( 665 #[\SensitiveParameter] 666 $key_pair 667 ) { 580 668 return ParagonIE_Sodium_Compat::crypto_box_secretkey($key_pair); 581 669 } … … 589 677 * @throws TypeError 590 678 */ 591 function sodium_crypto_box_seed_keypair($seed) 592 { 679 function sodium_crypto_box_seed_keypair( 680 #[\SensitiveParameter] 681 $seed 682 ) { 593 683 return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); 594 684 } … … 604 694 * @throws TypeError 605 695 */ 606 function sodium_crypto_generichash($message, $key = null, $length = 32) 607 { 696 function sodium_crypto_generichash( 697 $message, 698 #[\SensitiveParameter] 699 $key = null, 700 $length = 32 701 ) { 608 702 return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $length); 609 703 } … … 632 726 * @throws TypeError 633 727 */ 634 function sodium_crypto_generichash_init($key = null, $length = 32) 635 { 728 function sodium_crypto_generichash_init( 729 #[\SensitiveParameter] 730 $key = null, 731 $length = 32 732 ) { 636 733 return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $length); 637 734 } … … 657 754 * @throws TypeError 658 755 */ 659 function sodium_crypto_generichash_update(&$state, $message = '') 660 { 756 function sodium_crypto_generichash_update( 757 #[\SensitiveParameter] 758 &$state, 759 $message = '' 760 ) { 661 761 ParagonIE_Sodium_Compat::crypto_generichash_update($state, $message); 662 762 } … … 683 783 * @throws Exception 684 784 */ 685 function sodium_crypto_kdf_derive_from_key($subkey_length, $subkey_id, $context, $key) 686 { 785 function sodium_crypto_kdf_derive_from_key( 786 $subkey_length, 787 $subkey_id, 788 $context, 789 #[\SensitiveParameter] 790 $key 791 ) { 687 792 return ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key( 688 793 $subkey_length, … … 704 809 * @throws TypeError 705 810 */ 706 function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) 707 { 811 function sodium_crypto_kx( 812 #[\SensitiveParameter] 813 $my_secret, 814 $their_public, 815 $client_public, 816 $server_public 817 ) { 708 818 return ParagonIE_Sodium_Compat::crypto_kx( 709 819 $my_secret, … … 720 830 * @throws Exception 721 831 */ 722 function sodium_crypto_kx_seed_keypair($seed) 723 { 832 function sodium_crypto_kx_seed_keypair( 833 #[\SensitiveParameter] 834 $seed 835 ) { 724 836 return ParagonIE_Sodium_Compat::crypto_kx_seed_keypair($seed); 725 837 } … … 742 854 * @throws SodiumException 743 855 */ 744 function sodium_crypto_kx_client_session_keys($client_key_pair, $server_key) 745 { 856 function sodium_crypto_kx_client_session_keys( 857 #[\SensitiveParameter] 858 $client_key_pair, 859 $server_key 860 ) { 746 861 return ParagonIE_Sodium_Compat::crypto_kx_client_session_keys($client_key_pair, $server_key); 747 862 } … … 754 869 * @throws SodiumException 755 870 */ 756 function sodium_crypto_kx_server_session_keys($server_key_pair, $client_key) 757 { 871 function sodium_crypto_kx_server_session_keys( 872 #[\SensitiveParameter] 873 $server_key_pair, 874 $client_key 875 ) { 758 876 return ParagonIE_Sodium_Compat::crypto_kx_server_session_keys($server_key_pair, $client_key); 759 877 } … … 765 883 * @throws Exception 766 884 */ 767 function sodium_crypto_kx_secretkey($key_pair) 768 { 885 function sodium_crypto_kx_secretkey( 886 #[\SensitiveParameter] 887 $key_pair 888 ) { 769 889 return ParagonIE_Sodium_Compat::crypto_kx_secretkey($key_pair); 770 890 } … … 776 896 * @throws Exception 777 897 */ 778 function sodium_crypto_kx_publickey($key_pair) 779 { 898 function sodium_crypto_kx_publickey( 899 #[\SensitiveParameter] 900 $key_pair 901 ) { 780 902 return ParagonIE_Sodium_Compat::crypto_kx_publickey($key_pair); 781 903 } … … 794 916 * @throws TypeError 795 917 */ 796 function sodium_crypto_pwhash($length, $passwd, $salt, $opslimit, $memlimit, $algo = null) 797 { 918 function sodium_crypto_pwhash( 919 $length, 920 #[\SensitiveParameter] 921 $passwd, 922 $salt, 923 $opslimit, 924 $memlimit, 925 $algo = null 926 ) { 798 927 return ParagonIE_Sodium_Compat::crypto_pwhash($length, $passwd, $salt, $opslimit, $memlimit, $algo); 799 928 } … … 809 938 * @throws TypeError 810 939 */ 811 function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) 812 { 940 function sodium_crypto_pwhash_str( 941 #[\SensitiveParameter] 942 $passwd, 943 $opslimit, 944 $memlimit 945 ) { 813 946 return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); 814 947 } … … 824 957 * @throws SodiumException 825 958 */ 826 function sodium_crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) 827 { 959 function sodium_crypto_pwhash_str_needs_rehash( 960 #[\SensitiveParameter] 961 $hash, 962 $opslimit, 963 $memlimit 964 ) { 828 965 return ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit); 829 966 } … … 838 975 * @throws TypeError 839 976 */ 840 function sodium_crypto_pwhash_str_verify($passwd, $hash) 841 { 977 function sodium_crypto_pwhash_str_verify( 978 #[\SensitiveParameter] 979 $passwd, 980 #[\SensitiveParameter] 981 $hash 982 ) { 842 983 return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); 843 984 } … … 855 996 * @throws TypeError 856 997 */ 857 function sodium_crypto_pwhash_scryptsalsa208sha256($length, $passwd, $salt, $opslimit, $memlimit) 858 { 998 function sodium_crypto_pwhash_scryptsalsa208sha256( 999 $length, 1000 #[\SensitiveParameter] 1001 $passwd, 1002 $salt, 1003 $opslimit, 1004 $memlimit 1005 ) { 859 1006 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256( 860 1007 $length, … … 876 1023 * @throws TypeError 877 1024 */ 878 function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) 879 { 1025 function sodium_crypto_pwhash_scryptsalsa208sha256_str( 1026 #[\SensitiveParameter] 1027 $passwd, 1028 $opslimit, 1029 $memlimit 1030 ) { 880 1031 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); 881 1032 } … … 890 1041 * @throws TypeError 891 1042 */ 892 function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) 893 { 1043 function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify( 1044 #[\SensitiveParameter] 1045 $passwd, 1046 #[\SensitiveParameter] 1047 $hash 1048 ) { 894 1049 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); 895 1050 } … … 904 1059 * @throws TypeError 905 1060 */ 906 function sodium_crypto_scalarmult($n, $p) 907 { 1061 function sodium_crypto_scalarmult( 1062 #[\SensitiveParameter] 1063 $n, 1064 $p 1065 ) { 908 1066 return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); 909 1067 } … … 917 1075 * @throws TypeError 918 1076 */ 919 function sodium_crypto_scalarmult_base($n) 920 { 1077 function sodium_crypto_scalarmult_base( 1078 #[\SensitiveParameter] 1079 $n 1080 ) { 921 1081 return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); 922 1082 } … … 932 1092 * @throws TypeError 933 1093 */ 934 function sodium_crypto_secretbox($message, $nonce, $key) 935 { 1094 function sodium_crypto_secretbox( 1095 #[\SensitiveParameter] 1096 $message, 1097 $nonce, 1098 #[\SensitiveParameter] 1099 $key 1100 ) { 936 1101 return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); 937 1102 } … … 956 1121 * @return string|bool 957 1122 */ 958 function sodium_crypto_secretbox_open($ciphertext, $nonce, $key) 959 { 1123 function sodium_crypto_secretbox_open( 1124 $ciphertext, 1125 $nonce, 1126 #[\SensitiveParameter] 1127 $key 1128 ) { 960 1129 try { 961 1130 return ParagonIE_Sodium_Compat::crypto_secretbox_open($ciphertext, $nonce, $key); … … 973 1142 * @throws SodiumException 974 1143 */ 975 function sodium_crypto_secretstream_xchacha20poly1305_init_push($key) 976 { 1144 function sodium_crypto_secretstream_xchacha20poly1305_init_push( 1145 #[\SensitiveParameter] 1146 $key 1147 ) { 977 1148 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push($key); 978 1149 } … … 988 1159 */ 989 1160 function sodium_crypto_secretstream_xchacha20poly1305_push( 1161 #[\SensitiveParameter] 990 1162 &$state, 1163 #[\SensitiveParameter] 991 1164 $message, 992 1165 $additional_data = '', … … 1008 1181 * @throws Exception 1009 1182 */ 1010 function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key) 1011 { 1183 function sodium_crypto_secretstream_xchacha20poly1305_init_pull( 1184 $header, 1185 #[\SensitiveParameter] 1186 $key 1187 ) { 1012 1188 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key); 1013 1189 } … … 1021 1197 * @throws SodiumException 1022 1198 */ 1023 function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $ciphertext, $additional_data = '') 1024 { 1199 function sodium_crypto_secretstream_xchacha20poly1305_pull( 1200 #[\SensitiveParameter] 1201 &$state, 1202 $ciphertext, 1203 $additional_data = '' 1204 ) { 1025 1205 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull( 1026 1206 $state, … … 1036 1216 * @throws SodiumException 1037 1217 */ 1038 function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state) 1039 { 1218 function sodium_crypto_secretstream_xchacha20poly1305_rekey( 1219 #[\SensitiveParameter] 1220 &$state 1221 ) { 1040 1222 ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state); 1041 1223 } … … 1060 1242 * @throws TypeError 1061 1243 */ 1062 function sodium_crypto_shorthash($message, $key = '') 1063 { 1244 function sodium_crypto_shorthash( 1245 $message, 1246 #[\SensitiveParameter] 1247 $key = '' 1248 ) { 1064 1249 return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); 1065 1250 } … … 1085 1270 * @throws TypeError 1086 1271 */ 1087 function sodium_crypto_sign($message, $secret_key) 1088 { 1272 function sodium_crypto_sign( 1273 $message, 1274 #[\SensitiveParameter] 1275 $secret_key 1276 ) { 1089 1277 return ParagonIE_Sodium_Compat::crypto_sign($message, $secret_key); 1090 1278 } … … 1099 1287 * @throws TypeError 1100 1288 */ 1101 function sodium_crypto_sign_detached($message, $secret_key) 1102 { 1289 function sodium_crypto_sign_detached( 1290 $message, 1291 #[\SensitiveParameter] 1292 $secret_key 1293 ) { 1103 1294 return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $secret_key); 1104 1295 } … … 1113 1304 * @throws TypeError 1114 1305 */ 1115 function sodium_crypto_sign_keypair_from_secretkey_and_publickey($secret_key, $public_key) 1116 { 1306 function sodium_crypto_sign_keypair_from_secretkey_and_publickey( 1307 #[\SensitiveParameter] 1308 $secret_key, 1309 $public_key 1310 ) { 1117 1311 return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($secret_key, $public_key); 1118 1312 } … … 1156 1350 * @throws TypeError 1157 1351 */ 1158 function sodium_crypto_sign_publickey($key_pair) 1159 { 1352 function sodium_crypto_sign_publickey( 1353 #[\SensitiveParameter] 1354 $key_pair 1355 ) { 1160 1356 return ParagonIE_Sodium_Compat::crypto_sign_publickey($key_pair); 1161 1357 } … … 1169 1365 * @throws TypeError 1170 1366 */ 1171 function sodium_crypto_sign_publickey_from_secretkey($secret_key) 1172 { 1367 function sodium_crypto_sign_publickey_from_secretkey( 1368 #[\SensitiveParameter] 1369 $secret_key 1370 ) { 1173 1371 return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($secret_key); 1174 1372 } … … 1182 1380 * @throws TypeError 1183 1381 */ 1184 function sodium_crypto_sign_secretkey($key_pair) 1185 { 1382 function sodium_crypto_sign_secretkey( 1383 #[\SensitiveParameter] 1384 $key_pair 1385 ) { 1186 1386 return ParagonIE_Sodium_Compat::crypto_sign_secretkey($key_pair); 1187 1387 } … … 1195 1395 * @throws TypeError 1196 1396 */ 1197 function sodium_crypto_sign_seed_keypair($seed) 1198 { 1397 function sodium_crypto_sign_seed_keypair( 1398 #[\SensitiveParameter] 1399 $seed 1400 ) { 1199 1401 return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); 1200 1402 } … … 1236 1438 * @throws TypeError 1237 1439 */ 1238 function sodium_crypto_sign_ed25519_sk_to_curve25519($secret_key) 1239 { 1440 function sodium_crypto_sign_ed25519_sk_to_curve25519( 1441 #[\SensitiveParameter] 1442 $secret_key 1443 ) { 1240 1444 return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($secret_key); 1241 1445 } … … 1251 1455 * @throws TypeError 1252 1456 */ 1253 function sodium_crypto_stream($length, $nonce, $key) 1254 { 1457 function sodium_crypto_stream( 1458 $length, 1459 $nonce, 1460 #[\SensitiveParameter] 1461 $key 1462 ) { 1255 1463 return ParagonIE_Sodium_Compat::crypto_stream($length, $nonce, $key); 1256 1464 } … … 1277 1485 * @throws TypeError 1278 1486 */ 1279 function sodium_crypto_stream_xor($message, $nonce, $key) 1280 { 1487 function sodium_crypto_stream_xor( 1488 #[\SensitiveParameter] 1489 $message, 1490 $nonce, 1491 #[\SensitiveParameter] 1492 $key 1493 ) { 1281 1494 return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); 1282 1495 } … … 1292 1505 * @throws TypeError 1293 1506 */ 1294 function sodium_hex2bin($string, $ignore = '') 1295 { 1507 function sodium_hex2bin( 1508 #[\SensitiveParameter] 1509 $string, 1510 $ignore = '' 1511 ) { 1296 1512 return ParagonIE_Sodium_Compat::hex2bin($string, $ignore); 1297 1513 } … … 1305 1521 * @throws TypeError 1306 1522 */ 1307 function sodium_increment(&$string) 1308 { 1523 function sodium_increment( 1524 #[\SensitiveParameter] 1525 &$string 1526 ) { 1309 1527 ParagonIE_Sodium_Compat::increment($string); 1310 1528 } … … 1349 1567 * @throws TypeError 1350 1568 */ 1351 function sodium_memcmp($string1, $string2) 1352 { 1569 function sodium_memcmp( 1570 #[\SensitiveParameter] 1571 $string1, 1572 #[\SensitiveParameter] 1573 $string2 1574 ) { 1353 1575 return ParagonIE_Sodium_Compat::memcmp($string1, $string2); 1354 1576 } … … 1364 1586 * @psalm-suppress ReferenceConstraintViolation 1365 1587 */ 1366 function sodium_memzero(&$string) 1367 { 1588 function sodium_memzero( 1589 #[\SensitiveParameter] 1590 &$string 1591 ) { 1368 1592 ParagonIE_Sodium_Compat::memzero($string); 1369 1593 } … … 1378 1602 * @throws TypeError 1379 1603 */ 1380 function sodium_pad($unpadded, $block_size) 1381 { 1604 function sodium_pad( 1605 #[\SensitiveParameter] 1606 $unpadded, 1607 $block_size 1608 ) { 1382 1609 return ParagonIE_Sodium_Compat::pad($unpadded, $block_size, true); 1383 1610 } … … 1392 1619 * @throws TypeError 1393 1620 */ 1394 function sodium_unpad($padded, $block_size) 1395 { 1621 function sodium_unpad( 1622 #[\SensitiveParameter] 1623 $padded, 1624 $block_size 1625 ) { 1396 1626 return ParagonIE_Sodium_Compat::unpad($padded, $block_size, true); 1397 1627 } -
trunk/src/wp-includes/sodium_compat/lib/ristretto255.php
r54310 r58752 48 48 * @throws SodiumException 49 49 */ 50 function sodium_crypto_core_ristretto255_add($p, $q) 51 { 50 function sodium_crypto_core_ristretto255_add( 51 #[\SensitiveParameter] 52 $p, 53 #[\SensitiveParameter] 54 $q 55 ) { 52 56 return ParagonIE_Sodium_Compat::ristretto255_add($p, $q, true); 53 57 } … … 61 65 * @throws SodiumException 62 66 */ 63 function sodium_crypto_core_ristretto255_from_hash($s) 64 { 67 function sodium_crypto_core_ristretto255_from_hash( 68 #[\SensitiveParameter] 69 $s 70 ) { 65 71 return ParagonIE_Sodium_Compat::ristretto255_from_hash($s, true); 66 72 } … … 74 80 * @throws SodiumException 75 81 */ 76 function sodium_crypto_core_ristretto255_is_valid_point($s) 77 { 82 function sodium_crypto_core_ristretto255_is_valid_point( 83 #[\SensitiveParameter] 84 $s 85 ) { 78 86 return ParagonIE_Sodium_Compat::ristretto255_is_valid_point($s, true); 79 87 } … … 100 108 * @throws SodiumException 101 109 */ 102 function sodium_crypto_core_ristretto255_scalar_add($x, $y) 103 { 110 function sodium_crypto_core_ristretto255_scalar_add( 111 #[\SensitiveParameter] 112 $x, 113 #[\SensitiveParameter] 114 $y 115 ) { 104 116 return ParagonIE_Sodium_Compat::ristretto255_scalar_add($x, $y, true); 105 117 } … … 113 125 * @throws SodiumException 114 126 */ 115 function sodium_crypto_core_ristretto255_scalar_complement($s) 116 { 127 function sodium_crypto_core_ristretto255_scalar_complement( 128 #[\SensitiveParameter] 129 $s 130 ) { 117 131 return ParagonIE_Sodium_Compat::ristretto255_scalar_complement($s, true); 118 132 } … … 126 140 * @throws SodiumException 127 141 */ 128 function sodium_crypto_core_ristretto255_scalar_invert($p) 129 { 142 function sodium_crypto_core_ristretto255_scalar_invert( 143 #[\SensitiveParameter] 144 $p 145 ) { 130 146 return ParagonIE_Sodium_Compat::ristretto255_scalar_invert($p, true); 131 147 } … … 140 156 * @throws SodiumException 141 157 */ 142 function sodium_crypto_core_ristretto255_scalar_mul($x, $y) 143 { 158 function sodium_crypto_core_ristretto255_scalar_mul( 159 #[\SensitiveParameter] 160 $x, 161 #[\SensitiveParameter] 162 $y 163 ) { 144 164 return ParagonIE_Sodium_Compat::ristretto255_scalar_mul($x, $y, true); 145 165 } … … 153 173 * @throws SodiumException 154 174 */ 155 function sodium_crypto_core_ristretto255_scalar_negate($s) 156 { 175 function sodium_crypto_core_ristretto255_scalar_negate( 176 #[\SensitiveParameter] 177 $s 178 ) { 157 179 return ParagonIE_Sodium_Compat::ristretto255_scalar_negate($s, true); 158 180 } … … 178 200 * @throws SodiumException 179 201 */ 180 function sodium_crypto_core_ristretto255_scalar_reduce($s) 181 { 202 function sodium_crypto_core_ristretto255_scalar_reduce( 203 #[\SensitiveParameter] 204 $s 205 ) { 182 206 return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce($s, true); 183 207 } … … 192 216 * @throws SodiumException 193 217 */ 194 function sodium_crypto_core_ristretto255_scalar_sub($x, $y) 195 { 218 function sodium_crypto_core_ristretto255_scalar_sub( 219 #[\SensitiveParameter] 220 $x, 221 #[\SensitiveParameter] 222 $y 223 ) { 196 224 return ParagonIE_Sodium_Compat::ristretto255_scalar_sub($x, $y, true); 197 225 } … … 206 234 * @throws SodiumException 207 235 */ 208 function sodium_crypto_core_ristretto255_sub($p, $q) 209 { 236 function sodium_crypto_core_ristretto255_sub( 237 #[\SensitiveParameter] 238 $p, 239 #[\SensitiveParameter] 240 $q 241 ) { 210 242 return ParagonIE_Sodium_Compat::ristretto255_sub($p, $q, true); 211 243 } … … 220 252 * @throws TypeError 221 253 */ 222 function sodium_crypto_scalarmult_ristretto255($n, $p) 223 { 254 function sodium_crypto_scalarmult_ristretto255( 255 #[\SensitiveParameter] 256 $n, 257 #[\SensitiveParameter] 258 $p 259 ) { 224 260 return ParagonIE_Sodium_Compat::scalarmult_ristretto255($n, $p, true); 225 261 } … … 233 269 * @throws TypeError 234 270 */ 235 function sodium_crypto_scalarmult_ristretto255_base($n) 236 { 271 function sodium_crypto_scalarmult_ristretto255_base( 272 #[\SensitiveParameter] 273 $n 274 ) { 237 275 return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base($n, true); 238 276 } -
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 } -
trunk/src/wp-includes/sodium_compat/lib/stream-xchacha20.php
r54150 r58752 11 11 * @throws TypeError 12 12 */ 13 function sodium_crypto_stream_xchacha20($len, $nonce, $key) 14 { 13 function sodium_crypto_stream_xchacha20( 14 $len, 15 $nonce, 16 #[\SensitiveParameter] 17 $key 18 ) { 15 19 return ParagonIE_Sodium_Compat::crypto_stream_xchacha20($len, $nonce, $key, true); 16 20 } … … 37 41 * @throws TypeError 38 42 */ 39 function sodium_crypto_stream_xchacha20_xor($message, $nonce, $key) 40 { 43 function sodium_crypto_stream_xchacha20_xor( 44 #[\SensitiveParameter] 45 $message, 46 $nonce, 47 #[\SensitiveParameter] 48 $key 49 ) { 41 50 return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor($message, $nonce, $key, true); 42 51 } … … 53 62 * @throws TypeError 54 63 */ 55 function sodium_crypto_stream_xchacha20_xor_ic($message, $nonce, $counter, $key) 56 { 64 function sodium_crypto_stream_xchacha20_xor_ic( 65 #[\SensitiveParameter] 66 $message, 67 $nonce, 68 $counter, 69 #[\SensitiveParameter] 70 $key 71 ) { 57 72 return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor_ic($message, $nonce, $counter, $key, true); 58 73 } -
trunk/src/wp-includes/sodium_compat/src/Compat.php
r54310 r58752 60 60 const CRYPTO_AEAD_AES256GCM_NPUBBYTES = 12; 61 61 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; 62 70 const CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES = 32; 63 71 const CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES = 0; … … 156 164 * @throws SodiumException 157 165 */ 158 public static function add(&$val, $addv) 159 { 166 public static function add( 167 #[\SensitiveParameter] 168 &$val, 169 #[\SensitiveParameter] 170 $addv 171 ) { 160 172 $val_len = ParagonIE_Sodium_Core_Util::strlen($val); 161 173 $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv); … … 182 194 * @throws SodiumException 183 195 */ 184 public static function base642bin($encoded, $variant, $ignore = '') 185 { 196 public static function base642bin( 197 #[\SensitiveParameter] 198 $encoded, 199 $variant, 200 $ignore = '' 201 ) { 186 202 /* Type checks: */ 187 203 ParagonIE_Sodium_Core_Util::declareScalarType($encoded, 'string', 1); … … 225 241 * @throws SodiumException 226 242 */ 227 public static function bin2base64($decoded, $variant) 228 { 243 public static function bin2base64( 244 #[\SensitiveParameter] 245 $decoded, 246 $variant 247 ) { 229 248 /* Type checks: */ 230 249 ParagonIE_Sodium_Core_Util::declareScalarType($decoded, 'string', 1); … … 258 277 * @psalm-suppress MixedArgument 259 278 */ 260 public static function bin2hex($string) 261 { 279 public static function bin2hex( 280 #[\SensitiveParameter] 281 $string 282 ) { 262 283 /* Type checks: */ 263 284 ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1); … … 285 306 * @psalm-suppress MixedArgument 286 307 */ 287 public static function compare($left, $right) 288 { 308 public static function compare( 309 #[\SensitiveParameter] 310 $left, 311 #[\SensitiveParameter] 312 $right 313 ) { 289 314 /* Type checks: */ 290 315 ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1); … … 298 323 } 299 324 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); 300 543 } 301 544 … … 352 595 $assocData = '', 353 596 $nonce = '', 597 #[\SensitiveParameter] 354 598 $key = '' 355 599 ) { … … 409 653 */ 410 654 public static function crypto_aead_aes256gcm_encrypt( 655 #[\SensitiveParameter] 411 656 $plaintext = '', 412 657 $assocData = '', 413 658 $nonce = '', 659 #[\SensitiveParameter] 414 660 $key = '' 415 661 ) { … … 485 731 $assocData = '', 486 732 $nonce = '', 733 #[\SensitiveParameter] 487 734 $key = '' 488 735 ) { … … 562 809 */ 563 810 public static function crypto_aead_chacha20poly1305_encrypt( 811 #[\SensitiveParameter] 564 812 $plaintext = '', 565 813 $assocData = '', 566 814 $nonce = '', 815 #[\SensitiveParameter] 567 816 $key = '' 568 817 ) { … … 639 888 $assocData = '', 640 889 $nonce = '', 890 #[\SensitiveParameter] 641 891 $key = '' 642 892 ) { … … 729 979 */ 730 980 public static function crypto_aead_chacha20poly1305_ietf_encrypt( 981 #[\SensitiveParameter] 731 982 $plaintext = '', 732 983 $assocData = '', 733 984 $nonce = '', 985 #[\SensitiveParameter] 734 986 $key = '' 735 987 ) { … … 820 1072 $assocData = '', 821 1073 $nonce = '', 1074 #[\SensitiveParameter] 822 1075 $key = '', 823 1076 $dontFallback = false … … 892 1145 */ 893 1146 public static function crypto_aead_xchacha20poly1305_ietf_encrypt( 1147 #[\SensitiveParameter] 894 1148 $plaintext = '', 895 1149 $assocData = '', 896 1150 $nonce = '', 1151 #[\SensitiveParameter] 897 1152 $key = '', 898 1153 $dontFallback = false … … 972 1227 * @psalm-suppress MixedArgument 973 1228 */ 974 public static function crypto_auth($message, $key) 975 { 1229 public static function crypto_auth( 1230 $message, 1231 #[\SensitiveParameter] 1232 $key 1233 ) { 976 1234 /* Type checks: */ 977 1235 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 1017 1275 * @psalm-suppress MixedArgument 1018 1276 */ 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 ) { 1021 1283 /* Type checks: */ 1022 1284 ParagonIE_Sodium_Core_Util::declareScalarType($mac, 'string', 1); … … 1061 1323 * @psalm-suppress MixedArgument 1062 1324 */ 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 ) { 1065 1331 /* Type checks: */ 1066 1332 ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); … … 1105 1371 * @psalm-suppress MixedArgument 1106 1372 */ 1107 public static function crypto_box_seal($plaintext, $publicKey) 1108 { 1373 public static function crypto_box_seal( 1374 #[\SensitiveParameter] 1375 $plaintext, 1376 $publicKey 1377 ) { 1109 1378 /* Type checks: */ 1110 1379 ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); … … 1143 1412 * @psalm-suppress MixedReturnStatement 1144 1413 */ 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 ) { 1147 1419 /* Type checks: */ 1148 1420 ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); … … 1206 1478 * @psalm-suppress MixedArgument 1207 1479 */ 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 ) { 1210 1485 /* Type checks: */ 1211 1486 ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); … … 1245 1520 * @psalm-suppress MixedReturnStatement 1246 1521 */ 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 ) { 1249 1528 /* Type checks: */ 1250 1529 ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); … … 1288 1567 * @psalm-suppress MixedArgument 1289 1568 */ 1290 public static function crypto_box_publickey($keypair) 1291 { 1569 public static function crypto_box_publickey( 1570 #[\SensitiveParameter] 1571 $keypair 1572 ) { 1292 1573 /* Type checks: */ 1293 1574 ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); … … 1319 1600 * @psalm-suppress MixedArgument 1320 1601 */ 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 ) { 1323 1606 /* Type checks: */ 1324 1607 ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); … … 1350 1633 * @psalm-suppress MixedArgument 1351 1634 */ 1352 public static function crypto_box_secretkey($keypair) 1353 { 1635 public static function crypto_box_secretkey( 1636 #[\SensitiveParameter] 1637 $keypair 1638 ) { 1354 1639 /* Type checks: */ 1355 1640 ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); … … 1382 1667 * @psalm-suppress UndefinedFunction 1383 1668 */ 1384 public static function crypto_box_seed_keypair($seed) 1385 { 1669 public static function crypto_box_seed_keypair( 1670 #[\SensitiveParameter] 1671 $seed 1672 ) { 1386 1673 /* Type checks: */ 1387 1674 ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1); … … 1412 1699 * @psalm-suppress MixedArgument 1413 1700 */ 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 ) { 1416 1707 /* Type checks: */ 1417 1708 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 1456 1747 * @psalm-suppress ConflictingReferenceConstraint 1457 1748 */ 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 ) { 1460 1754 /* Type checks: */ 1461 1755 ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1); … … 1501 1795 * @psalm-suppress MixedArgument 1502 1796 */ 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 ) { 1505 1802 /* Type checks: */ 1506 1803 if (is_null($key)) { … … 1546 1843 */ 1547 1844 public static function crypto_generichash_init_salt_personal( 1845 #[\SensitiveParameter] 1548 1846 $key = '', 1549 1847 $length = self::CRYPTO_GENERICHASH_BYTES, … … 1592 1890 * @psalm-suppress ReferenceConstraintViolation 1593 1891 */ 1594 public static function crypto_generichash_update(&$ctx, $message) 1595 { 1892 public static function crypto_generichash_update( 1893 #[\SensitiveParameter] 1894 &$ctx, 1895 $message 1896 ) { 1596 1897 /* Type checks: */ 1597 1898 ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1); … … 1636 1937 $subkey_id, 1637 1938 $context, 1939 #[\SensitiveParameter] 1638 1940 $key 1639 1941 ) { … … 1713 2015 * @psalm-suppress MixedArgument 1714 2016 */ 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 ) { 1717 2025 /* Type checks: */ 1718 2026 ParagonIE_Sodium_Core_Util::declareScalarType($my_secret, 'string', 1); … … 1775 2083 * @throws SodiumException 1776 2084 */ 1777 public static function crypto_kx_seed_keypair($seed) 1778 { 2085 public static function crypto_kx_seed_keypair( 2086 #[\SensitiveParameter] 2087 $seed 2088 ) { 1779 2089 ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1); 1780 2090 … … 1807 2117 * @throws SodiumException 1808 2118 */ 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 ) { 1811 2124 ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); 1812 2125 ParagonIE_Sodium_Core_Util::declareScalarType($serverPublicKey, 'string', 2); … … 1849 2162 * @throws SodiumException 1850 2163 */ 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 ) { 1853 2169 ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); 1854 2170 ParagonIE_Sodium_Core_Util::declareScalarType($clientPublicKey, 'string', 2); … … 1890 2206 * @throws SodiumException 1891 2207 */ 1892 public static function crypto_kx_secretkey($kp) 1893 { 2208 public static function crypto_kx_secretkey( 2209 #[\SensitiveParameter] 2210 $kp 2211 ) { 1894 2212 return ParagonIE_Sodium_Core_Util::substr( 1895 2213 $kp, … … 1925 2243 * @psalm-suppress MixedArgument 1926 2244 */ 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 ) { 1929 2254 ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1); 1930 2255 ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2); … … 1977 2302 * @psalm-suppress MixedArgument 1978 2303 */ 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 ) { 1981 2310 ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); 1982 2311 ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2); … … 2004 2333 * @throws SodiumException 2005 2334 */ 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 ) { 2008 2341 ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 1); 2009 2342 ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2); … … 2033 2366 * @psalm-suppress MixedArgument 2034 2367 */ 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 ) { 2037 2374 ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); 2038 2375 ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 2); … … 2060 2397 * @throws TypeError 2061 2398 */ 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 ) { 2064 2407 ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1); 2065 2408 ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2); … … 2120 2463 * @throws TypeError 2121 2464 */ 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 ) { 2124 2471 ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); 2125 2472 ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2); … … 2154 2501 * @throws TypeError 2155 2502 */ 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 ) { 2158 2509 ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); 2159 2510 ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 2); … … 2191 2542 * @psalm-suppress MixedArgument 2192 2543 */ 2193 public static function crypto_scalarmult($secretKey, $publicKey) 2194 { 2544 public static function crypto_scalarmult( 2545 #[\SensitiveParameter] 2546 $secretKey, 2547 $publicKey 2548 ) { 2195 2549 /* Type checks: */ 2196 2550 ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); … … 2235 2589 * @psalm-suppress MixedArgument 2236 2590 */ 2237 public static function crypto_scalarmult_base($secretKey) 2238 { 2591 public static function crypto_scalarmult_base( 2592 #[\SensitiveParameter] 2593 $secretKey 2594 ) { 2239 2595 /* Type checks: */ 2240 2596 ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); … … 2273 2629 * @psalm-suppress MixedArgument 2274 2630 */ 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 ) { 2277 2638 /* Type checks: */ 2278 2639 ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); … … 2313 2674 * @psalm-suppress MixedReturnStatement 2314 2675 */ 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 ) { 2317 2682 /* Type checks: */ 2318 2683 ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); … … 2399 2764 * @psalm-suppress MixedArgument 2400 2765 */ 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 ) { 2403 2772 /* Type checks: */ 2404 2773 ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); … … 2426 2795 * @throws SodiumException 2427 2796 */ 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 ) { 2430 2801 if (PHP_INT_SIZE === 4) { 2431 2802 return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_init_push($key); … … 2440 2811 * @throws Exception 2441 2812 */ 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 ) { 2444 2818 if (ParagonIE_Sodium_Core_Util::strlen($header) < self::CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES) { 2445 2819 throw new SodiumException( … … 2461 2835 * @throws SodiumException 2462 2836 */ 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 ) { 2465 2845 if (PHP_INT_SIZE === 4) { 2466 2846 return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_push( … … 2486 2866 * @throws SodiumException 2487 2867 */ 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 ) { 2490 2874 if (PHP_INT_SIZE === 4) { 2491 2875 return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_pull( … … 2516 2900 * @throws SodiumException 2517 2901 */ 2518 public static function crypto_secretstream_xchacha20poly1305_rekey(&$state) 2519 { 2902 public static function crypto_secretstream_xchacha20poly1305_rekey( 2903 #[\SensitiveParameter] 2904 &$state 2905 ) { 2520 2906 if (PHP_INT_SIZE === 4) { 2521 2907 ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_rekey($state); … … 2537 2923 * @psalm-suppress MixedReturnStatement 2538 2924 */ 2539 public static function crypto_shorthash($message, $key) 2540 { 2925 public static function crypto_shorthash( 2926 $message, 2927 #[\SensitiveParameter] 2928 $key 2929 ) { 2541 2930 /* Type checks: */ 2542 2931 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 2587 2976 * @psalm-suppress MixedReturnStatement 2588 2977 */ 2589 public static function crypto_sign($message, $secretKey) 2590 { 2978 public static function crypto_sign( 2979 $message, 2980 #[\SensitiveParameter] 2981 $secretKey 2982 ) { 2591 2983 /* Type checks: */ 2592 2984 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 2623 3015 * @psalm-suppress MixedReturnStatement 2624 3016 */ 2625 public static function crypto_sign_open($signedMessage, $publicKey) 2626 { 3017 public static function crypto_sign_open( 3018 $signedMessage, 3019 $publicKey 3020 ) { 2627 3021 /* Type checks: */ 2628 3022 ParagonIE_Sodium_Core_Util::declareScalarType($signedMessage, 'string', 1); … … 2680 3074 * @throws SodiumException 2681 3075 */ 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 ) { 2684 3081 ParagonIE_Sodium_Core_Util::declareScalarType($sk, 'string', 1); 2685 3082 ParagonIE_Sodium_Core_Util::declareScalarType($pk, 'string', 1); … … 2709 3106 * @psalm-suppress MixedArgument 2710 3107 */ 2711 public static function crypto_sign_seed_keypair($seed) 2712 { 3108 public static function crypto_sign_seed_keypair( 3109 #[\SensitiveParameter] 3110 $seed 3111 ) { 2713 3112 ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1); 2714 3113 … … 2738 3137 * @psalm-suppress MixedArgument 2739 3138 */ 2740 public static function crypto_sign_publickey($keypair) 2741 { 3139 public static function crypto_sign_publickey( 3140 #[\SensitiveParameter] 3141 $keypair 3142 ) { 2742 3143 /* Type checks: */ 2743 3144 ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); … … 2769 3170 * @psalm-suppress MixedArgument 2770 3171 */ 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 ) { 2773 3176 /* Type checks: */ 2774 3177 ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); … … 2800 3203 * @psalm-suppress MixedArgument 2801 3204 */ 2802 public static function crypto_sign_secretkey($keypair) 2803 { 3205 public static function crypto_sign_secretkey( 3206 #[\SensitiveParameter] 3207 $keypair 3208 ) { 2804 3209 /* Type checks: */ 2805 3210 ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); … … 2834 3239 * @psalm-suppress MixedArgument 2835 3240 */ 2836 public static function crypto_sign_detached($message, $secretKey) 2837 { 3241 public static function crypto_sign_detached( 3242 $message, 3243 #[\SensitiveParameter] 3244 $secretKey 3245 ) { 2838 3246 /* Type checks: */ 2839 3247 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 2942 3350 * @psalm-suppress MixedArgument 2943 3351 */ 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 ) { 2946 3356 /* Type checks: */ 2947 3357 ParagonIE_Sodium_Core_Util::declareScalarType($sk, 'string', 1); … … 2984 3394 * @psalm-suppress MixedArgument 2985 3395 */ 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 ) { 2988 3402 /* Type checks: */ 2989 3403 ParagonIE_Sodium_Core_Util::declareScalarType($len, 'int', 1); … … 3031 3445 * @psalm-suppress MixedArgument 3032 3446 */ 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 ) { 3035 3454 /* Type checks: */ 3036 3455 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 3086 3505 * @psalm-suppress MixedArgument 3087 3506 */ 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 ) { 3090 3514 /* Type checks: */ 3091 3515 ParagonIE_Sodium_Core_Util::declareScalarType($len, 'int', 1); … … 3131 3555 * @psalm-suppress MixedArgument 3132 3556 */ 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 ) { 3135 3565 /* Type checks: */ 3136 3566 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 3177 3607 * @psalm-suppress MixedArgument 3178 3608 */ 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 ) { 3181 3618 /* Type checks: */ 3182 3619 ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); … … 3227 3664 * @psalm-suppress MixedArgument 3228 3665 */ 3229 public static function hex2bin($string, $ignore = '') 3230 { 3666 public static function hex2bin( 3667 #[\SensitiveParameter] 3668 $string, 3669 $ignore = '' 3670 ) { 3231 3671 /* Type checks: */ 3232 3672 ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1); … … 3254 3694 * @psalm-suppress MixedArgument 3255 3695 */ 3256 public static function increment(&$var) 3257 { 3696 public static function increment( 3697 #[\SensitiveParameter] 3698 &$var 3699 ) { 3258 3700 /* Type checks: */ 3259 3701 ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1); … … 3288 3730 * @throws SodiumException 3289 3731 */ 3290 public static function is_zero($str) 3291 { 3732 public static function is_zero( 3733 #[\SensitiveParameter] 3734 $str 3735 ) { 3292 3736 $d = 0; 3293 3737 for ($i = 0; $i < 32; ++$i) { … … 3343 3787 * @psalm-suppress MixedArgument 3344 3788 */ 3345 public static function memcmp($left, $right) 3346 { 3789 public static function memcmp( 3790 #[\SensitiveParameter] 3791 $left, 3792 #[\SensitiveParameter] 3793 $right 3794 ) { 3347 3795 /* Type checks: */ 3348 3796 ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1); … … 3372 3820 * @psalm-suppress TooFewArguments 3373 3821 */ 3374 public static function memzero(&$var) 3375 { 3822 public static function memzero( 3823 #[\SensitiveParameter] 3824 &$var 3825 ) { 3376 3826 /* Type checks: */ 3377 3827 ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1); … … 3403 3853 * @throws SodiumException 3404 3854 */ 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 ) { 3407 3861 /* Type checks: */ 3408 3862 ParagonIE_Sodium_Core_Util::declareScalarType($unpadded, 'string', 1); … … 3489 3943 * @throws SodiumException 3490 3944 */ 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 ) { 3493 3951 /* Type checks: */ 3494 3952 ParagonIE_Sodium_Core_Util::declareScalarType($padded, 'string', 1); … … 3644 4102 * @throws SodiumException 3645 4103 */ 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 ) { 3648 4109 if (self::useNewSodiumAPI() && !$dontFallback) { 3649 4110 return sodium_crypto_core_ristretto255_is_valid_point($p); … … 3668 4129 * @throws SodiumException 3669 4130 */ 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 ) { 3672 4138 if (self::useNewSodiumAPI() && !$dontFallback) { 3673 4139 return sodium_crypto_core_ristretto255_add($p, $q); … … 3683 4149 * @throws SodiumException 3684 4150 */ 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 ) { 3687 4158 if (self::useNewSodiumAPI() && !$dontFallback) { 3688 4159 return sodium_crypto_core_ristretto255_sub($p, $q); … … 3698 4169 * @throws SodiumException 3699 4170 */ 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 ) { 3702 4176 if (self::useNewSodiumAPI() && !$dontFallback) { 3703 4177 return sodium_crypto_core_ristretto255_from_hash($r); … … 3740 4214 * @throws SodiumException 3741 4215 */ 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 ) { 3744 4221 if (self::useNewSodiumAPI() && !$dontFallback) { 3745 4222 return sodium_crypto_core_ristretto255_scalar_invert($s); … … 3753 4230 * @throws SodiumException 3754 4231 */ 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 ) { 3757 4237 if (self::useNewSodiumAPI() && !$dontFallback) { 3758 4238 return sodium_crypto_core_ristretto255_scalar_negate($s); … … 3767 4247 * @throws SodiumException 3768 4248 */ 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 ) { 3771 4254 if (self::useNewSodiumAPI() && !$dontFallback) { 3772 4255 return sodium_crypto_core_ristretto255_scalar_complement($s); … … 3782 4265 * @throws SodiumException 3783 4266 */ 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 ) { 3786 4274 if (self::useNewSodiumAPI() && !$dontFallback) { 3787 4275 return sodium_crypto_core_ristretto255_scalar_add($x, $y); … … 3797 4285 * @throws SodiumException 3798 4286 */ 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 ) { 3801 4294 if (self::useNewSodiumAPI() && !$dontFallback) { 3802 4295 return sodium_crypto_core_ristretto255_scalar_sub($x, $y); … … 3812 4305 * @throws SodiumException 3813 4306 */ 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 ) { 3816 4314 if (self::useNewSodiumAPI() && !$dontFallback) { 3817 4315 return sodium_crypto_core_ristretto255_scalar_mul($x, $y); … … 3827 4325 * @throws SodiumException 3828 4326 */ 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 ) { 3831 4334 if (self::useNewSodiumAPI() && !$dontFallback) { 3832 4335 return sodium_crypto_scalarmult_ristretto255($n, $p); … … 3842 4345 * @throws SodiumException 3843 4346 */ 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 ) { 3846 4352 if (self::useNewSodiumAPI() && !$dontFallback) { 3847 4353 return sodium_crypto_scalarmult_ristretto255_base($n); … … 3856 4362 * @throws SodiumException 3857 4363 */ 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 ) { 3860 4369 if (self::useNewSodiumAPI() && !$dontFallback) { 3861 4370 return sodium_crypto_core_ristretto255_scalar_reduce($s); … … 3911 4420 * @throws SodiumException 3912 4421 */ 3913 public static function sub(&$val, $addv) 3914 { 4422 public static function sub( 4423 #[\SensitiveParameter] 4424 &$val, 4425 #[\SensitiveParameter] 4426 $addv 4427 ) { 3915 4428 $val_len = ParagonIE_Sodium_Core_Util::strlen($val); 3916 4429 $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv); -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519/Ge/Cached.php
r46586 r58752 41 41 */ 42 42 public function __construct( 43 ParagonIE_Sodium_Core_Curve25519_Fe$YplusX = null,44 ParagonIE_Sodium_Core_Curve25519_Fe$YminusX = null,45 ParagonIE_Sodium_Core_Curve25519_Fe$Z = null,46 ParagonIE_Sodium_Core_Curve25519_Fe$T2d = null43 $YplusX = null, 44 $YminusX = null, 45 $Z = null, 46 $T2d = null 47 47 ) { 48 48 if ($YplusX === null) { 49 49 $YplusX = new ParagonIE_Sodium_Core_Curve25519_Fe(); 50 } 51 if (!($YplusX instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 52 throw new TypeError('Argument 1 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 50 53 } 51 54 $this->YplusX = $YplusX; … … 53 56 $YminusX = new ParagonIE_Sodium_Core_Curve25519_Fe(); 54 57 } 58 if (!($YminusX instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 59 throw new TypeError('Argument 2 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 60 } 55 61 $this->YminusX = $YminusX; 56 62 if ($Z === null) { 57 63 $Z = new ParagonIE_Sodium_Core_Curve25519_Fe(); 64 } 65 if (!($Z instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 66 throw new TypeError('Argument 3 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 58 67 } 59 68 $this->Z = $Z; … … 61 70 $T2d = new ParagonIE_Sodium_Core_Curve25519_Fe(); 62 71 } 72 if (!($T2d instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 73 throw new TypeError('Argument 4 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 74 } 63 75 $this->T2d = $T2d; 64 76 } -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519/Ge/P1p1.php
r46586 r58752 40 40 */ 41 41 public function __construct( 42 ParagonIE_Sodium_Core_Curve25519_Fe$x = null,43 ParagonIE_Sodium_Core_Curve25519_Fe$y = null,44 ParagonIE_Sodium_Core_Curve25519_Fe$z = null,45 ParagonIE_Sodium_Core_Curve25519_Fe$t = null42 $x = null, 43 $y = null, 44 $z = null, 45 $t = null 46 46 ) { 47 47 if ($x === null) { 48 48 $x = new ParagonIE_Sodium_Core_Curve25519_Fe(); 49 } 50 if (!($x instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 51 throw new TypeError('Argument 1 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 49 52 } 50 53 $this->X = $x; … … 52 55 $y = new ParagonIE_Sodium_Core_Curve25519_Fe(); 53 56 } 57 if (!($y instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 58 throw new TypeError('Argument 2 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 59 } 54 60 $this->Y = $y; 55 61 if ($z === null) { 56 62 $z = new ParagonIE_Sodium_Core_Curve25519_Fe(); 63 } 64 if (!($z instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 65 throw new TypeError('Argument 3 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 57 66 } 58 67 $this->Z = $z; … … 60 69 $t = new ParagonIE_Sodium_Core_Curve25519_Fe(); 61 70 } 71 if (!($t instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 72 throw new TypeError('Argument 4 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 73 } 62 74 $this->T = $t; 63 75 } -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519/Ge/P2.php
r46586 r58752 35 35 */ 36 36 public function __construct( 37 ParagonIE_Sodium_Core_Curve25519_Fe$x = null,38 ParagonIE_Sodium_Core_Curve25519_Fe$y = null,39 ParagonIE_Sodium_Core_Curve25519_Fe$z = null37 $x = null, 38 $y = null, 39 $z = null 40 40 ) { 41 41 if ($x === null) { 42 42 $x = new ParagonIE_Sodium_Core_Curve25519_Fe(); 43 } 44 if (!($x instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 45 throw new TypeError('Argument 1 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 43 46 } 44 47 $this->X = $x; … … 46 49 $y = new ParagonIE_Sodium_Core_Curve25519_Fe(); 47 50 } 51 if (!($y instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 52 throw new TypeError('Argument 2 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 53 } 48 54 $this->Y = $y; 49 55 if ($z === null) { 50 56 $z = new ParagonIE_Sodium_Core_Curve25519_Fe(); 51 57 } 58 if (!($z instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 59 throw new TypeError('Argument 3 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 60 } 52 61 $this->Z = $z; 53 62 } -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519/Ge/P3.php
r46586 r58752 41 41 */ 42 42 public function __construct( 43 ParagonIE_Sodium_Core_Curve25519_Fe$x = null,44 ParagonIE_Sodium_Core_Curve25519_Fe$y = null,45 ParagonIE_Sodium_Core_Curve25519_Fe$z = null,46 ParagonIE_Sodium_Core_Curve25519_Fe$t = null43 $x = null, 44 $y = null, 45 $z = null, 46 $t = null 47 47 ) { 48 48 if ($x === null) { 49 49 $x = new ParagonIE_Sodium_Core_Curve25519_Fe(); 50 } 51 if (!($x instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 52 throw new TypeError('Argument 1 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 50 53 } 51 54 $this->X = $x; … … 53 56 $y = new ParagonIE_Sodium_Core_Curve25519_Fe(); 54 57 } 58 if (!($y instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 59 throw new TypeError('Argument 2 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 60 } 55 61 $this->Y = $y; 56 62 if ($z === null) { 57 63 $z = new ParagonIE_Sodium_Core_Curve25519_Fe(); 64 } 65 if (!($z instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 66 throw new TypeError('Argument 3 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 58 67 } 59 68 $this->Z = $z; … … 61 70 $t = new ParagonIE_Sodium_Core_Curve25519_Fe(); 62 71 } 72 if (!($t instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 73 throw new TypeError('Argument 4 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 74 } 63 75 $this->T = $t; 64 76 } -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519/Ge/Precomp.php
r46586 r58752 35 35 */ 36 36 public function __construct( 37 ParagonIE_Sodium_Core_Curve25519_Fe$yplusx = null,38 ParagonIE_Sodium_Core_Curve25519_Fe$yminusx = null,39 ParagonIE_Sodium_Core_Curve25519_Fe$xy2d = null37 $yplusx = null, 38 $yminusx = null, 39 $xy2d = null 40 40 ) { 41 41 if ($yplusx === null) { 42 42 $yplusx = new ParagonIE_Sodium_Core_Curve25519_Fe(); 43 } 44 if (!($yplusx instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 45 throw new TypeError('Argument 1 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 43 46 } 44 47 $this->yplusx = $yplusx; … … 46 49 $yminusx = new ParagonIE_Sodium_Core_Curve25519_Fe(); 47 50 } 51 if (!($yminusx instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 52 throw new TypeError('Argument 2 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 53 } 48 54 $this->yminusx = $yminusx; 49 55 if ($xy2d === null) { 50 56 $xy2d = new ParagonIE_Sodium_Core_Curve25519_Fe(); 51 57 } 58 if (!($xy2d instanceof ParagonIE_Sodium_Core_Curve25519_Fe)) { 59 throw new TypeError('Argument 3 must be an instance of ParagonIE_Sodium_Core_Curve25519_Fe'); 60 } 52 61 $this->xy2d = $xy2d; 53 62 } -
trunk/src/wp-includes/sodium_compat/src/Core/Util.php
r54310 r58752 10 10 abstract class ParagonIE_Sodium_Core_Util 11 11 { 12 const U32_MAX = 0xFFFFFFFF; 13 12 14 /** 13 15 * @param int $integer … … 32 34 (($negative >> $realSize) & 1) 33 35 ); 36 } 37 38 /** 39 * @param string $a 40 * @param string $b 41 * @return string 42 * @throws SodiumException 43 */ 44 public static function andStrings($a, $b) 45 { 46 /* Type checks: */ 47 if (!is_string($a)) { 48 throw new TypeError('Argument 1 must be a string'); 49 } 50 if (!is_string($b)) { 51 throw new TypeError('Argument 2 must be a string'); 52 } 53 $len = self::strlen($a); 54 if (self::strlen($b) !== $len) { 55 throw new SodiumException('Both strings must be of equal length to combine with bitwise AND'); 56 } 57 return $a & $b; 34 58 } 35 59 -
trunk/src/wp-includes/sodium_compat/src/File.php
r52988 r58752 26 26 * @throws TypeError 27 27 */ 28 public static function box($inputFile, $outputFile, $nonce, $keyPair) 29 { 28 public static function box( 29 $inputFile, 30 $outputFile, 31 $nonce, 32 #[\SensitiveParameter] 33 $keyPair 34 ) { 30 35 /* Type checks: */ 31 36 if (!is_string($inputFile)) { … … 92 97 * @throws TypeError 93 98 */ 94 public static function box_open($inputFile, $outputFile, $nonce, $keypair) 95 { 99 public static function box_open( 100 $inputFile, 101 $outputFile, 102 $nonce, 103 #[\SensitiveParameter] 104 $keypair 105 ) { 96 106 /* Type checks: */ 97 107 if (!is_string($inputFile)) { … … 162 172 * @throws TypeError 163 173 */ 164 public static function box_seal($inputFile, $outputFile, $publicKey) 165 { 174 public static function box_seal( 175 $inputFile, 176 $outputFile, 177 #[\SensitiveParameter] 178 $publicKey 179 ) { 166 180 /* Type checks: */ 167 181 if (!is_string($inputFile)) { … … 266 280 * @throws TypeError 267 281 */ 268 public static function box_seal_open($inputFile, $outputFile, $ecdhKeypair) 269 { 282 public static function box_seal_open( 283 $inputFile, 284 $outputFile, 285 #[\SensitiveParameter] 286 $ecdhKeypair 287 ) { 270 288 /* Type checks: */ 271 289 if (!is_string($inputFile)) { … … 351 369 * @psalm-suppress FailedTypeResolution 352 370 */ 353 public static function generichash($filePath, $key = '', $outputLength = 32) 354 { 371 public static function generichash( 372 $filePath, 373 #[\SensitiveParameter] 374 $key = '', 375 $outputLength = 32 376 ) { 355 377 /* Type checks: */ 356 378 if (!is_string($filePath)) { … … 429 451 * @throws TypeError 430 452 */ 431 public static function secretbox($inputFile, $outputFile, $nonce, $key) 432 { 453 public static function secretbox( 454 $inputFile, 455 $outputFile, 456 $nonce, 457 #[\SensitiveParameter] 458 $key 459 ) { 433 460 /* Type checks: */ 434 461 if (!is_string($inputFile)) { … … 494 521 * @throws TypeError 495 522 */ 496 public static function secretbox_open($inputFile, $outputFile, $nonce, $key) 497 { 523 public static function secretbox_open( 524 $inputFile, 525 $outputFile, 526 $nonce, 527 #[\SensitiveParameter] 528 $key 529 ) { 498 530 /* Type checks: */ 499 531 if (!is_string($inputFile)) { … … 561 593 * @throws TypeError 562 594 */ 563 public static function sign($filePath, $secretKey) 564 { 595 public static function sign( 596 $filePath, 597 #[\SensitiveParameter] 598 $secretKey 599 ) { 565 600 /* Type checks: */ 566 601 if (!is_string($filePath)) { … … 657 692 * @throws Exception 658 693 */ 659 public static function verify($sig, $filePath, $publicKey) 660 { 694 public static function verify( 695 $sig, 696 $filePath, 697 $publicKey 698 ) { 661 699 /* Type checks: */ 662 700 if (!is_string($sig)) {
Note: See TracChangeset
for help on using the changeset viewer.