Skip to content

Commit 5034401

Browse files
authored
Merge pull request #15 from PHPCompatibility/feature/update-for-compatibility-with-sodium-compat-v1.11.0
Update for compatibility with sodium_compat v 1.11.0
2 parents b1bb79a + d2583e2 commit 5034401

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

PHPCompatibilityParagonieSodiumCompat/ruleset.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
<exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_noncebytesFound"/>
7878
<exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_version_majorFound"/>
7979
<exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_version_minorFound"/>
80+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_addFound"/>
81+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_base642binFound"/>
82+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2base64Found"/>
8083
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2hexFound"/>
8184
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_compareFound"/>
8285
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_aes256gcm_decryptFound"/>
@@ -109,8 +112,17 @@
109112
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_initFound"/>
110113
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_keygenFound"/>
111114
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_updateFound"/>
115+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kdf_derive_from_keyFound"/>
116+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kdf_keygenFound"/>
112117
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kxFound"/>
118+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_client_session_keysFound"/>
119+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_keypairFound"/>
120+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_publickeyFound"/>
121+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_secretkeyFound"/>
122+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_seed_keypairFound"/>
123+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_server_session_keysFound"/>
113124
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_strFound"/>
125+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_needs_rehashFound"/>
114126
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_verifyFound"/>
115127
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256Found"/>
116128
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256_strFound"/>
@@ -120,11 +132,18 @@
120132
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretboxFound"/>
121133
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_keygenFound"/>
122134
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_openFound"/>
135+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_keygenFound"/>
136+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_init_pullFound"/>
137+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_init_pushFound"/>
138+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_pullFound"/>
139+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_pushFound"/>
140+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_rekeyFound"/>
123141
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthashFound"/>
124142
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthash_keygenFound"/>
125143
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_signFound"/>
126144
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_detachedFound"/>
127145
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypairFound"/>
146+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypair_from_secretkey_and_publickeyFound"/>
128147
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_openFound"/>
129148
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickeyFound"/>
130149
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickey_from_secretkeyFound"/>
@@ -142,9 +161,11 @@
142161
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_minorFound"/>
143162
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_version_stringFound"/>
144163
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_memcmpFound"/>
164+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_padFound"/>
145165
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_bufFound"/>
146166
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_uniformFound"/>
147167
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_random16Found"/>
168+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_unpadFound"/>
148169
</rule>
149170

150171
<!-- Prevent false positives being thrown when run over the code of sodium_compat itself. -->

Test/ParagonieSodiumCompatTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ function SodiumExceptionTypeHint( SodiumException $a ) {}
7272
echo SODIUM_LIBRARY_VERSION_MAJOR;
7373
echo SODIUM_LIBRARY_VERSION_MINOR;
7474

75+
sodium_add();
76+
sodium_base642bin();
77+
sodium_bin2base64();
7578
sodium_bin2hex();
7679
sodium_compare();
7780
sodium_crypto_aead_aes256gcm_decrypt();
@@ -104,8 +107,16 @@ function SodiumExceptionTypeHint( SodiumException $a ) {}
104107
sodium_crypto_generichash_init();
105108
sodium_crypto_generichash_keygen();
106109
sodium_crypto_generichash_update();
110+
sodium_crypto_kdf_derive_from_key();
107111
sodium_crypto_kx();
112+
sodium_crypto_kx_client_session_keys();
113+
sodium_crypto_kx_keypair();
114+
sodium_crypto_kx_publickey();
115+
sodium_crypto_kx_secretkey();
116+
sodium_crypto_kx_seed_keypair();
117+
sodium_crypto_kx_server_session_keys();
108118
sodium_crypto_pwhash_str();
119+
sodium_crypto_pwhash_str_needs_rehash();
109120
sodium_crypto_pwhash_str_verify();
110121
sodium_crypto_pwhash_scryptsalsa208sha256();
111122
sodium_crypto_pwhash_scryptsalsa208sha256_str();
@@ -115,11 +126,18 @@ function SodiumExceptionTypeHint( SodiumException $a ) {}
115126
sodium_crypto_secretbox();
116127
sodium_crypto_secretbox_keygen();
117128
sodium_crypto_secretbox_open();
129+
sodium_crypto_secretstream_xchacha20poly1305_keygen();
130+
sodium_crypto_secretstream_xchacha20poly1305_init_pull();
131+
sodium_crypto_secretstream_xchacha20poly1305_init_push();
132+
sodium_crypto_secretstream_xchacha20poly1305_pull();
133+
sodium_crypto_secretstream_xchacha20poly1305_push();
134+
sodium_crypto_secretstream_xchacha20poly1305_rekey();
118135
sodium_crypto_shorthash();
119136
sodium_crypto_shorthash_keygen();
120137
sodium_crypto_sign();
121138
sodium_crypto_sign_detached();
122139
sodium_crypto_sign_keypair();
140+
sodium_crypto_sign_keypair_from_secretkey_and_publickey();
123141
sodium_crypto_sign_open();
124142
sodium_crypto_sign_publickey();
125143
sodium_crypto_sign_publickey_from_secretkey();
@@ -137,6 +155,8 @@ function SodiumExceptionTypeHint( SodiumException $a ) {}
137155
sodium_library_version_minor();
138156
sodium_version_string();
139157
sodium_memcmp();
158+
sodium_pad();
140159
sodium_randombytes_buf();
141160
sodium_randombytes_uniform();
142161
sodium_randombytes_random16();
162+
sodium_unpad();

0 commit comments

Comments
 (0)