From a53efb446830b22d2a3ef1e69b3517634ce8a28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 25 Aug 2021 16:39:50 +0200 Subject: [PATCH 1/2] Generate optimizer func info from stubs for ext/sodium --- Zend/Optimizer/zend_func_info.c | 68 ------------------------- Zend/Optimizer/zend_func_infos.h | 85 ++++++++++++++++++++++++++++++++ ext/sodium/libsodium.stub.php | 71 ++++++++++++++++++++++++++ ext/sodium/libsodium_arginfo.h | 2 +- 4 files changed, 157 insertions(+), 69 deletions(-) diff --git a/Zend/Optimizer/zend_func_info.c b/Zend/Optimizer/zend_func_info.c index 10cb135ef7061..86575c190f381 100644 --- a/Zend/Optimizer/zend_func_info.c +++ b/Zend/Optimizer/zend_func_info.c @@ -527,74 +527,6 @@ static const func_info_t old_func_infos[] = { F1("mhash_get_hash_name", MAY_BE_FALSE | MAY_BE_STRING), F1("mhash", MAY_BE_FALSE | MAY_BE_FALSE | MAY_BE_STRING), - /* ext/sodium */ - F1("sodium_crypto_shorthash", MAY_BE_STRING), - F1("sodium_crypto_secretbox", MAY_BE_STRING), - F1("sodium_crypto_secretbox_open", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_generichash", MAY_BE_STRING), - F1("sodium_crypto_generichash_init", MAY_BE_STRING), - F0("sodium_crypto_generichash_update", MAY_BE_TRUE), - F1("sodium_crypto_generichash_final", MAY_BE_STRING), - F1("sodium_crypto_box_keypair", MAY_BE_STRING), - F1("sodium_crypto_box_seed_keypair", MAY_BE_STRING), - F1("sodium_crypto_box_secretkey", MAY_BE_STRING), - F1("sodium_crypto_box_publickey", MAY_BE_STRING), - F1("sodium_crypto_box", MAY_BE_STRING), - F1("sodium_crypto_box_open", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_box_seal", MAY_BE_STRING), - F1("sodium_crypto_box_seal_open", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_sign_keypair", MAY_BE_STRING), - F1("sodium_crypto_sign_seed_keypair", MAY_BE_STRING), - F1("sodium_crypto_sign_secretkey", MAY_BE_STRING), - F1("sodium_crypto_sign_publickey", MAY_BE_STRING), - F1("sodium_crypto_sign", MAY_BE_STRING), - F1("sodium_crypto_sign_open", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_sign_detached", MAY_BE_STRING), - F1("sodium_crypto_stream", MAY_BE_STRING), - F1("sodium_crypto_stream_xor", MAY_BE_STRING), - F1("sodium_crypto_pwhash", MAY_BE_STRING), - F1("sodium_crypto_pwhash_str", MAY_BE_STRING), - F1("sodium_crypto_aead_aes256gcm_encrypt", MAY_BE_STRING), - F1("sodium_crypto_aead_aes256gcm_decrypt", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_bin2hex", MAY_BE_STRING), - F1("sodium_hex2bin", MAY_BE_STRING), - F1("sodium_crypto_scalarmult", MAY_BE_STRING), - F1("sodium_crypto_kx_seed_keypair", MAY_BE_STRING), - F1("sodium_crypto_kx_keypair", MAY_BE_STRING), - F1("sodium_crypto_kx_secretkey", MAY_BE_STRING), - F1("sodium_crypto_kx_publickey", MAY_BE_STRING), - F1("sodium_crypto_kx_client_session_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("sodium_crypto_kx_server_session_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("sodium_crypto_auth", MAY_BE_STRING), - F1("sodium_crypto_aead_aes256gcm_keygen", MAY_BE_STRING), - F1("sodium_crypto_auth_keygen", MAY_BE_STRING), - F1("sodium_crypto_generichash_keygen", MAY_BE_STRING), - F1("sodium_crypto_kdf_keygen", MAY_BE_STRING), - F1("sodium_crypto_secretbox_keygen", MAY_BE_STRING), - F1("sodium_crypto_shorthash_keygen", MAY_BE_STRING), - F1("sodium_crypto_stream_keygen", MAY_BE_STRING), - F1("sodium_crypto_kdf_derive_from_key", MAY_BE_STRING), - F1("sodium_pad", MAY_BE_STRING), - F1("sodium_unpad", MAY_BE_STRING), - - F1("sodium_crypto_box_keypair_from_secretkey_and_publickey", MAY_BE_STRING), - F1("sodium_crypto_box_publickey_from_secretkey", MAY_BE_STRING), - F1("sodium_crypto_sign_keypair_from_secretkey_and_publickey", MAY_BE_STRING), - F1("sodium_crypto_sign_publickey_from_secretkey", MAY_BE_STRING), - F1("sodium_crypto_pwhash_scryptsalsa208sha256", MAY_BE_STRING), - F1("sodium_crypto_pwhash_scryptsalsa208sha256_str", MAY_BE_STRING), - F1("sodium_crypto_sign_ed25519_sk_to_curve25519", MAY_BE_STRING), - F1("sodium_crypto_sign_ed25519_pk_to_curve25519", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_encrypt", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_decrypt", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_ietf_encrypt", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_ietf_decrypt", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", MAY_BE_STRING), - F1("sodium_crypto_aead_xchacha20poly1305_ietf_decrypt", MAY_BE_FALSE | MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_keygen", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING), - F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING), - /* ext/pgsql */ F1("pg_dbname", MAY_BE_STRING), F1("pg_options", MAY_BE_STRING), diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index a2874b2d4250b..2ba712d274a8e 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -113,6 +113,91 @@ static const func_info_t func_infos[] = { F1("exif_read_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE), F1("exif_thumbnail", MAY_BE_STRING|MAY_BE_FALSE), F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE), +#if defined(HAVE_AESGCM) + F1("sodium_crypto_aead_aes256gcm_decrypt", MAY_BE_STRING|MAY_BE_FALSE), +#endif +#if defined(HAVE_AESGCM) + F1("sodium_crypto_aead_aes256gcm_encrypt", MAY_BE_STRING), +#endif +#if defined(HAVE_AESGCM) + F1("sodium_crypto_aead_aes256gcm_keygen", MAY_BE_STRING), +#endif + F1("sodium_crypto_aead_chacha20poly1305_decrypt", MAY_BE_STRING|MAY_BE_FALSE), + F1("sodium_crypto_aead_chacha20poly1305_encrypt", MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_keygen", MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_ietf_decrypt", MAY_BE_STRING|MAY_BE_FALSE), + F1("sodium_crypto_aead_chacha20poly1305_ietf_encrypt", MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING), +#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) + F1("sodium_crypto_aead_xchacha20poly1305_ietf_decrypt", MAY_BE_STRING|MAY_BE_FALSE), +#endif +#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) + F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING), +#endif +#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) + F1("sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", MAY_BE_STRING), +#endif + F1("sodium_crypto_auth", MAY_BE_STRING), + F1("sodium_crypto_auth_keygen", MAY_BE_STRING), + F1("sodium_crypto_box", MAY_BE_STRING), + F1("sodium_crypto_box_keypair", MAY_BE_STRING), + F1("sodium_crypto_box_seed_keypair", MAY_BE_STRING), + F1("sodium_crypto_box_keypair_from_secretkey_and_publickey", MAY_BE_STRING), + F1("sodium_crypto_box_open", MAY_BE_STRING|MAY_BE_FALSE), + F1("sodium_crypto_box_publickey", MAY_BE_STRING), + F1("sodium_crypto_box_publickey_from_secretkey", MAY_BE_STRING), + F1("sodium_crypto_box_seal", MAY_BE_STRING), + F1("sodium_crypto_box_seal_open", MAY_BE_STRING|MAY_BE_FALSE), + F1("sodium_crypto_box_secretkey", MAY_BE_STRING), + F1("sodium_crypto_kx_keypair", MAY_BE_STRING), + F1("sodium_crypto_kx_publickey", MAY_BE_STRING), + F1("sodium_crypto_kx_secretkey", MAY_BE_STRING), + F1("sodium_crypto_kx_seed_keypair", MAY_BE_STRING), + F1("sodium_crypto_kx_client_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), + F1("sodium_crypto_kx_server_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), + F1("sodium_crypto_generichash", MAY_BE_STRING), + F1("sodium_crypto_generichash_keygen", MAY_BE_STRING), + F1("sodium_crypto_generichash_init", MAY_BE_STRING), + F0("sodium_crypto_generichash_update", MAY_BE_TRUE), + F1("sodium_crypto_generichash_final", MAY_BE_STRING), + F1("sodium_crypto_kdf_derive_from_key", MAY_BE_STRING), + F1("sodium_crypto_kdf_keygen", MAY_BE_STRING), +#if defined(crypto_pwhash_SALTBYTES) + F1("sodium_crypto_pwhash", MAY_BE_STRING), +#endif +#if defined(crypto_pwhash_SALTBYTES) + F1("sodium_crypto_pwhash_str", MAY_BE_STRING), +#endif +#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES) + F1("sodium_crypto_pwhash_scryptsalsa208sha256", MAY_BE_STRING), +#endif +#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES) + F1("sodium_crypto_pwhash_scryptsalsa208sha256_str", MAY_BE_STRING), +#endif + F1("sodium_crypto_scalarmult", MAY_BE_STRING), + F1("sodium_crypto_secretbox", MAY_BE_STRING), + F1("sodium_crypto_secretbox_keygen", MAY_BE_STRING), + F1("sodium_crypto_secretbox_open", MAY_BE_STRING|MAY_BE_FALSE), + F1("sodium_crypto_shorthash", MAY_BE_STRING), + F1("sodium_crypto_shorthash_keygen", MAY_BE_STRING), + F1("sodium_crypto_sign", MAY_BE_STRING), + F1("sodium_crypto_sign_detached", MAY_BE_STRING), + F1("sodium_crypto_sign_ed25519_pk_to_curve25519", MAY_BE_STRING), + F1("sodium_crypto_sign_ed25519_sk_to_curve25519", MAY_BE_STRING), + F1("sodium_crypto_sign_keypair", MAY_BE_STRING), + F1("sodium_crypto_sign_keypair_from_secretkey_and_publickey", MAY_BE_STRING), + F1("sodium_crypto_sign_open", MAY_BE_STRING|MAY_BE_FALSE), + F1("sodium_crypto_sign_publickey", MAY_BE_STRING), + F1("sodium_crypto_sign_secretkey", MAY_BE_STRING), + F1("sodium_crypto_sign_publickey_from_secretkey", MAY_BE_STRING), + F1("sodium_crypto_sign_seed_keypair", MAY_BE_STRING), + F1("sodium_crypto_stream", MAY_BE_STRING), + F1("sodium_crypto_stream_keygen", MAY_BE_STRING), + F1("sodium_crypto_stream_xor", MAY_BE_STRING), + F1("sodium_pad", MAY_BE_STRING), + F1("sodium_unpad", MAY_BE_STRING), + F1("sodium_bin2hex", MAY_BE_STRING), + F1("sodium_hex2bin", MAY_BE_STRING), F1("filter_input_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE|MAY_BE_NULL), F1("filter_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), FN("pcntl_signal_get_handler", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_OBJECT|MAY_BE_LONG), diff --git a/ext/sodium/libsodium.stub.php b/ext/sodium/libsodium.stub.php index 047dcced0bc49..bd252d02bb5bc 100644 --- a/ext/sodium/libsodium.stub.php +++ b/ext/sodium/libsodium.stub.php @@ -5,57 +5,81 @@ function sodium_crypto_aead_aes256gcm_is_available(): bool {} #ifdef HAVE_AESGCM +/** @refcount 1 */ function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} +/** @refcount 1 */ function sodium_crypto_aead_aes256gcm_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} +/** @refcount 1 */ function sodium_crypto_aead_aes256gcm_keygen(): string {} #endif +/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} +/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} +/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_keygen(): string {} +/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} +/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} +/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {} #ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES +/** @refcount 1 */ function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} +/** @refcount 1 */ function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {} +/** @refcount 1 */ function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} #endif +/** @refcount 1 */ function sodium_crypto_auth(string $message, string $key): string {} +/** @refcount 1 */ function sodium_crypto_auth_keygen(): string {} function sodium_crypto_auth_verify(string $mac, string $message, string $key): bool {} +/** @refcount 1 */ function sodium_crypto_box(string $message, string $nonce, string $key_pair): string {} +/** @refcount 1 */ function sodium_crypto_box_keypair(): string {} +/** @refcount 1 */ function sodium_crypto_box_seed_keypair(string $seed): string {} +/** @refcount 1 */ function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {} +/** @refcount 1 */ function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false {} +/** @refcount 1 */ function sodium_crypto_box_publickey(string $key_pair): string {} +/** @refcount 1 */ function sodium_crypto_box_publickey_from_secretkey(string $secret_key): string {} +/** @refcount 1 */ function sodium_crypto_box_seal(string $message, string $public_key): string {} +/** @refcount 1 */ function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string|false {} +/** @refcount 1 */ function sodium_crypto_box_secretkey(string $key_pair): string {} #ifdef crypto_core_ristretto255_HASHBYTES @@ -86,35 +110,56 @@ function sodium_crypto_core_ristretto255_scalar_sub(string $x, string $y): strin function sodium_crypto_core_ristretto255_sub(string $p, string $q): string {} #endif +/** @refcount 1 */ function sodium_crypto_kx_keypair(): string {} +/** @refcount 1 */ function sodium_crypto_kx_publickey(string $key_pair): string {} +/** @refcount 1 */ function sodium_crypto_kx_secretkey(string $key_pair): string {} +/** @refcount 1 */ function sodium_crypto_kx_seed_keypair(string $seed): string {} +/** + * @return array + * @refcount 1 + */ function sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array {} +/** + * @return array + * @refcount 1 + */ function sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array {} +/** @refcount 1 */ function sodium_crypto_generichash(string $message, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} +/** @refcount 1 */ function sodium_crypto_generichash_keygen(): string {} +/** @refcount 1 */ function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} +/** @return true */ function sodium_crypto_generichash_update(string &$state, string $message): bool {} +/** @refcount 1 */ function sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} +/** @refcount 1 */ function sodium_crypto_kdf_derive_from_key(int $subkey_length, int $subkey_id, string $context, string $key): string {} +/** @refcount 1 */ function sodium_crypto_kdf_keygen(): string {} #ifdef crypto_pwhash_SALTBYTES +/** @refcount 1 */ function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $algo = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {} +/** @refcount 1 */ function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {} function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {} @@ -125,13 +170,16 @@ function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, #endif #ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES +/** @refcount 1 */ function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {} +/** @refcount 1 */ function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {} function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {} #endif +/** @refcount 1 */ function sodium_crypto_scalarmult(string $n, string $p): string {} #ifdef crypto_core_ristretto255_HASHBYTES @@ -140,10 +188,13 @@ function sodium_crypto_scalarmult_ristretto255(string $n, string $p): string {} function sodium_crypto_scalarmult_ristretto255_base(string $n): string {} #endif +/** @refcount 1 */ function sodium_crypto_secretbox(string $message, string $nonce, string $key): string {} +/** @refcount 1 */ function sodium_crypto_secretbox_keygen(): string {} +/** @refcount 1 */ function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false {} #ifdef crypto_secretstream_xchacha20poly1305_ABYTES @@ -160,38 +211,54 @@ function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, strin function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {} #endif +/** @refcount 1 */ function sodium_crypto_shorthash(string $message, string $key): string {} +/** @refcount 1 */ function sodium_crypto_shorthash_keygen(): string {} +/** @refcount 1 */ function sodium_crypto_sign(string $message, string $secret_key): string {} +/** @refcount 1 */ function sodium_crypto_sign_detached(string $message, string $secret_key): string {} +/** @refcount 1 */ function sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string {} +/** @refcount 1 */ function sodium_crypto_sign_ed25519_sk_to_curve25519(string $secret_key): string {} +/** @refcount 1 */ function sodium_crypto_sign_keypair(): string {} +/** @refcount 1 */ function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {} +/** @refcount 1 */ function sodium_crypto_sign_open(string $signed_message, string $public_key): string|false {} +/** @refcount 1 */ function sodium_crypto_sign_publickey(string $key_pair): string {} +/** @refcount 1 */ function sodium_crypto_sign_secretkey(string $key_pair): string {} +/** @refcount 1 */ function sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string {} +/** @refcount 1 */ function sodium_crypto_sign_seed_keypair(string $seed): string {} function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): bool {} +/** @refcount 1 */ function sodium_crypto_stream(int $length, string $nonce, string $key): string {} +/** @refcount 1 */ function sodium_crypto_stream_keygen(): string {} +/** @refcount 1 */ function sodium_crypto_stream_xor(string $message, string $nonce, string $key): string {} #if defined(crypto_stream_xchacha20_KEYBYTES) @@ -212,12 +279,16 @@ function sodium_memcmp(string $string1, string $string2): int {} function sodium_memzero(string &$string): void {} +/** @refcount 1 */ function sodium_pad(string $string, int $block_size): string {} +/** @refcount 1 */ function sodium_unpad(string $string, int $block_size): string {} +/** @refcount 1 */ function sodium_bin2hex(string $string): string {} +/** @refcount 1 */ function sodium_hex2bin(string $string, string $ignore = ""): string {} #ifdef sodium_base64_VARIANT_ORIGINAL diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h index 34c0acced0fb0..0a897bbd71c07 100644 --- a/ext/sodium/libsodium_arginfo.h +++ b/ext/sodium/libsodium_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7213518d1b2e9322194d677f13634f61c5f71af8 */ + * Stub hash: dbc1e79c8c65d85b91f8544f70929a50102916a4 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() From 5fe33d8454c072f3dd3aaaf1d5e6b1af24c66015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 26 Aug 2021 10:12:12 +0200 Subject: [PATCH 2/2] Get rid of refcount optimization --- Zend/Optimizer/zend_func_infos.h | 86 +------------------------------- ext/sodium/libsodium.stub.php | 72 +------------------------- ext/sodium/libsodium_arginfo.h | 2 +- 3 files changed, 5 insertions(+), 155 deletions(-) diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index 2ba712d274a8e..44d33d64383b1 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -113,91 +113,9 @@ static const func_info_t func_infos[] = { F1("exif_read_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE), F1("exif_thumbnail", MAY_BE_STRING|MAY_BE_FALSE), F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE), -#if defined(HAVE_AESGCM) - F1("sodium_crypto_aead_aes256gcm_decrypt", MAY_BE_STRING|MAY_BE_FALSE), -#endif -#if defined(HAVE_AESGCM) - F1("sodium_crypto_aead_aes256gcm_encrypt", MAY_BE_STRING), -#endif -#if defined(HAVE_AESGCM) - F1("sodium_crypto_aead_aes256gcm_keygen", MAY_BE_STRING), -#endif - F1("sodium_crypto_aead_chacha20poly1305_decrypt", MAY_BE_STRING|MAY_BE_FALSE), - F1("sodium_crypto_aead_chacha20poly1305_encrypt", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_keygen", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_ietf_decrypt", MAY_BE_STRING|MAY_BE_FALSE), - F1("sodium_crypto_aead_chacha20poly1305_ietf_encrypt", MAY_BE_STRING), - F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING), -#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) - F1("sodium_crypto_aead_xchacha20poly1305_ietf_decrypt", MAY_BE_STRING|MAY_BE_FALSE), -#endif -#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) - F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING), -#endif -#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) - F1("sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", MAY_BE_STRING), -#endif - F1("sodium_crypto_auth", MAY_BE_STRING), - F1("sodium_crypto_auth_keygen", MAY_BE_STRING), - F1("sodium_crypto_box", MAY_BE_STRING), - F1("sodium_crypto_box_keypair", MAY_BE_STRING), - F1("sodium_crypto_box_seed_keypair", MAY_BE_STRING), - F1("sodium_crypto_box_keypair_from_secretkey_and_publickey", MAY_BE_STRING), - F1("sodium_crypto_box_open", MAY_BE_STRING|MAY_BE_FALSE), - F1("sodium_crypto_box_publickey", MAY_BE_STRING), - F1("sodium_crypto_box_publickey_from_secretkey", MAY_BE_STRING), - F1("sodium_crypto_box_seal", MAY_BE_STRING), - F1("sodium_crypto_box_seal_open", MAY_BE_STRING|MAY_BE_FALSE), - F1("sodium_crypto_box_secretkey", MAY_BE_STRING), - F1("sodium_crypto_kx_keypair", MAY_BE_STRING), - F1("sodium_crypto_kx_publickey", MAY_BE_STRING), - F1("sodium_crypto_kx_secretkey", MAY_BE_STRING), - F1("sodium_crypto_kx_seed_keypair", MAY_BE_STRING), - F1("sodium_crypto_kx_client_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), - F1("sodium_crypto_kx_server_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), - F1("sodium_crypto_generichash", MAY_BE_STRING), - F1("sodium_crypto_generichash_keygen", MAY_BE_STRING), - F1("sodium_crypto_generichash_init", MAY_BE_STRING), + FN("sodium_crypto_kx_client_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), + FN("sodium_crypto_kx_server_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), F0("sodium_crypto_generichash_update", MAY_BE_TRUE), - F1("sodium_crypto_generichash_final", MAY_BE_STRING), - F1("sodium_crypto_kdf_derive_from_key", MAY_BE_STRING), - F1("sodium_crypto_kdf_keygen", MAY_BE_STRING), -#if defined(crypto_pwhash_SALTBYTES) - F1("sodium_crypto_pwhash", MAY_BE_STRING), -#endif -#if defined(crypto_pwhash_SALTBYTES) - F1("sodium_crypto_pwhash_str", MAY_BE_STRING), -#endif -#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES) - F1("sodium_crypto_pwhash_scryptsalsa208sha256", MAY_BE_STRING), -#endif -#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES) - F1("sodium_crypto_pwhash_scryptsalsa208sha256_str", MAY_BE_STRING), -#endif - F1("sodium_crypto_scalarmult", MAY_BE_STRING), - F1("sodium_crypto_secretbox", MAY_BE_STRING), - F1("sodium_crypto_secretbox_keygen", MAY_BE_STRING), - F1("sodium_crypto_secretbox_open", MAY_BE_STRING|MAY_BE_FALSE), - F1("sodium_crypto_shorthash", MAY_BE_STRING), - F1("sodium_crypto_shorthash_keygen", MAY_BE_STRING), - F1("sodium_crypto_sign", MAY_BE_STRING), - F1("sodium_crypto_sign_detached", MAY_BE_STRING), - F1("sodium_crypto_sign_ed25519_pk_to_curve25519", MAY_BE_STRING), - F1("sodium_crypto_sign_ed25519_sk_to_curve25519", MAY_BE_STRING), - F1("sodium_crypto_sign_keypair", MAY_BE_STRING), - F1("sodium_crypto_sign_keypair_from_secretkey_and_publickey", MAY_BE_STRING), - F1("sodium_crypto_sign_open", MAY_BE_STRING|MAY_BE_FALSE), - F1("sodium_crypto_sign_publickey", MAY_BE_STRING), - F1("sodium_crypto_sign_secretkey", MAY_BE_STRING), - F1("sodium_crypto_sign_publickey_from_secretkey", MAY_BE_STRING), - F1("sodium_crypto_sign_seed_keypair", MAY_BE_STRING), - F1("sodium_crypto_stream", MAY_BE_STRING), - F1("sodium_crypto_stream_keygen", MAY_BE_STRING), - F1("sodium_crypto_stream_xor", MAY_BE_STRING), - F1("sodium_pad", MAY_BE_STRING), - F1("sodium_unpad", MAY_BE_STRING), - F1("sodium_bin2hex", MAY_BE_STRING), - F1("sodium_hex2bin", MAY_BE_STRING), F1("filter_input_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE|MAY_BE_NULL), F1("filter_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING), FN("pcntl_signal_get_handler", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_OBJECT|MAY_BE_LONG), diff --git a/ext/sodium/libsodium.stub.php b/ext/sodium/libsodium.stub.php index bd252d02bb5bc..0e52426ac9977 100644 --- a/ext/sodium/libsodium.stub.php +++ b/ext/sodium/libsodium.stub.php @@ -5,81 +5,57 @@ function sodium_crypto_aead_aes256gcm_is_available(): bool {} #ifdef HAVE_AESGCM -/** @refcount 1 */ function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -/** @refcount 1 */ function sodium_crypto_aead_aes256gcm_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} -/** @refcount 1 */ function sodium_crypto_aead_aes256gcm_keygen(): string {} #endif -/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} -/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_keygen(): string {} -/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} -/** @refcount 1 */ function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {} #ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES -/** @refcount 1 */ function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} -/** @refcount 1 */ function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {} -/** @refcount 1 */ function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {} #endif -/** @refcount 1 */ function sodium_crypto_auth(string $message, string $key): string {} -/** @refcount 1 */ function sodium_crypto_auth_keygen(): string {} function sodium_crypto_auth_verify(string $mac, string $message, string $key): bool {} -/** @refcount 1 */ function sodium_crypto_box(string $message, string $nonce, string $key_pair): string {} -/** @refcount 1 */ function sodium_crypto_box_keypair(): string {} -/** @refcount 1 */ function sodium_crypto_box_seed_keypair(string $seed): string {} -/** @refcount 1 */ function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {} -/** @refcount 1 */ function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false {} -/** @refcount 1 */ function sodium_crypto_box_publickey(string $key_pair): string {} -/** @refcount 1 */ function sodium_crypto_box_publickey_from_secretkey(string $secret_key): string {} -/** @refcount 1 */ function sodium_crypto_box_seal(string $message, string $public_key): string {} -/** @refcount 1 */ function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string|false {} -/** @refcount 1 */ function sodium_crypto_box_secretkey(string $key_pair): string {} #ifdef crypto_core_ristretto255_HASHBYTES @@ -110,56 +86,38 @@ function sodium_crypto_core_ristretto255_scalar_sub(string $x, string $y): strin function sodium_crypto_core_ristretto255_sub(string $p, string $q): string {} #endif -/** @refcount 1 */ function sodium_crypto_kx_keypair(): string {} -/** @refcount 1 */ function sodium_crypto_kx_publickey(string $key_pair): string {} -/** @refcount 1 */ function sodium_crypto_kx_secretkey(string $key_pair): string {} -/** @refcount 1 */ function sodium_crypto_kx_seed_keypair(string $seed): string {} -/** - * @return array - * @refcount 1 - */ +/** @return array */ function sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array {} -/** - * @return array - * @refcount 1 - */ +/** @return array */ function sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array {} -/** @refcount 1 */ function sodium_crypto_generichash(string $message, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} -/** @refcount 1 */ function sodium_crypto_generichash_keygen(): string {} -/** @refcount 1 */ function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} /** @return true */ function sodium_crypto_generichash_update(string &$state, string $message): bool {} -/** @refcount 1 */ function sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {} -/** @refcount 1 */ function sodium_crypto_kdf_derive_from_key(int $subkey_length, int $subkey_id, string $context, string $key): string {} -/** @refcount 1 */ function sodium_crypto_kdf_keygen(): string {} #ifdef crypto_pwhash_SALTBYTES -/** @refcount 1 */ function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $algo = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {} -/** @refcount 1 */ function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {} function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {} @@ -170,16 +128,13 @@ function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, #endif #ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES -/** @refcount 1 */ function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {} -/** @refcount 1 */ function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {} function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {} #endif -/** @refcount 1 */ function sodium_crypto_scalarmult(string $n, string $p): string {} #ifdef crypto_core_ristretto255_HASHBYTES @@ -188,13 +143,10 @@ function sodium_crypto_scalarmult_ristretto255(string $n, string $p): string {} function sodium_crypto_scalarmult_ristretto255_base(string $n): string {} #endif -/** @refcount 1 */ function sodium_crypto_secretbox(string $message, string $nonce, string $key): string {} -/** @refcount 1 */ function sodium_crypto_secretbox_keygen(): string {} -/** @refcount 1 */ function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false {} #ifdef crypto_secretstream_xchacha20poly1305_ABYTES @@ -211,54 +163,38 @@ function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, strin function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {} #endif -/** @refcount 1 */ function sodium_crypto_shorthash(string $message, string $key): string {} -/** @refcount 1 */ function sodium_crypto_shorthash_keygen(): string {} -/** @refcount 1 */ function sodium_crypto_sign(string $message, string $secret_key): string {} -/** @refcount 1 */ function sodium_crypto_sign_detached(string $message, string $secret_key): string {} -/** @refcount 1 */ function sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string {} -/** @refcount 1 */ function sodium_crypto_sign_ed25519_sk_to_curve25519(string $secret_key): string {} -/** @refcount 1 */ function sodium_crypto_sign_keypair(): string {} -/** @refcount 1 */ function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {} -/** @refcount 1 */ function sodium_crypto_sign_open(string $signed_message, string $public_key): string|false {} -/** @refcount 1 */ function sodium_crypto_sign_publickey(string $key_pair): string {} -/** @refcount 1 */ function sodium_crypto_sign_secretkey(string $key_pair): string {} -/** @refcount 1 */ function sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string {} -/** @refcount 1 */ function sodium_crypto_sign_seed_keypair(string $seed): string {} function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): bool {} -/** @refcount 1 */ function sodium_crypto_stream(int $length, string $nonce, string $key): string {} -/** @refcount 1 */ function sodium_crypto_stream_keygen(): string {} -/** @refcount 1 */ function sodium_crypto_stream_xor(string $message, string $nonce, string $key): string {} #if defined(crypto_stream_xchacha20_KEYBYTES) @@ -279,16 +215,12 @@ function sodium_memcmp(string $string1, string $string2): int {} function sodium_memzero(string &$string): void {} -/** @refcount 1 */ function sodium_pad(string $string, int $block_size): string {} -/** @refcount 1 */ function sodium_unpad(string $string, int $block_size): string {} -/** @refcount 1 */ function sodium_bin2hex(string $string): string {} -/** @refcount 1 */ function sodium_hex2bin(string $string, string $ignore = ""): string {} #ifdef sodium_base64_VARIANT_ORIGINAL diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h index 0a897bbd71c07..7086eb5a598bf 100644 --- a/ext/sodium/libsodium_arginfo.h +++ b/ext/sodium/libsodium_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: dbc1e79c8c65d85b91f8544f70929a50102916a4 */ + * Stub hash: 91286b83d2bbfb3fb3c99eb5da907d788f7e17ac */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO()