From 930c759032006307795b3357744e41bca55cf77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 17 Sep 2020 20:39:21 +0200 Subject: [PATCH 1/4] Improve parameter names in ext/hash --- ext/hash/hash.stub.php | 18 ++++++------ ext/hash/hash_arginfo.h | 35 ++++++++++++++---------- ext/hash/tests/hash_error.phpt | 2 +- ext/hash/tests/hash_file_error.phpt | 2 +- ext/hash/tests/hash_hkdf_edges.phpt | 2 +- ext/hash/tests/hash_hkdf_error.phpt | 20 +++++++------- ext/hash/tests/hash_hmac_error.phpt | 4 +-- ext/hash/tests/hash_hmac_file_error.phpt | 4 +-- ext/hash/tests/hash_init_error.phpt | 8 +++--- ext/hash/tests/hash_pbkdf2_error.phpt | 4 +-- 10 files changed, 52 insertions(+), 47 deletions(-) diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php index a8f90cd5ec98c..971806963ee1e 100644 --- a/ext/hash/hash.stub.php +++ b/ext/hash/hash.stub.php @@ -2,25 +2,25 @@ /** @generate-function-entries */ -function hash(string $algo, string $data, bool $raw_output = false): string|false {} +function hash(string $algorithm, string $data, bool $binary_output = false): string|false {} -function hash_file(string $algo, string $filename, bool $raw_output = false): string|false {} +function hash_file(string $algorithm, string $filename, bool $binary_output = false): string|false {} -function hash_hmac(string $algo, string $data, string $key, bool $raw_output = false): string|false {} +function hash_hmac(string $algorithm, string $data, string $key, bool $binary_output = false): string|false {} -function hash_hmac_file(string $algo, string $data, string $key, bool $raw_output = false): string|false {} +function hash_hmac_file(string $algorithm, string $data, string $shared_secret_key, bool $binary_output = false): string|false {} -function hash_init(string $algo, int $options = 0, string $key = ""): HashContext {} +function hash_init(string $algorithm, int $options = 0, string $shared_secret_key = ""): HashContext {} function hash_update(HashContext $context, string $data): bool {} /** @param resource $handle */ function hash_update_stream(HashContext $context, $handle, int $length = -1): int {} -/** @param resource $stream_context */ +/** @param resource|null $stream_context */ function hash_update_file(HashContext $context, string $filename, $stream_context = null): bool {} -function hash_final(HashContext $context, bool $raw_output = false): string {} +function hash_final(HashContext $context, bool $binary_output = false): string {} function hash_copy(HashContext $context): HashContext {} @@ -28,11 +28,11 @@ function hash_algos(): array {} function hash_hmac_algos(): array {} -function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $raw_output = false): string {} +function hash_pbkdf2(string $algorithm, string $password, string $salt, int $iterations, int $length = 0, bool $binary_output = false): string {} function hash_equals(string $known_string, string $user_string): bool {} -function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = "", string $salt = ""): string {} +function hash_hkdf(string $algorithm, string $input_key_material, int $length = 0, string $info = "", string $salt = ""): string {} #ifdef PHP_MHASH_BC function mhash_get_block_size(int $hash): int|false {} diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h index a7837b28481c3..9741105daae05 100644 --- a/ext/hash/hash_arginfo.h +++ b/ext/hash/hash_arginfo.h @@ -1,31 +1,36 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 28ec46ceae7550c9a4103c98fd7c20364f078289 */ + * Stub hash: 049e0236e726e23141f2c6dae823163418fa4802 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() -#define arginfo_hash_hmac_file arginfo_hash_hmac +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac_file, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, shared_secret_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0) - ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, shared_secret_key, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update, 0, 2, _IS_BOOL, 0) @@ -47,7 +52,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_final, 0, 1, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, context, HashContext, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_copy, 0, 1, HashContext, 0) @@ -60,12 +65,12 @@ ZEND_END_ARG_INFO() #define arginfo_hash_hmac_algos arginfo_hash_algos ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_pbkdf2, 0, 4, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0) @@ -74,8 +79,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, ikm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, input_key_material, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, info, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, salt, IS_STRING, 0, "\"\"") diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt index b5c038809139d..3c552adb8e9c8 100644 --- a/ext/hash/tests/hash_error.phpt +++ b/ext/hash/tests/hash_error.phpt @@ -17,4 +17,4 @@ try { *** Testing hash() : error conditions *** -- Testing hash() function with invalid hash algorithm -- -hash(): Argument #1 ($algo) must be a valid hashing algorithm +hash(): Argument #1 ($algorithm) must be a valid hashing algorithm diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index 44f3d09255972..d5cf6ad8e7553 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -34,7 +34,7 @@ unlink( $filename ); *** Testing hash_file() : error conditions *** -- Testing hash_file() function with an unknown algorithm -- -hash_file(): Argument #1 ($algo) must be a valid hashing algorithm +hash_file(): Argument #1 ($algorithm) must be a valid hashing algorithm -- Testing hash_file() function with a non-existent file -- diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt index 89b3d8af6354f..7f4b6c8ebd17c 100644 --- a/ext/hash/tests/hash_hkdf_edges.phpt +++ b/ext/hash/tests/hash_hkdf_edges.phpt @@ -26,4 +26,4 @@ Length < digestSize: 98b16391063ece Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f Algo name case-sensitivity: true Non-crypto algo name case-sensitivity: -[Error] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[Error] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt index a478420ca46fc..e9c0bdd43c69f 100644 --- a/ext/hash/tests/hash_hkdf_error.phpt +++ b/ext/hash/tests/hash_hkdf_error.phpt @@ -48,19 +48,19 @@ trycatch_dump( *** Testing hash_hkdf(): error conditions *** -- Testing hash_hkdf() function with invalid hash algorithm -- -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with non-cryptographic hash algorithm -- -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with invalid parameters -- -[ValueError] hash_hkdf(): Argument #2 ($ikm) cannot be empty +[ValueError] hash_hkdf(): Argument #2 ($input_key_material) cannot be empty [ValueError] hash_hkdf(): Argument #3 ($length) must be greater than or equal to 0 [ValueError] hash_hkdf(): Argument #3 ($length) must be less than or equal to 5100 diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt index 81c28ee46c056..dde159c78c642 100644 --- a/ext/hash/tests/hash_hmac_error.phpt +++ b/ext/hash/tests/hash_hmac_error.phpt @@ -32,7 +32,7 @@ catch (\Error $e) { *** Testing hash_hmac() : error conditions *** -- Testing hash_hmac() function with invalid hash algorithm -- -hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +hash_hmac(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_hmac() function with non-cryptographic hash algorithm -- -hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +hash_hmac(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 7cbc347691202..7eff5c3b202ec 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -37,10 +37,10 @@ catch (ValueError $e) { *** Testing hash() : error conditions *** -- Testing hash_hmac_file() function with invalid hash algorithm -- -hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +hash_hmac_file(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with non-cryptographic hash algorithm -- -hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +hash_hmac_file(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with bad path -- hash_hmac_file(): Argument #2 ($data) must not contain any null bytes diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt index fdea4174d6fc9..e6ed9326d765c 100644 --- a/ext/hash/tests/hash_init_error.phpt +++ b/ext/hash/tests/hash_init_error.phpt @@ -41,11 +41,11 @@ catch (\Error $e) { *** Testing hash_init(): error conditions *** -- Testing hash_init() function with unknown algorithms -- -hash_init(): Argument #1 ($algo) must be a valid hashing algorithm +hash_init(): Argument #1 ($algorithm) must be a valid hashing algorithm -- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms -- -hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested +hash_init(): Argument #1 ($algorithm) must be a cryptographic hashing algorithm if HMAC is requested -- Testing hash_init() function with HASH_HMAC and no key -- -hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested -hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested +hash_init(): Argument #3 ($shared_secret_key) cannot be empty when HMAC is requested +hash_init(): Argument #3 ($shared_secret_key) cannot be empty when HMAC is requested diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt index 35cda2b52fc62..89068159afb5e 100644 --- a/ext/hash/tests/hash_pbkdf2_error.phpt +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -56,10 +56,10 @@ catch (\Error $e) { *** Testing hash_pbkdf2() : error conditions *** -- Testing hash_pbkdf2() function with invalid hash algorithm -- -hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +hash_pbkdf2(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_pbkdf2() function with non-cryptographic hash algorithm -- -hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +hash_pbkdf2(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_pbkdf2() function with invalid iterations -- hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0 From 89a25b0733b540464ad386bd55f45ce1cffff56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 22 Sep 2020 23:01:28 +0200 Subject: [PATCH 2/4] Apply suggestions --- ext/hash/hash.stub.php | 14 +++++++------- ext/hash/hash_arginfo.h | 23 +++++++++-------------- ext/hash/tests/hash_hkdf_error.phpt | 2 +- ext/hash/tests/hash_init_error.phpt | 4 ++-- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php index 971806963ee1e..d53168f9ee111 100644 --- a/ext/hash/hash.stub.php +++ b/ext/hash/hash.stub.php @@ -8,9 +8,9 @@ function hash_file(string $algorithm, string $filename, bool $binary_output = fa function hash_hmac(string $algorithm, string $data, string $key, bool $binary_output = false): string|false {} -function hash_hmac_file(string $algorithm, string $data, string $shared_secret_key, bool $binary_output = false): string|false {} +function hash_hmac_file(string $algorithm, string $data, string $key, bool $binary_output = false): string|false {} -function hash_init(string $algorithm, int $options = 0, string $shared_secret_key = ""): HashContext {} +function hash_init(string $algorithm, int $options = 0, string $key = ""): HashContext {} function hash_update(HashContext $context, string $data): bool {} @@ -32,18 +32,18 @@ function hash_pbkdf2(string $algorithm, string $password, string $salt, int $ite function hash_equals(string $known_string, string $user_string): bool {} -function hash_hkdf(string $algorithm, string $input_key_material, int $length = 0, string $info = "", string $salt = ""): string {} +function hash_hkdf(string $algorithm, string $key, int $length = 0, string $info = "", string $salt = ""): string {} #ifdef PHP_MHASH_BC -function mhash_get_block_size(int $hash): int|false {} +function mhash_get_block_size(int $algorithm): int|false {} -function mhash_get_hash_name(int $hash): string|false {} +function mhash_get_hash_name(int $algorithm): string|false {} -function mhash_keygen_s2k(int $hash, string $input_password, string $salt, int $bytes): string|false {} +function mhash_keygen_s2k(int $algorithm, string $password, string $salt, int $bytes): string|false {} function mhash_count(): int {} -function mhash(int $hash, string $data, ?string $key = null): string|false {} +function mhash(int $algorithm, string $data, ?string $key = null): string|false {} #endif final class HashContext diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h index 9741105daae05..80c9d0e814a8d 100644 --- a/ext/hash/hash_arginfo.h +++ b/ext/hash/hash_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 049e0236e726e23141f2c6dae823163418fa4802 */ + * Stub hash: fa9f8e9c190a8f572a0241877ddb07ccf022fd56 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) @@ -20,17 +20,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|M ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac_file, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, shared_secret_key, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") -ZEND_END_ARG_INFO() +#define arginfo_hash_hmac_file arginfo_hash_hmac ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0) ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, shared_secret_key, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update, 0, 2, _IS_BOOL, 0) @@ -80,7 +75,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, input_key_material, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, info, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, salt, IS_STRING, 0, "\"\"") @@ -88,20 +83,20 @@ ZEND_END_ARG_INFO() #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_block_size, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) ZEND_END_ARG_INFO() #endif #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_hash_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) ZEND_END_ARG_INFO() #endif #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_keygen_s2k, 0, 4, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, input_password, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, bytes, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -114,7 +109,7 @@ ZEND_END_ARG_INFO() #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt index e9c0bdd43c69f..e3c0faa146d45 100644 --- a/ext/hash/tests/hash_hkdf_error.phpt +++ b/ext/hash/tests/hash_hkdf_error.phpt @@ -61,6 +61,6 @@ trycatch_dump( [ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with invalid parameters -- -[ValueError] hash_hkdf(): Argument #2 ($input_key_material) cannot be empty +[ValueError] hash_hkdf(): Argument #2 ($key) cannot be empty [ValueError] hash_hkdf(): Argument #3 ($length) must be greater than or equal to 0 [ValueError] hash_hkdf(): Argument #3 ($length) must be less than or equal to 5100 diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt index e6ed9326d765c..8aba4e8cdd7ac 100644 --- a/ext/hash/tests/hash_init_error.phpt +++ b/ext/hash/tests/hash_init_error.phpt @@ -47,5 +47,5 @@ hash_init(): Argument #1 ($algorithm) must be a valid hashing algorithm hash_init(): Argument #1 ($algorithm) must be a cryptographic hashing algorithm if HMAC is requested -- Testing hash_init() function with HASH_HMAC and no key -- -hash_init(): Argument #3 ($shared_secret_key) cannot be empty when HMAC is requested -hash_init(): Argument #3 ($shared_secret_key) cannot be empty when HMAC is requested +hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested +hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested From 9239a79a32a1be0cae44d6f3b312636465bf8ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 24 Sep 2020 10:09:53 +0200 Subject: [PATCH 3/4] Review --- ext/hash/hash.stub.php | 24 ++++++++--------- ext/hash/hash_arginfo.h | 34 ++++++++++++------------ ext/hash/tests/hash_error.phpt | 2 +- ext/hash/tests/hash_file_error.phpt | 2 +- ext/hash/tests/hash_hkdf_edges.phpt | 2 +- ext/hash/tests/hash_hkdf_error.phpt | 18 ++++++------- ext/hash/tests/hash_hmac_error.phpt | 4 +-- ext/hash/tests/hash_hmac_file_error.phpt | 4 +-- ext/hash/tests/hash_init_error.phpt | 4 +-- ext/hash/tests/hash_pbkdf2_error.phpt | 4 +-- ext/openssl/openssl.stub.php | 22 +++++++-------- ext/openssl/openssl_arginfo.h | 24 ++++++++--------- 12 files changed, 72 insertions(+), 72 deletions(-) diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php index d53168f9ee111..554c79c92b09f 100644 --- a/ext/hash/hash.stub.php +++ b/ext/hash/hash.stub.php @@ -2,15 +2,15 @@ /** @generate-function-entries */ -function hash(string $algorithm, string $data, bool $binary_output = false): string|false {} +function hash(string $algo, string $data, bool $binary = false): string|false {} -function hash_file(string $algorithm, string $filename, bool $binary_output = false): string|false {} +function hash_file(string $algo, string $filename, bool $binary = false): string|false {} -function hash_hmac(string $algorithm, string $data, string $key, bool $binary_output = false): string|false {} +function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string|false {} -function hash_hmac_file(string $algorithm, string $data, string $key, bool $binary_output = false): string|false {} +function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false): string|false {} -function hash_init(string $algorithm, int $options = 0, string $key = ""): HashContext {} +function hash_init(string $algo, int $options = 0, string $key = ""): HashContext {} function hash_update(HashContext $context, string $data): bool {} @@ -20,7 +20,7 @@ function hash_update_stream(HashContext $context, $handle, int $length = -1): in /** @param resource|null $stream_context */ function hash_update_file(HashContext $context, string $filename, $stream_context = null): bool {} -function hash_final(HashContext $context, bool $binary_output = false): string {} +function hash_final(HashContext $context, bool $binary = false): string {} function hash_copy(HashContext $context): HashContext {} @@ -28,22 +28,22 @@ function hash_algos(): array {} function hash_hmac_algos(): array {} -function hash_pbkdf2(string $algorithm, string $password, string $salt, int $iterations, int $length = 0, bool $binary_output = false): string {} +function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $binary = false): string {} function hash_equals(string $known_string, string $user_string): bool {} -function hash_hkdf(string $algorithm, string $key, int $length = 0, string $info = "", string $salt = ""): string {} +function hash_hkdf(string $algo, string $key, int $length = 0, string $info = "", string $salt = ""): string {} #ifdef PHP_MHASH_BC -function mhash_get_block_size(int $algorithm): int|false {} +function mhash_get_block_size(int $algo): int|false {} -function mhash_get_hash_name(int $algorithm): string|false {} +function mhash_get_hash_name(int $algo): string|false {} -function mhash_keygen_s2k(int $algorithm, string $password, string $salt, int $bytes): string|false {} +function mhash_keygen_s2k(int $algo, string $password, string $salt, int $length): string|false {} function mhash_count(): int {} -function mhash(int $algorithm, string $data, ?string $key = null): string|false {} +function mhash(int $algo, string $data, ?string $key = null): string|false {} #endif final class HashContext diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h index 80c9d0e814a8d..12c567eec1e36 100644 --- a/ext/hash/hash_arginfo.h +++ b/ext/hash/hash_arginfo.h @@ -1,29 +1,29 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fa9f8e9c190a8f572a0241877ddb07ccf022fd56 */ + * Stub hash: 7c6e5ae7967feee2438ed44d2e5c88b3a74b21fb */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() #define arginfo_hash_hmac_file arginfo_hash_hmac ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() @@ -47,7 +47,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_final, 0, 1, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, context, HashContext, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_copy, 0, 1, HashContext, 0) @@ -60,12 +60,12 @@ ZEND_END_ARG_INFO() #define arginfo_hash_hmac_algos arginfo_hash_algos ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_pbkdf2, 0, 4, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0) @@ -74,7 +74,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, info, IS_STRING, 0, "\"\"") @@ -83,22 +83,22 @@ ZEND_END_ARG_INFO() #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_block_size, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_LONG, 0) ZEND_END_ARG_INFO() #endif #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_hash_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_LONG, 0) ZEND_END_ARG_INFO() #endif #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_keygen_s2k, 0, 4, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, bytes, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_END_ARG_INFO() #endif @@ -109,7 +109,7 @@ ZEND_END_ARG_INFO() #if defined(PHP_MHASH_BC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, algo, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt index 3c552adb8e9c8..b5c038809139d 100644 --- a/ext/hash/tests/hash_error.phpt +++ b/ext/hash/tests/hash_error.phpt @@ -17,4 +17,4 @@ try { *** Testing hash() : error conditions *** -- Testing hash() function with invalid hash algorithm -- -hash(): Argument #1 ($algorithm) must be a valid hashing algorithm +hash(): Argument #1 ($algo) must be a valid hashing algorithm diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index d5cf6ad8e7553..44f3d09255972 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -34,7 +34,7 @@ unlink( $filename ); *** Testing hash_file() : error conditions *** -- Testing hash_file() function with an unknown algorithm -- -hash_file(): Argument #1 ($algorithm) must be a valid hashing algorithm +hash_file(): Argument #1 ($algo) must be a valid hashing algorithm -- Testing hash_file() function with a non-existent file -- diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt index 7f4b6c8ebd17c..89b3d8af6354f 100644 --- a/ext/hash/tests/hash_hkdf_edges.phpt +++ b/ext/hash/tests/hash_hkdf_edges.phpt @@ -26,4 +26,4 @@ Length < digestSize: 98b16391063ece Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f Algo name case-sensitivity: true Non-crypto algo name case-sensitivity: -[Error] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[Error] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt index e3c0faa146d45..60a887d003d01 100644 --- a/ext/hash/tests/hash_hkdf_error.phpt +++ b/ext/hash/tests/hash_hkdf_error.phpt @@ -48,17 +48,17 @@ trycatch_dump( *** Testing hash_hkdf(): error conditions *** -- Testing hash_hkdf() function with invalid hash algorithm -- -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with non-cryptographic hash algorithm -- -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with invalid parameters -- [ValueError] hash_hkdf(): Argument #2 ($key) cannot be empty diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt index dde159c78c642..81c28ee46c056 100644 --- a/ext/hash/tests/hash_hmac_error.phpt +++ b/ext/hash/tests/hash_hmac_error.phpt @@ -32,7 +32,7 @@ catch (\Error $e) { *** Testing hash_hmac() : error conditions *** -- Testing hash_hmac() function with invalid hash algorithm -- -hash_hmac(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac() function with non-cryptographic hash algorithm -- -hash_hmac(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 7eff5c3b202ec..7cbc347691202 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -37,10 +37,10 @@ catch (ValueError $e) { *** Testing hash() : error conditions *** -- Testing hash_hmac_file() function with invalid hash algorithm -- -hash_hmac_file(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with non-cryptographic hash algorithm -- -hash_hmac_file(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with bad path -- hash_hmac_file(): Argument #2 ($data) must not contain any null bytes diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt index 8aba4e8cdd7ac..fdea4174d6fc9 100644 --- a/ext/hash/tests/hash_init_error.phpt +++ b/ext/hash/tests/hash_init_error.phpt @@ -41,10 +41,10 @@ catch (\Error $e) { *** Testing hash_init(): error conditions *** -- Testing hash_init() function with unknown algorithms -- -hash_init(): Argument #1 ($algorithm) must be a valid hashing algorithm +hash_init(): Argument #1 ($algo) must be a valid hashing algorithm -- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms -- -hash_init(): Argument #1 ($algorithm) must be a cryptographic hashing algorithm if HMAC is requested +hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested -- Testing hash_init() function with HASH_HMAC and no key -- hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt index 89068159afb5e..35cda2b52fc62 100644 --- a/ext/hash/tests/hash_pbkdf2_error.phpt +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -56,10 +56,10 @@ catch (\Error $e) { *** Testing hash_pbkdf2() : error conditions *** -- Testing hash_pbkdf2() function with invalid hash algorithm -- -hash_pbkdf2(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_pbkdf2() function with non-cryptographic hash algorithm -- -hash_pbkdf2(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm +hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_pbkdf2() function with invalid iterations -- hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0 diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index 21bc936b08fa2..2c0aaf8e8be5b 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -19,7 +19,7 @@ function openssl_x509_export_to_file(OpenSSLCertificate|string $certificate, str /** @param string $output */ function openssl_x509_export(OpenSSLCertificate|string $certificate, &$output, bool $no_text = true): bool {} -function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $digest_algorithm = "sha1", bool $raw_output = false): string|false {} +function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $digest_algo = "sha1", bool $raw_output = false): string|false {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_x509_check_private_key(OpenSSLCertificate|string $certificate, $private_key): bool {} @@ -103,12 +103,12 @@ function openssl_get_privatekey($private_key, ?string $passphrase = null): OpenS function openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false {} -function openssl_pbkdf2(string $passphrase, string $salt, int $key_length, int $iterations, string $digest_algorithm = "sha1"): string|false {} +function openssl_pbkdf2(string $passphrase, string $salt, int $key_length, int $iterations, string $digest_algo = "sha1"): string|false {} function openssl_pkcs7_verify(string $input_filename, int $flags, ?string $signers_certificates_filename = null, array $ca_info = [], ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $output_filename = null): bool|int {} /** @param OpenSSLCertificate|array|string $certificate */ -function openssl_pkcs7_encrypt(string $input_filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_algorithm = OPENSSL_CIPHER_RC2_40): bool {} +function openssl_pkcs7_encrypt(string $input_filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_algo = OPENSSL_CIPHER_RC2_40): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_pkcs7_sign(string $input_filename, string $output_filename, OpenSSLCertificate|string $certificate, $private_key, ?array $headers, int $flags = PKCS7_DETACHED, ?string $untrusted_certificates_filename = null): bool {} @@ -125,7 +125,7 @@ function openssl_pkcs7_read(string $input_filename, &$certificates): bool {} function openssl_cms_verify(string $input_filename, int $flags = 0, ?string $certificates = null, array $ca_info = [], ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {} /** @param OpenSSLCertificate|array|string $certificate */ -function openssl_cms_encrypt(string $input_filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_algorithm = OPENSSL_CIPHER_RC2_40): bool {} +function openssl_cms_encrypt(string $input_filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_algo = OPENSSL_CIPHER_RC2_40): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_cms_sign(string $input_filename, string $output_filename, OpenSSLCertificate|string $certificate, $private_key, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, ?string $untrusted_certificates_filename = null): bool {} @@ -179,13 +179,13 @@ function openssl_verify(string $data, string $signature, $public_key, string|int * @param array $encrypted_keys * @param string $iv */ -function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_algorithm, &$iv = null): int|false {} +function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_algo, &$iv = null): int|false {} /** * @param string $output * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_algorithm, ?string $iv = null): bool {} +function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_algo, ?string $iv = null): bool {} function openssl_get_md_methods(bool $aliases = false): array {} @@ -195,14 +195,14 @@ function openssl_get_cipher_methods(bool $aliases = false): array {} function openssl_get_curve_names(): array|false {} #endif -function openssl_digest(string $data, string $digest_algorithm, bool $raw_output = false): string|false {} +function openssl_digest(string $data, string $digest_algo, bool $raw_output = false): string|false {} /** @param string $tag */ -function openssl_encrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $iv = "", &$tag = null, string $aad = "", int $tag_length = 16): string|false {} +function openssl_encrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", &$tag = null, string $aad = "", int $tag_length = 16): string|false {} -function openssl_decrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $iv = "", string $tag = "", string $aad = ""): string|false {} +function openssl_decrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", string $tag = "", string $aad = ""): string|false {} -function openssl_cipher_iv_length(string $cipher_algorithm): int|false {} +function openssl_cipher_iv_length(string $cipher_algo): int|false {} function openssl_dh_compute_key(string $public_key, OpenSSLAsymmetricKey $private_key): string|false {} @@ -215,7 +215,7 @@ function openssl_pkey_derive($public_key, $private_key, int $key_length = 0): st /** @param bool $strong_result */ function openssl_random_pseudo_bytes(int $length, &$strong_result = null): string {} -function openssl_spki_new(OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algorithm = OPENSSL_ALGO_MD5): string|false {} +function openssl_spki_new(OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algo = OPENSSL_ALGO_MD5): string|false {} function openssl_spki_verify(string $spki): bool {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 7700cba8e5480..8446820f0aa35 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 40f9897413f966bd483d8f133f6fa3b80910e3d5 */ + * Stub hash: 9a2f44d52d5c386ececf5512dcb57af0f6de6896 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) @@ -15,7 +15,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_fingerprint, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, IS_STRING, 0, "\"sha1\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algo, IS_STRING, 0, "\"sha1\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -155,7 +155,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pbkdf2, 0, 4, MAY_BE_STR ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key_length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, IS_STRING, 0, "\"sha1\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algo, IS_STRING, 0, "\"sha1\"") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkcs7_verify, 0, 2, MAY_BE_BOOL|MAY_BE_LONG) @@ -174,7 +174,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_encrypt, 0, 4, _IS ZEND_ARG_INFO(0, certificate) ZEND_ARG_TYPE_INFO(0, headers, IS_ARRAY, 1) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_algorithm, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_algo, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_sign, 0, 5, _IS_BOOL, 0) @@ -218,7 +218,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_encrypt, 0, 4, _IS_B ZEND_ARG_TYPE_INFO(0, headers, IS_ARRAY, 1) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_LONG, 0, "OPENSSL_ENCODING_SMIME") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_algorithm, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_algo, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_sign, 0, 5, _IS_BOOL, 0) @@ -292,7 +292,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_seal, 0, 5, MAY_BE_LONG| ZEND_ARG_INFO(1, sealed_data) ZEND_ARG_INFO(1, encrypted_keys) ZEND_ARG_TYPE_INFO(0, public_key, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algo, IS_STRING, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, iv, "null") ZEND_END_ARG_INFO() @@ -301,7 +301,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_open, 0, 5, _IS_BOOL, 0) ZEND_ARG_INFO(1, output) ZEND_ARG_TYPE_INFO(0, encrypted_key, IS_STRING, 0) ZEND_ARG_INFO(0, private_key) - ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, iv, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -318,13 +318,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_digest, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, digest_algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, digest_algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_encrypt, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, iv, IS_STRING, 0, "\"\"") @@ -335,7 +335,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_decrypt, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, iv, IS_STRING, 0, "\"\"") @@ -344,7 +344,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_decrypt, 0, 3, MAY_BE_ST ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_cipher_iv_length, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algo, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_dh_compute_key, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) @@ -366,7 +366,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_spki_new, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, private_key, OpenSSLAsymmetricKey, 0) ZEND_ARG_TYPE_INFO(0, challenge, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, IS_LONG, 0, "OPENSSL_ALGO_MD5") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algo, IS_LONG, 0, "OPENSSL_ALGO_MD5") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_spki_verify, 0, 1, _IS_BOOL, 0) From d2a859d01fc1b23ea288d8aeae7115f0dc3bb96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 24 Sep 2020 18:36:04 +0200 Subject: [PATCH 4/4] Address new suggestions --- ext/hash/hash.stub.php | 6 +++--- ext/hash/hash_arginfo.h | 6 +++--- ext/openssl/openssl.stub.php | 6 +++--- ext/openssl/openssl_arginfo.h | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php index 554c79c92b09f..4cce866136b4d 100644 --- a/ext/hash/hash.stub.php +++ b/ext/hash/hash.stub.php @@ -10,12 +10,12 @@ function hash_hmac(string $algo, string $data, string $key, bool $binary = false function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false): string|false {} -function hash_init(string $algo, int $options = 0, string $key = ""): HashContext {} +function hash_init(string $algo, int $flags = 0, string $key = ""): HashContext {} function hash_update(HashContext $context, string $data): bool {} -/** @param resource $handle */ -function hash_update_stream(HashContext $context, $handle, int $length = -1): int {} +/** @param resource $stream */ +function hash_update_stream(HashContext $context, $stream, int $length = -1): int {} /** @param resource|null $stream_context */ function hash_update_file(HashContext $context, string $filename, $stream_context = null): bool {} diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h index 12c567eec1e36..cb8815de35123 100644 --- a/ext/hash/hash_arginfo.h +++ b/ext/hash/hash_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7c6e5ae7967feee2438ed44d2e5c88b3a74b21fb */ + * Stub hash: 5298231334ab85edd67ae46c33b7e6cffb2ecc53 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) @@ -24,7 +24,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0) ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() @@ -35,7 +35,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_stream, 0, 2, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, context, HashContext, 0) - ZEND_ARG_INFO(0, handle) + ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "-1") ZEND_END_ARG_INFO() diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index 2c0aaf8e8be5b..e77f4e4043a78 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -19,7 +19,7 @@ function openssl_x509_export_to_file(OpenSSLCertificate|string $certificate, str /** @param string $output */ function openssl_x509_export(OpenSSLCertificate|string $certificate, &$output, bool $no_text = true): bool {} -function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $digest_algo = "sha1", bool $raw_output = false): string|false {} +function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $digest_algo = "sha1", bool $binary = false): string|false {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_x509_check_private_key(OpenSSLCertificate|string $certificate, $private_key): bool {} @@ -103,7 +103,7 @@ function openssl_get_privatekey($private_key, ?string $passphrase = null): OpenS function openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false {} -function openssl_pbkdf2(string $passphrase, string $salt, int $key_length, int $iterations, string $digest_algo = "sha1"): string|false {} +function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algo = "sha1"): string|false {} function openssl_pkcs7_verify(string $input_filename, int $flags, ?string $signers_certificates_filename = null, array $ca_info = [], ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $output_filename = null): bool|int {} @@ -195,7 +195,7 @@ function openssl_get_cipher_methods(bool $aliases = false): array {} function openssl_get_curve_names(): array|false {} #endif -function openssl_digest(string $data, string $digest_algo, bool $raw_output = false): string|false {} +function openssl_digest(string $data, string $digest_algo, bool $binary = false): string|false {} /** @param string $tag */ function openssl_encrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", &$tag = null, string $aad = "", int $tag_length = 16): string|false {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 8446820f0aa35..1e30d9c2c172f 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9a2f44d52d5c386ececf5512dcb57af0f6de6896 */ + * Stub hash: d4f73f86e6f16a74ab5b60bb79c4a9f29e9bc4fb */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) @@ -16,7 +16,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_fingerprint, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algo, IS_STRING, 0, "\"sha1\"") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_check_private_key, 0, 2, _IS_BOOL, 0) @@ -151,7 +151,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkey_get_details, 0, 1, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pbkdf2, 0, 4, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, key_length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0) @@ -319,7 +319,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_digest, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, digest_algo, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_encrypt, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)