diff options
-rw-r--r-- | ext/sodium/libsodium.stub.php | 100 | ||||
-rw-r--r-- | ext/sodium/libsodium_arginfo.h | 153 | ||||
-rw-r--r-- | ext/sodium/tests/crypto_box.phpt | 2 | ||||
-rw-r--r-- | ext/sodium/tests/sodium_error_001.phpt | 2 |
4 files changed, 138 insertions, 119 deletions
diff --git a/ext/sodium/libsodium.stub.php b/ext/sodium/libsodium.stub.php index 6429c3beba..b2bfd35730 100644 --- a/ext/sodium/libsodium.stub.php +++ b/ext/sodium/libsodium.stub.php @@ -5,87 +5,87 @@ function sodium_crypto_aead_aes256gcm_is_available(): bool {} #ifdef HAVE_AESGCM -function sodium_crypto_aead_aes256gcm_decrypt(string $string, string $ad, string $nonce, string $key): string|false {} +function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -function sodium_crypto_aead_aes256gcm_encrypt(string $string, string $ad, string $nonce, string $key): string {} +function sodium_crypto_aead_aes256gcm_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} function sodium_crypto_aead_aes256gcm_keygen(): string {} #endif -function sodium_crypto_aead_chacha20poly1305_decrypt(string $string, string $ad, string $nonce, string $key): string|false {} +function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -function sodium_crypto_aead_chacha20poly1305_encrypt(string $string, string $ad, string $nonce, string $key): string {} +function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} function sodium_crypto_aead_chacha20poly1305_keygen(): string {} -function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $string, string $ad, string $nonce, string $key): string|false {} +function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $string, string $ad, string $nonce, string $key): string {} +function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {} #ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES -function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $string, string $ad, string $nonce, string $key): string|false {} +function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {} -function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $string, string $ad, string $nonce, string $key): string {} +function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} #endif -function sodium_crypto_auth(string $string, string $key): string {} +function sodium_crypto_auth(string $message, string $key): string {} function sodium_crypto_auth_keygen(): string {} -function sodium_crypto_auth_verify(string $signature, string $string, string $key): bool {} +function sodium_crypto_auth_verify(string $mac, string $message, string $key): bool {} -function sodium_crypto_box(string $string, string $nonce, string $key): string {} +function sodium_crypto_box(string $message, string $nonce, string $key_pair): string {} function sodium_crypto_box_keypair(): string {} -function sodium_crypto_box_seed_keypair(string $key): string {} +function sodium_crypto_box_seed_keypair(string $seed): string {} function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {} -function sodium_crypto_box_open(string $string, string $nonce, string $key): string|false {} +function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false {} -function sodium_crypto_box_publickey(string $key): string {} +function sodium_crypto_box_publickey(string $key_pair): string {} -function sodium_crypto_box_publickey_from_secretkey(string $key): string {} +function sodium_crypto_box_publickey_from_secretkey(string $secret_key): string {} -function sodium_crypto_box_seal(string $string, string $key): string {} +function sodium_crypto_box_seal(string $message, string $key_pair): string {} -function sodium_crypto_box_seal_open(string $string, string $key): string|false {} +function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string|false {} -function sodium_crypto_box_secretkey(string $key): string {} +function sodium_crypto_box_secretkey(string $key_pair): string {} function sodium_crypto_kx_keypair(): string {} -function sodium_crypto_kx_publickey(string $key): string {} +function sodium_crypto_kx_publickey(string $key_pair): string {} -function sodium_crypto_kx_secretkey(string $key): string {} +function sodium_crypto_kx_secretkey(string $key_pair): string {} -function sodium_crypto_kx_seed_keypair(string $string): string {} +function sodium_crypto_kx_seed_keypair(string $seed): string {} -function sodium_crypto_kx_client_session_keys(string $client_keypair, string $server_key): array {} +function sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array {} -function sodium_crypto_kx_server_session_keys(string $server_keypair, string $client_key): array {} +function sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array {} -function sodium_crypto_generichash(string $string, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} +function sodium_crypto_generichash(string $message, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} function sodium_crypto_generichash_keygen(): string {} function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} -function sodium_crypto_generichash_update(string &$state, string $string): bool {} +function sodium_crypto_generichash_update(string &$state, string $message): bool {} function sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} -function sodium_crypto_kdf_derive_from_key(int $subkey_len, int $subkey_id, string $context, string $key): string {} +function sodium_crypto_kdf_derive_from_key(int $subkey_length, int $subkey_id, string $context, string $key): string {} function sodium_crypto_kdf_keygen(): string {} #ifdef crypto_pwhash_SALTBYTES -function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $alg = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {} +function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $algo = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {} function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {} @@ -104,71 +104,71 @@ function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $op function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {} #endif -function sodium_crypto_scalarmult(string $string_1, string $string_2): string {} +function sodium_crypto_scalarmult(string $n, string $p): string {} -function sodium_crypto_secretbox(string $string, string $nonce, string $key): string {} +function sodium_crypto_secretbox(string $message, string $nonce, string $key): string {} function sodium_crypto_secretbox_keygen(): string {} -function sodium_crypto_secretbox_open(string $string, string $nonce, string $key): string|false {} +function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false {} #ifdef crypto_secretstream_xchacha20poly1305_ABYTES function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {} function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {} -function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $msg, string $ad = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {} +function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $message, string $additional_data = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {} -function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $string, string $key): string {} +function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $header, string $key): string {} -function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $c, string $ad = ""): array|false {} +function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ""): array|false {} function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {} #endif -function sodium_crypto_shorthash(string $string, string $key): string {} +function sodium_crypto_shorthash(string $message, string $key): string {} function sodium_crypto_shorthash_keygen(): string {} -function sodium_crypto_sign(string $string, string $keypair): string {} +function sodium_crypto_sign(string $message, string $secret_key): string {} -function sodium_crypto_sign_detached(string $string, string $keypair): string {} +function sodium_crypto_sign_detached(string $message, string $secret_key): string {} -function sodium_crypto_sign_ed25519_pk_to_curve25519(string $key): string {} +function sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string {} -function sodium_crypto_sign_ed25519_sk_to_curve25519(string $key): string {} +function sodium_crypto_sign_ed25519_sk_to_curve25519(string $secret_key): string {} function sodium_crypto_sign_keypair(): string {} function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {} -function sodium_crypto_sign_open(string $string, string $keypair): string|false {} +function sodium_crypto_sign_open(string $ciphertext, string $public_key): string|false {} -function sodium_crypto_sign_publickey(string $key): string {} +function sodium_crypto_sign_publickey(string $key_pair): string {} -function sodium_crypto_sign_secretkey(string $key): string {} +function sodium_crypto_sign_secretkey(string $key_pair): string {} -function sodium_crypto_sign_publickey_from_secretkey(string $key): string {} +function sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string {} -function sodium_crypto_sign_seed_keypair(string $key): string {} +function sodium_crypto_sign_seed_keypair(string $seed): string {} -function sodium_crypto_sign_verify_detached(string $signature, string $string, string $key): bool {} +function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): bool {} function sodium_crypto_stream(int $length, string $nonce, string $key): string {} function sodium_crypto_stream_keygen(): string {} -function sodium_crypto_stream_xor(string $string, string $nonce, string $key): string {} +function sodium_crypto_stream_xor(string $message, string $nonce, string $key): string {} -function sodium_add(string &$string_1, string $string_2): void {} +function sodium_add(string &$string1, string $string2): void {} -function sodium_compare(string $string_1, string $string_2): int {} +function sodium_compare(string $string1, string $string2): int {} function sodium_increment(string &$string): void {} -function sodium_memcmp(string $string_1, string $string_2): int {} +function sodium_memcmp(string $string1, string $string2): int {} -function sodium_memzero(string &$reference): void {} +function sodium_memzero(string &$string): void {} function sodium_pad(string $string, int $length): string {} @@ -185,4 +185,4 @@ function sodium_base642bin(string $string, int $id, string $ignore = ""): strin #endif /** @alias sodium_crypto_box_publickey_from_secretkey */ -function sodium_crypto_scalarmult_base(string $key): string {} +function sodium_crypto_scalarmult_base(string $secret_key): string {} diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h index 4f06398bde..9b0d4b0f1d 100644 --- a/ext/sodium/libsodium_arginfo.h +++ b/ext/sodium/libsodium_arginfo.h @@ -1,13 +1,13 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5d064655caf10f5e0dd126009755bf3552c63f59 */ + * Stub hash: 60259c3fefaf8ba8ac22bf80147c3525387ec763 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() #if defined(HAVE_AESGCM) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_aead_aes256gcm_decrypt, 0, 4, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, additional_data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -15,8 +15,8 @@ ZEND_END_ARG_INFO() #if defined(HAVE_AESGCM) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_encrypt, 0, 4, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, additional_data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -28,15 +28,15 @@ ZEND_END_ARG_INFO() #endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_aead_chacha20poly1305_decrypt, 0, 4, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, additional_data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_chacha20poly1305_encrypt, 0, 4, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, additional_data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -52,8 +52,8 @@ ZEND_END_ARG_INFO() #if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, 0, 4, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, additional_data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -66,36 +66,36 @@ ZEND_END_ARG_INFO() #if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, 0, 4, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, additional_data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() #endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_auth, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_sodium_crypto_auth_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_auth_verify, 0, 3, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, signature, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, mac, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box, 0, 3, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key_pair, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_sodium_crypto_box_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_seed_keypair, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, seed, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey, 0, 2, IS_STRING, 0) @@ -104,46 +104,51 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_keypair_from_s ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_box_open, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key_pair, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_box_publickey arginfo_sodium_crypto_box_seed_keypair +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_publickey, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key_pair, IS_STRING, 0) +ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_box_publickey_from_secretkey arginfo_sodium_crypto_box_seed_keypair +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_publickey_from_secretkey, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, secret_key, IS_STRING, 0) +ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_box_seal arginfo_sodium_crypto_auth +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_seal, 0, 2, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key_pair, IS_STRING, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_box_seal_open, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key_pair, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_box_secretkey arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_box_secretkey arginfo_sodium_crypto_box_publickey #define arginfo_sodium_crypto_kx_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen -#define arginfo_sodium_crypto_kx_publickey arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_kx_publickey arginfo_sodium_crypto_box_publickey -#define arginfo_sodium_crypto_kx_secretkey arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_kx_secretkey arginfo_sodium_crypto_box_publickey -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_seed_keypair, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) -ZEND_END_ARG_INFO() +#define arginfo_sodium_crypto_kx_seed_keypair arginfo_sodium_crypto_box_seed_keypair ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_client_session_keys, 0, 2, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, client_keypair, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, client_key_pair, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_server_session_keys, 0, 2, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, server_keypair, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, server_key_pair, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, client_key, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "SODIUM_CRYPTO_GENERICHASH_BYTES") ZEND_END_ARG_INFO() @@ -157,7 +162,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_update, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_final, 0, 1, IS_STRING, 0) @@ -166,7 +171,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_final, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kdf_derive_from_key, 0, 4, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, subkey_len, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, subkey_length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, subkey_id, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) @@ -181,7 +186,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash, 0, 5, IS_S ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, alg, IS_LONG, 0, "SODIUM_CRYPTO_PWHASH_ALG_DEFAULT") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, algo, IS_LONG, 0, "SODIUM_CRYPTO_PWHASH_ALG_DEFAULT") ZEND_END_ARG_INFO() #endif @@ -234,15 +239,23 @@ ZEND_END_ARG_INFO() #endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_scalarmult, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string_1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, n, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, p, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_secretbox arginfo_sodium_crypto_box +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretbox, 0, 3, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +ZEND_END_ARG_INFO() #define arginfo_sodium_crypto_secretbox_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen -#define arginfo_sodium_crypto_secretbox_open arginfo_sodium_crypto_box_open +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_secretbox_open, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +ZEND_END_ARG_INFO() #if defined(crypto_secretstream_xchacha20poly1305_ABYTES) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_keygen, 0, 0, IS_STRING, 0) @@ -258,15 +271,15 @@ ZEND_END_ARG_INFO() #if defined(crypto_secretstream_xchacha20poly1305_ABYTES) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_push, 0, 2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, msg, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ad, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_data, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tag, IS_LONG, 0, "SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE") ZEND_END_ARG_INFO() #endif #if defined(crypto_secretstream_xchacha20poly1305_ABYTES) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_pull, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, header, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() #endif @@ -274,8 +287,8 @@ ZEND_END_ARG_INFO() #if defined(crypto_secretstream_xchacha20poly1305_ABYTES) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_pull, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, c, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ad, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_data, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() #endif @@ -290,34 +303,40 @@ ZEND_END_ARG_INFO() #define arginfo_sodium_crypto_shorthash_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_sign, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, keypair, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, secret_key, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_sodium_crypto_sign_detached arginfo_sodium_crypto_sign -#define arginfo_sodium_crypto_sign_ed25519_pk_to_curve25519 arginfo_sodium_crypto_box_seed_keypair +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_sign_ed25519_pk_to_curve25519, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, public_key, IS_STRING, 0) +ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_sign_ed25519_sk_to_curve25519 arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_sign_ed25519_sk_to_curve25519 arginfo_sodium_crypto_box_publickey_from_secretkey #define arginfo_sodium_crypto_sign_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen #define arginfo_sodium_crypto_sign_keypair_from_secretkey_and_publickey arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_sign_open, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, keypair, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, ciphertext, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, public_key, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_sodium_crypto_sign_publickey arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_sign_publickey arginfo_sodium_crypto_box_publickey -#define arginfo_sodium_crypto_sign_secretkey arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_sign_secretkey arginfo_sodium_crypto_box_publickey -#define arginfo_sodium_crypto_sign_publickey_from_secretkey arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_sign_publickey_from_secretkey arginfo_sodium_crypto_box_publickey_from_secretkey #define arginfo_sodium_crypto_sign_seed_keypair arginfo_sodium_crypto_box_seed_keypair -#define arginfo_sodium_crypto_sign_verify_detached arginfo_sodium_crypto_auth_verify +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_sign_verify_detached, 0, 3, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, signature, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, public_key, IS_STRING, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_stream, 0, 3, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) @@ -327,16 +346,16 @@ ZEND_END_ARG_INFO() #define arginfo_sodium_crypto_stream_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen -#define arginfo_sodium_crypto_stream_xor arginfo_sodium_crypto_box +#define arginfo_sodium_crypto_stream_xor arginfo_sodium_crypto_secretbox ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_add, 0, 2, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(1, string_1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(1, string1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string2, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_compare, 0, 2, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, string_1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string2, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_increment, 0, 1, IS_VOID, 0) @@ -345,9 +364,7 @@ ZEND_END_ARG_INFO() #define arginfo_sodium_memcmp arginfo_sodium_compare -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_memzero, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(1, reference, IS_STRING, 0) -ZEND_END_ARG_INFO() +#define arginfo_sodium_memzero arginfo_sodium_increment ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_pad, 0, 2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) @@ -359,7 +376,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_unpad, 0, 2, IS_STRING, 0 ZEND_ARG_TYPE_INFO(0, block_size, IS_LONG, 0) ZEND_END_ARG_INFO() -#define arginfo_sodium_bin2hex arginfo_sodium_crypto_kx_seed_keypair +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_bin2hex, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_hex2bin, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) @@ -381,7 +400,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_base642bin, 0, 2, IS_STRI ZEND_END_ARG_INFO() #endif -#define arginfo_sodium_crypto_scalarmult_base arginfo_sodium_crypto_box_seed_keypair +#define arginfo_sodium_crypto_scalarmult_base arginfo_sodium_crypto_box_publickey_from_secretkey ZEND_FUNCTION(sodium_crypto_aead_aes256gcm_is_available); diff --git a/ext/sodium/tests/crypto_box.phpt b/ext/sodium/tests/crypto_box.phpt index b5c1d79d85..3a55717d53 100644 --- a/ext/sodium/tests/crypto_box.phpt +++ b/ext/sodium/tests/crypto_box.phpt @@ -142,7 +142,7 @@ bool(true) bool(true) bool(true) bool(true) -sodium_crypto_box(): Argument #3 ($key) must be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes long +sodium_crypto_box(): Argument #3 ($key_pair) must be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes long bool(true) string(17) "Hi, this is Alice" string(21) "Hi Alice! This is Bob" diff --git a/ext/sodium/tests/sodium_error_001.phpt b/ext/sodium/tests/sodium_error_001.phpt index 5ebcb8e80e..a78d071a10 100644 --- a/ext/sodium/tests/sodium_error_001.phpt +++ b/ext/sodium/tests/sodium_error_001.phpt @@ -15,7 +15,7 @@ $key = random_bytes(SODIUM_CRYPTO_SHORTHASH_KEYBYTES); $hash = do_crypto_shorthash($m, $key); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: sodium_crypto_shorthash(): Argument #1 ($string) must be of type string, int given in %s:%d +Fatal error: Uncaught TypeError: sodium_crypto_shorthash(): Argument #1 ($message) must be of type string, int given in %s:%d Stack trace: #0 %s(%d): sodium_crypto_shorthash() #1 %s(%d): do_crypto_shorthash() |