From b60a16c502eaf499cc46239e32c338f40ee7db58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 20 Aug 2020 16:03:34 +0200 Subject: [PATCH 1/4] Improve parameter handling in ext/openssl --- ext/openssl/openssl.c | 104 ++++--- ext/openssl/openssl.stub.php | 208 +++++++------ ext/openssl/openssl_arginfo.h | 277 +++++++++--------- ext/openssl/tests/bug38261.phpt | 4 +- ext/openssl/tests/bug60632.phpt | 2 +- ext/openssl/tests/bug68912.phpt | 2 +- ext/openssl/tests/bug70438.phpt | 2 +- .../tests/openssl_csr_export_basic.phpt | 2 +- .../openssl_csr_export_to_file_basic.phpt | 2 +- ext/openssl/tests/openssl_csr_sign_basic.phpt | 4 +- ext/openssl/tests/openssl_decrypt_error.phpt | 8 +- ext/openssl/tests/openssl_encrypt_error.phpt | 2 +- .../tests/openssl_pkcs12_export_basic.phpt | 2 +- .../openssl_pkcs12_export_to_file_basic.phpt | 2 +- ext/openssl/tests/openssl_seal_basic.phpt | 4 +- .../tests/openssl_x509_export_basic.phpt | 2 +- .../openssl_x509_export_to_file_basic.phpt | 2 +- .../tests/openssl_x509_fingerprint_basic.phpt | 2 +- .../tests/openssl_x509_read_basic.phpt | 4 +- 19 files changed, 314 insertions(+), 321 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index cd4eeaa2de7f2..8a0f835fd8f45 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -865,7 +865,7 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option zend_long cipher_algo = Z_LVAL_P(item); const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo); if (cipher == NULL) { - php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm for private key"); + php_error_docref(NULL, E_WARNING, "Unknown cipher method for private key"); return FAILURE; } else { req->priv_key_encrypt_cipher = cipher; @@ -1563,7 +1563,7 @@ PHP_FUNCTION(openssl_spki_new) mdtype = php_openssl_get_evp_md_from_algo(algo); if (!mdtype) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown digest method"); goto cleanup; } @@ -1589,7 +1589,7 @@ PHP_FUNCTION(openssl_spki_new) if (!NETSCAPE_SPKI_sign(spki, pkey, mdtype)) { php_openssl_store_errors(); - php_error_docref(NULL, E_WARNING, "Unable to sign with specified algorithm"); + php_error_docref(NULL, E_WARNING, "Unable to sign with specified digest method"); goto cleanup; } @@ -1845,7 +1845,7 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_b zend_string *ret; if (!(mdtype = EVP_get_digestbyname(method))) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm"); return NULL; } else if (!X509_digest(peer, mdtype, md, &n)) { php_openssl_store_errors(); @@ -3753,7 +3753,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req { EC_KEY *eckey; if (req->curve_name == NID_undef) { - php_error_docref(NULL, E_WARNING, "Missing configuration value: 'curve_name' not set"); + php_error_docref(NULL, E_WARNING, "Missing configuration value: \"curve_name\" not set"); return NULL; } eckey = EC_KEY_new_by_curve_name(req->curve_name); @@ -4465,11 +4465,13 @@ PHP_FUNCTION(openssl_pkey_get_private) size_t passphrase_len = sizeof("")-1; php_openssl_pkey_object *key_object; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s", &cert, &passphrase, &passphrase_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s!", &cert, &passphrase, &passphrase_len) == FAILURE) { RETURN_THROWS(); } - PHP_OPENSSL_CHECK_SIZE_T_TO_INT(passphrase_len, passphrase, 2); + if (passphrase) { + PHP_OPENSSL_CHECK_SIZE_T_TO_INT(passphrase_len, passphrase, 2); + } pkey = php_openssl_pkey_from_zval(cert, 0, passphrase, passphrase_len); if (pkey == NULL) { @@ -4847,7 +4849,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) RETVAL_LONG(-1); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl|pappp", &filename, &filename_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl|p!a!p!p!p!", &filename, &filename_len, &flags, &signersfilename, &signersfilename_len, &cainfo, &extracerts, &extracerts_len, &datafilename, &datafilename_len, &p7bfilename, &p7bfilename_len) == FAILURE) { RETURN_THROWS(); @@ -6082,7 +6084,7 @@ PHP_FUNCTION(openssl_cms_decrypt) Z_PARAM_PATH(outfilename, outfilename_len) Z_PARAM_ZVAL(recipcert) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(recipkey) + Z_PARAM_ZVAL_OR_NULL(recipkey) Z_PARAM_LONG(encoding) ZEND_PARSE_PARAMETERS_END(); @@ -6128,8 +6130,7 @@ PHP_FUNCTION(openssl_cms_decrypt) cms = SMIME_read_CMS(in, &datain); break; default: - php_error_docref(NULL, E_WARNING, - "Unknown OPENSSL encoding"); + zend_argument_value_error(5, "must be an OPENSSL_ENCODING_* constant"); goto clean_exit; } @@ -6456,13 +6457,18 @@ PHP_FUNCTION(openssl_sign) char * data; size_t data_len; EVP_MD_CTX *md_ctx; - zval *method = NULL; - zend_long signature_algo = OPENSSL_ALGO_SHA1; + zend_string *method_str = NULL; + zend_long method_long = OPENSSL_ALGO_SHA1; const EVP_MD *mdtype; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|z", &data, &data_len, &signature, &key, &method) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_STRING(data, data_len) + Z_PARAM_ZVAL(signature) + Z_PARAM_ZVAL(key) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_LONG(method_str, method_long) + ZEND_PARSE_PARAMETERS_END(); + pkey = php_openssl_pkey_from_zval(key, 0, "", 0); if (pkey == NULL) { if (!EG(exception)) { @@ -6471,17 +6477,10 @@ PHP_FUNCTION(openssl_sign) RETURN_FALSE; } - if (method == NULL || Z_TYPE_P(method) == IS_LONG) { - if (method != NULL) { - signature_algo = Z_LVAL_P(method); - } - mdtype = php_openssl_get_evp_md_from_algo(signature_algo); - } else if (Z_TYPE_P(method) == IS_STRING) { - mdtype = EVP_get_digestbyname(Z_STRVAL_P(method)); + if (method_str) { + mdtype = EVP_get_digestbyname(ZSTR_VAL(method_str)); } else { - // TODO Use proper ZPP check. - zend_argument_type_error(4, "must be of type string|int|null, %s given" , zend_zval_type_name(method)); - RETURN_THROWS(); + mdtype = php_openssl_get_evp_md_from_algo(method_long); } if (!mdtype) { php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); @@ -6522,26 +6521,23 @@ PHP_FUNCTION(openssl_verify) size_t data_len; char * signature; size_t signature_len; - zval *method = NULL; - zend_long signature_algo = OPENSSL_ALGO_SHA1; + zend_string *method_str = NULL; + zend_long method_long = OPENSSL_ALGO_SHA1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssz|z", &data, &data_len, &signature, &signature_len, &key, &method) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_STRING(data, data_len) + Z_PARAM_STRING(signature, signature_len) + Z_PARAM_ZVAL(key) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_LONG(method_str, method_long) + ZEND_PARSE_PARAMETERS_END(); PHP_OPENSSL_CHECK_SIZE_T_TO_UINT(signature_len, signature, 2); - if (method == NULL || Z_TYPE_P(method) == IS_LONG) { - if (method != NULL) { - signature_algo = Z_LVAL_P(method); - } - mdtype = php_openssl_get_evp_md_from_algo(signature_algo); - } else if (Z_TYPE_P(method) == IS_STRING) { - mdtype = EVP_get_digestbyname(Z_STRVAL_P(method)); + if (method_str) { + mdtype = EVP_get_digestbyname(ZSTR_VAL(method_str)); } else { - // TODO Use proper ZPP check. - zend_argument_type_error(4, "must be of type string|int|null, %s given" , zend_zval_type_name(method)); - RETURN_THROWS(); + mdtype = php_openssl_get_evp_md_from_algo(method_long); } if (!mdtype) { php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); @@ -6579,8 +6575,8 @@ PHP_FUNCTION(openssl_seal) unsigned char iv_buf[EVP_MAX_IV_LENGTH + 1], *buf = NULL, **eks; char * data; size_t data_len; - char *method =NULL; - size_t method_len = 0; + char *method; + size_t method_len; const EVP_CIPHER *cipher; EVP_CIPHER_CTX *ctx; @@ -6606,7 +6602,7 @@ PHP_FUNCTION(openssl_seal) iv_len = EVP_CIPHER_iv_length(cipher); if (!iv && iv_len > 0) { - zend_argument_value_error(6, "must provide an IV for chosen cipher algorithm"); + zend_argument_value_error(6, "cannot be null for the chosen cipher method"); RETURN_THROWS(); } @@ -6707,11 +6703,11 @@ PHP_FUNCTION(openssl_open) size_t data_len; char * ekey; size_t ekey_len; - char *method = NULL, *iv = NULL; - size_t method_len = 0, iv_len = 0; + char *method, *iv = NULL; + size_t method_len, iv_len = 0; const EVP_CIPHER *cipher; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "szszs|s", &data, &data_len, &opendata, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "szszs|s!", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len, &iv, &iv_len) == FAILURE) { RETURN_THROWS(); } @@ -6729,14 +6725,14 @@ PHP_FUNCTION(openssl_open) cipher = EVP_get_cipherbyname(method); if (!cipher) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown cipher method"); RETURN_FALSE; } cipher_iv_len = EVP_CIPHER_iv_length(cipher); if (cipher_iv_len > 0) { if (!iv) { - zend_argument_value_error(6, "must provide an IV for chosen cipher algorithm"); + zend_argument_value_error(6, "cannot be null for the chosen cipher method"); RETURN_THROWS(); } if ((size_t)cipher_iv_len != iv_len) { @@ -6858,7 +6854,7 @@ PHP_FUNCTION(openssl_digest) } mdtype = EVP_get_digestbyname(method); if (!mdtype) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown digest method"); RETURN_FALSE; } @@ -7118,7 +7114,7 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt( cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { - php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown cipher method"); return NULL; } @@ -7234,7 +7230,7 @@ PHP_OPENSSL_API zend_string* php_openssl_decrypt( cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { - php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown cipher method"); return NULL; } @@ -7296,7 +7292,7 @@ PHP_FUNCTION(openssl_decrypt) size_t data_len, method_len, password_len, iv_len = 0, tag_len = 0, aad_len = 0; zend_string *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lsss", &data, &data_len, &method, &method_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lss!s", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len, &tag, &tag_len, &aad, &aad_len) == FAILURE) { RETURN_THROWS(); } @@ -7320,7 +7316,7 @@ PHP_OPENSSL_API zend_long php_openssl_cipher_iv_length(const char *method) cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { - php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown cipher method"); return -1; } diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index 36fdcf42af24c..b2d595fe656fa 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -14,77 +14,74 @@ final class OpenSSLAsymmetricKey { } -function openssl_x509_export_to_file(OpenSSLCertificate|string $x509, string $outfilename, bool $notext = true): bool {} +function openssl_x509_export_to_file(OpenSSLCertificate|string $certificate, string $output_filename, bool $no_description = true): bool {} -/** @param string $out */ -function openssl_x509_export(OpenSSLCertificate|string $x509, &$out, bool $notext = true): bool {} +/** @param string $output */ +function openssl_x509_export(OpenSSLCertificate|string $certificate, &$output, bool $no_description = true): bool {} -function openssl_x509_fingerprint(OpenSSLCertificate|string $x509, string $method = "sha1", bool $raw_output = false): string|false {} +function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $hashing_algorithm = "sha1", bool $raw_output = false): string|false {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key */ -function openssl_x509_check_private_key(OpenSSLCertificate|string $x509, $key): bool {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_x509_check_private_key(OpenSSLCertificate|string $certificate, $private_key): bool {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key */ -function openssl_x509_verify(OpenSSLCertificate|string $x509, $key): int {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */ +function openssl_x509_verify(OpenSSLCertificate|string $certificate, $public_key): int {} -function openssl_x509_parse(OpenSSLCertificate|string $x509, bool $shortname = true): array|false {} +function openssl_x509_parse(OpenSSLCertificate|string $certificate, bool $short_names = true): array|false {} -function openssl_x509_checkpurpose(OpenSSLCertificate|string $x509, int $purpose, ?array $cainfo = [], ?string $untrustedfile = null): bool|int {} +function openssl_x509_checkpurpose(OpenSSLCertificate|string $certificate, int $purpose, ?array $certificate_authority_info = [], ?string $untrusted_certificates_file = null): bool|int {} -function openssl_x509_read(OpenSSLCertificate|string $x509): OpenSSLCertificate|false {} +function openssl_x509_read(OpenSSLCertificate|string $certificate): OpenSSLCertificate|false {} /** @deprecated */ -function openssl_x509_free(OpenSSLCertificate $x509): void {} +function openssl_x509_free(OpenSSLCertificate $certificate): void {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $priv_key */ -function openssl_pkcs12_export_to_file(OpenSSLCertificate|string $x509cert, string $filename, $priv_key, string $pass, array $args = []): bool {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_pkcs12_export_to_file(OpenSSLCertificate|string $certificate, string $filename, $private_key, string $passphrase, array $options = []): bool {} /** - * @param string $out - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $priv_key + * @param string $output + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_pkcs12_export(OpenSSLCertificate|string $x509, &$out, $priv_key, string $pass, array $args = []): bool {} +function openssl_pkcs12_export(OpenSSLCertificate|string $certificate, &$output, $private_key, string $passphrase, array $options = []): bool {} -/** @param array $certs */ -function openssl_pkcs12_read(string $pkcs12, &$certs, string $pass): bool {} +/** @param array $certificates */ +function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase): bool {} -function openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $csr, string $outfilename, bool $notext = true): bool {} +function openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $request, string $output_filename, bool $no_description = true): bool {} -/** @param OpenSSLAsymmetricKey $out */ -function openssl_csr_export(OpenSSLCertificateSigningRequest|string $csr, &$out, bool $notext = true): bool {} +/** @param OpenSSLAsymmetricKey $output */ +function openssl_csr_export(OpenSSLCertificateSigningRequest|string $request, &$output, bool $no_description = true): bool {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $priv_key */ -function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $csr, OpenSSLCertificate|string|null $cacert, $priv_key, int $days, ?array $config_args = null, int $serial = 0): OpenSSLCertificate|false {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $request, OpenSSLCertificate|string|null $ca_certificate, $private_key, int $days, ?array $options = null, int $serial = 0): OpenSSLCertificate|false {} -/** @param OpenSSLAsymmetricKey $privkey */ -function openssl_csr_new(array $dn, &$privkey, ?array $configargs = null, ?array $extraattribs = null): OpenSSLCertificateSigningRequest|false {} +/** @param OpenSSLAsymmetricKey $private_key */ +function openssl_csr_new(array $distinguished_names, &$private_key, ?array $options = null, ?array $extra_options = null): OpenSSLCertificateSigningRequest|false {} -function openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $csr, bool $use_shortnames = true): array|false {} +function openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $request, bool $short_names = true): array|false {} -function openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $csr, bool $use_shortnames = true): OpenSSLAsymmetricKey|false {} +function openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $request, bool $short_names = true): OpenSSLAsymmetricKey|false {} -function openssl_pkey_new(?array $configargs = null): OpenSSLAsymmetricKey|false {} +function openssl_pkey_new(?array $options = null): OpenSSLAsymmetricKey|false {} -/** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key - * @param string $out - */ -function openssl_pkey_export_to_file($key, string $outfilename, ?string $passphrase = null, ?array $configargs = null): bool {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_pkey_export_to_file($private_key, string $output_filename, ?string $passphrase = null, ?array $options = null): bool {} /** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key - * @param string $out + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key + * @param string $output */ -function openssl_pkey_export($key, &$out, ?string $passphrase = null, ?array $configargs = null): bool {} +function openssl_pkey_export($private_key, &$output, ?string $passphrase = null, ?array $options = null): bool {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $cert */ -function openssl_pkey_get_public($cert): OpenSSLAsymmetricKey|false {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */ +function openssl_pkey_get_public($public_key): OpenSSLAsymmetricKey|false {} /** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $cert + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key * @alias openssl_pkey_get_public */ -function openssl_get_publickey($cert): OpenSSLAsymmetricKey|false {} +function openssl_get_publickey($public_key): OpenSSLAsymmetricKey|false {} /** @deprecated */ function openssl_pkey_free(OpenSSLAsymmetricKey $key): void {} @@ -95,105 +92,100 @@ function openssl_pkey_free(OpenSSLAsymmetricKey $key): void {} */ function openssl_free_key(OpenSSLAsymmetricKey $key): void {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key */ -function openssl_pkey_get_private($key, string $passphrase = UNKNOWN): OpenSSLAsymmetricKey|false {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_pkey_get_private($private_key, ?string $passphrase = null): OpenSSLAsymmetricKey|false {} /** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key * @alias openssl_pkey_get_private */ -function openssl_get_privatekey($key, string $passphrase = UNKNOWN): OpenSSLAsymmetricKey|false {} +function openssl_get_privatekey($private_key, ?string $passphrase = null): OpenSSLAsymmetricKey|false {} function openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false {} -function openssl_pbkdf2(string $password, 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_method = "sha1"): string|false {} -function openssl_pkcs7_verify(string $filename, int $flags, string $signerscerts = UNKNOWN, array $cainfo = UNKNOWN, string $extracerts = UNKNOWN, string $content = UNKNOWN, string $pk7 = UNKNOWN): bool|int {} +function openssl_pkcs7_verify(string $filename, int $flags, ?string $output_filename = null, ?array $certificate_authority_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7_filename = null): bool|int {} -/** @param OpenSSLCertificate|array|string $recipcerts */ -function openssl_pkcs7_encrypt(string $infile, string $outfile, $recipcerts, ?array $headers, int $flags = 0, int $cipher = OPENSSL_CIPHER_RC2_40): bool {} +/** @param OpenSSLCertificate|array|string $certificate */ +function openssl_pkcs7_encrypt(string $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_method = OPENSSL_CIPHER_RC2_40): bool {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $signkey */ -function openssl_pkcs7_sign(string $infile, string $outfile, OpenSSLCertificate|string $signcert, $signkey, ?array $headers, int $flags = PKCS7_DETACHED, ?string $extracertsfilename = null): bool {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_pkcs7_sign(string $filename, string $output_filename, OpenSSLCertificate|string $certificate, $private_key, ?array $headers, int $flags = PKCS7_DETACHED, ?string $untrusted_certificates_filename = null): bool {} /** - * @param OpenSSLCertificate|string $recipcert - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string|null $recipkey + * @param OpenSSLCertificate|string $certificate + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string|null $private_key */ -function openssl_pkcs7_decrypt(string $infilename, string $outfilename, $recipcert, $recipkey = null): bool {} +function openssl_pkcs7_decrypt(string $filename, string $output_filename, $certificate, $private_key = null): bool {} -/** @param array $certs */ -function openssl_pkcs7_read(string $infilename, &$certs): bool {} +/** @param array $certificates */ +function openssl_pkcs7_read(string $filename, &$certificates): bool {} -function openssl_cms_verify(string $filename, int $flags = 0, ?string $signerscerts = null, ?array $cainfo = null, ?string $extracerts = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {} +function openssl_cms_verify(string $filename, int $flags = 0, ?string $certificates = null, ?array $certificate_authority_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {} -/** @param OpenSSLCertificate|array|string $recipcerts */ -function openssl_cms_encrypt(string $infile, string $outfile, $recipcerts, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher = OPENSSL_CIPHER_RC2_40): bool {} +/** @param OpenSSLCertificate|array|string $certificate */ +function openssl_cms_encrypt(string $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_method = OPENSSL_CIPHER_RC2_40): bool {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $signkey */ -function openssl_cms_sign(string $infile, string $outfile, OpenSSLCertificate|string $signcert, $signkey, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, ?string $extracertsfilename = null): bool {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ +function openssl_cms_sign(string $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 {} /** - * @param OpenSSLCertificate|string $recipcert - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $recipkey + * @param OpenSSLCertificate|string $certificate + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string|null $private_key */ -function openssl_cms_decrypt(string $infilename, string $outfilename, $recipcert, $recipkey = UNKNOWN, int $encoding = OPENSSL_ENCODING_SMIME): bool {} +function openssl_cms_decrypt(string $filename, string $output_filename, $certificate, $private_key = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {} -/** @param array $certs */ -function openssl_cms_read(string $infilename, &$certs): bool {} +/** @param array $certificates */ +function openssl_cms_read(string $filename, &$certificates): bool {} /** - * @param string $crypted - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key + * @param string $encrypted_data + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_private_encrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {} +function openssl_private_encrypt(string $data, &$encrypted_data, $private_key, int $padding = OPENSSL_PKCS1_PADDING): bool {} /** - * @param string $crypted - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key + * @param string $encrypted_data + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_private_decrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {} +function openssl_private_decrypt(string $data, &$encrypted_data, $private_key, int $padding = OPENSSL_PKCS1_PADDING): bool {} /** - * @param string $crypted - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key + * @param string $encrypted_data + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */ -function openssl_public_encrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {} +function openssl_public_encrypt(string $data, &$encrypted_data, $public_key, int $padding = OPENSSL_PKCS1_PADDING): bool {} /** - * @param string $crypted - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key + * @param string $encrypted_data + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */ -function openssl_public_decrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {} +function openssl_public_decrypt(string $data, &$encrypted_data, $public_key, int $padding = OPENSSL_PKCS1_PADDING): bool {} function openssl_error_string(): string|false {} /** * @param string $signature - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key - * @param int|string $method + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_sign(string $data, &$signature, $key, $method = OPENSSL_ALGO_SHA1): bool {} +function openssl_sign(string $data, &$signature, $private_key, string|int $algorithm = OPENSSL_ALGO_SHA1): bool {} -/** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key - * @param int|string $method - */ -function openssl_verify(string $data, string $signature, $key, $method = OPENSSL_ALGO_SHA1): int|false {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */ +function openssl_verify(string $data, string $signature, $public_key, string|int $algorithm = OPENSSL_ALGO_SHA1): int|false {} /** - * @param string $sealdata - * @param array $ekeys - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $pubkeys - * @param string $iv + * @param string $sealed_data + * @param array $encrypted_keys + * @param string $initialization_vector */ -function openssl_seal(string $data, &$sealdata, &$ekeys, array $pubkeys, string $method, &$iv = UNKNOWN): int|false {} +function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_method, &$initialization_vector = null): int|false {} /** - * @param string $opendata - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $privkey + * @param string $output + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_open(string $data, &$opendata, string $ekey, $privkey, string $method, string $iv = UNKNOWN): bool {} +function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_method, ?string $initialization_vector = null): bool {} function openssl_get_md_methods(bool $aliases = false): array {} @@ -203,32 +195,32 @@ function openssl_get_cipher_methods(bool $aliases = false): array {} function openssl_get_curve_names(): array|false {} #endif -function openssl_digest(string $data, string $method, bool $raw_output = false): string|false {} +function openssl_digest(string $data, string $digest_method, bool $raw_output = false): string|false {} /** @param string $tag */ -function openssl_encrypt(string $data, string $method, string $password, int $options = 0, string $iv = '', &$tag = UNKNOWN, string $aad = '', int $tag_length = 16): string|false {} +function openssl_encrypt(string $data, string $cipher_method, string $passphrase, int $options = 0, string $initialization_vector = "", &$tag = null, string $additional_authentication_data = "", int $tag_length = 16): string|false {} -function openssl_decrypt(string $data, string $method, string $password, int $options = 0, string $iv = '', string $tag = UNKNOWN, string $aad = ''): string|false {} +function openssl_decrypt(string $data, string $method, string $passphrase, int $options = 0, string $initialization_vector = "", ?string $tag = null, string $additional_authentication_data = ""): string|false {} -function openssl_cipher_iv_length(string $method): int|false {} +function openssl_cipher_iv_length(string $cipher_method): int|false {} -function openssl_dh_compute_key(string $pub_key, OpenSSLAsymmetricKey $dh_key): string|false {} +function openssl_dh_compute_key(string $public_key, OpenSSLAsymmetricKey $private_key): string|false {} /** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $peer_pub_key - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $priv_key + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_pkey_derive($peer_pub_key, $priv_key, int $keylen = 0): string|false {} +function openssl_pkey_derive($public_key, $private_key, int $key_length = 0): string|false {} -/** @param bool $result_is_strong */ -function openssl_random_pseudo_bytes(int $length, &$result_is_strong = UNKNOWN): string {} +/** @param bool $strong_result */ +function openssl_random_pseudo_bytes(int $length, &$strong_result = null): string {} -function openssl_spki_new(OpenSSLAsymmetricKey $privkey, string $challenge, int $algo = OPENSSL_ALGO_MD5): string|false {} +function openssl_spki_new(OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_method = OPENSSL_ALGO_MD5): string|false {} -function openssl_spki_verify(string $spki): bool {} +function openssl_spki_verify(string $signed_public_key_and_challenge): bool {} -function openssl_spki_export(string $spki): string|false {} +function openssl_spki_export(string $signed_public_key_and_challenge): string|false {} -function openssl_spki_export_challenge(string $spki): string|false {} +function openssl_spki_export_challenge(string $signed_public_key_and_challenge): string|false {} function openssl_get_cert_locations(): array {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index dd877268228cd..73dcfc45b0be5 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,134 +1,134 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7f1066b832ce307914f641de5ed2c40ec10290ba */ + * Stub hash: 15274eead6758c5c7ae2f9ecd4806bd78fa765c9 */ 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, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, notext, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(1, out) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, notext, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(1, output) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") 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, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, method, IS_STRING, 0, "\"sha1\"") + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hashing_algorithm, IS_STRING, 0, "\"sha1\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _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) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(0, key) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(0, private_key) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_verify, 0, 2, IS_LONG, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(0, key) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(0, public_key) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_parse, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, shortname, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, short_names, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_checkpurpose, 0, 2, MAY_BE_BOOL|MAY_BE_LONG) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, purpose, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cainfo, IS_ARRAY, 1, "[]") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrustedfile, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificate_authority_info, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_file, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_x509_read, 0, 1, OpenSSLCertificate, MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_free, 0, 1, IS_VOID, 0) - ZEND_ARG_OBJ_INFO(0, x509, OpenSSLCertificate, 0) + ZEND_ARG_OBJ_INFO(0, certificate, OpenSSLCertificate, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_export_to_file, 0, 4, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, x509cert, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_INFO(0, priv_key) - ZEND_ARG_TYPE_INFO(0, pass, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, args, IS_ARRAY, 0, "[]") + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_export, 0, 4, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(1, out) - ZEND_ARG_INFO(0, priv_key) - ZEND_ARG_TYPE_INFO(0, pass, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, args, IS_ARRAY, 0, "[]") + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(1, output) + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_read, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, pkcs12, IS_STRING, 0) - ZEND_ARG_INFO(1, certs) - ZEND_ARG_TYPE_INFO(0, pass, IS_STRING, 0) + ZEND_ARG_INFO(1, certificates) + ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export_to_file, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, notext, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(1, out) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, notext, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(1, output) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_sign, 0, 4, OpenSSLCertificate, MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) - ZEND_ARG_OBJ_TYPE_MASK(0, cacert, OpenSSLCertificate, MAY_BE_STRING|MAY_BE_NULL, NULL) - ZEND_ARG_INFO(0, priv_key) + ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, ca_certificate, OpenSSLCertificate, MAY_BE_STRING|MAY_BE_NULL, NULL) + ZEND_ARG_INFO(0, private_key) ZEND_ARG_TYPE_INFO(0, days, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config_args, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, serial, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_new, 0, 2, OpenSSLCertificateSigningRequest, MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, dn, IS_ARRAY, 0) - ZEND_ARG_INFO(1, privkey) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, configargs, IS_ARRAY, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extraattribs, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO(0, distinguished_names, IS_ARRAY, 0) + ZEND_ARG_INFO(1, private_key) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extra_options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_csr_get_subject, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_shortnames, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, short_names, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_get_public_key, 0, 1, OpenSSLAsymmetricKey, MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_shortnames, _IS_BOOL, 0, "true") + ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, short_names, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_pkey_new, 0, 0, OpenSSLAsymmetricKey, MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, configargs, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_export_to_file, 0, 2, _IS_BOOL, 0) - ZEND_ARG_INFO(0, key) - ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0) + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, passphrase, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, configargs, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_export, 0, 2, _IS_BOOL, 0) - ZEND_ARG_INFO(0, key) - ZEND_ARG_INFO(1, out) + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_INFO(1, output) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, passphrase, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, configargs, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_pkey_get_public, 0, 1, OpenSSLAsymmetricKey, MAY_BE_FALSE) - ZEND_ARG_INFO(0, cert) + ZEND_ARG_INFO(0, public_key) ZEND_END_ARG_INFO() #define arginfo_openssl_get_publickey arginfo_openssl_pkey_get_public @@ -140,8 +140,8 @@ ZEND_END_ARG_INFO() #define arginfo_openssl_free_key arginfo_openssl_pkey_free ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_pkey_get_private, 0, 1, OpenSSLAsymmetricKey, MAY_BE_FALSE) - ZEND_ARG_INFO(0, key) - ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0) + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, passphrase, IS_STRING, 1, "null") ZEND_END_ARG_INFO() #define arginfo_openssl_get_privatekey arginfo_openssl_pkey_get_private @@ -151,60 +151,60 @@ 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, password, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, passphrase, 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) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, IS_STRING, 0, "\'sha1\'") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_method, 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) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, signerscerts, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, cainfo, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, extracerts, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, pk7, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, output_filename, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificate_authority_info, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pk7_filename, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_encrypt, 0, 4, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, infile, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, outfile, IS_STRING, 0) - ZEND_ARG_INFO(0, recipcerts) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + 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, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_method, 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) - ZEND_ARG_TYPE_INFO(0, infile, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, outfile, IS_STRING, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, signcert, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(0, signkey) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(0, private_key) ZEND_ARG_TYPE_INFO(0, headers, IS_ARRAY, 1) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "PKCS7_DETACHED") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extracertsfilename, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_decrypt, 0, 3, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0) - ZEND_ARG_INFO(0, recipcert) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, recipkey, "null") + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + ZEND_ARG_INFO(0, certificate) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, private_key, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_read, 0, 2, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0) - ZEND_ARG_INFO(1, certs) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_INFO(1, certificates) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_verify, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, signerscerts, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cainfo, IS_ARRAY, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extracerts, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificates, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificate_authority_info, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pk7, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sigfile, IS_STRING, 1, "null") @@ -212,31 +212,31 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_verify, 0, 1, _IS_BO ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_encrypt, 0, 4, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, infile, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, outfile, IS_STRING, 0) - ZEND_ARG_INFO(0, recipcerts) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + 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, encoding, IS_LONG, 0, "OPENSSL_ENCODING_SMIME") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_method, 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) - ZEND_ARG_TYPE_INFO(0, infile, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, outfile, IS_STRING, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, signcert, OpenSSLCertificate, MAY_BE_STRING, NULL) - ZEND_ARG_INFO(0, signkey) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) + ZEND_ARG_INFO(0, private_key) 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, extracertsfilename, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_decrypt, 0, 3, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0) - ZEND_ARG_INFO(0, recipcert) - ZEND_ARG_INFO(0, recipkey) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) + ZEND_ARG_INFO(0, certificate) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, private_key, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_LONG, 0, "OPENSSL_ENCODING_SMIME") ZEND_END_ARG_INFO() @@ -244,16 +244,21 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_private_encrypt, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_INFO(1, crypted) - ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(1, encrypted_data) + ZEND_ARG_INFO(0, private_key) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, padding, IS_LONG, 0, "OPENSSL_PKCS1_PADDING") ZEND_END_ARG_INFO() #define arginfo_openssl_private_decrypt arginfo_openssl_private_encrypt -#define arginfo_openssl_public_encrypt arginfo_openssl_private_encrypt +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_public_encrypt, 0, 3, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) + ZEND_ARG_INFO(1, encrypted_data) + ZEND_ARG_INFO(0, public_key) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, padding, IS_LONG, 0, "OPENSSL_PKCS1_PADDING") +ZEND_END_ARG_INFO() -#define arginfo_openssl_public_decrypt arginfo_openssl_private_encrypt +#define arginfo_openssl_public_decrypt arginfo_openssl_public_encrypt ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_error_string, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_END_ARG_INFO() @@ -261,33 +266,33 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_sign, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_INFO(1, signature) - ZEND_ARG_INFO(0, key) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, method, "OPENSSL_ALGO_SHA1") + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_TYPE_MASK(0, algorithm, MAY_BE_STRING|MAY_BE_LONG, "OPENSSL_ALGO_SHA1") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_verify, 0, 3, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, signature, IS_STRING, 0) - ZEND_ARG_INFO(0, key) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, method, "OPENSSL_ALGO_SHA1") + ZEND_ARG_INFO(0, public_key) + ZEND_ARG_TYPE_MASK(0, algorithm, MAY_BE_STRING|MAY_BE_LONG, "OPENSSL_ALGO_SHA1") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_seal, 0, 5, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_INFO(1, sealdata) - ZEND_ARG_INFO(1, ekeys) - ZEND_ARG_TYPE_INFO(0, pubkeys, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) - ZEND_ARG_INFO(1, iv) + 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_method, IS_STRING, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, initialization_vector, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_open, 0, 5, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_INFO(1, opendata) - ZEND_ARG_TYPE_INFO(0, ekey, IS_STRING, 0) - ZEND_ARG_INFO(0, privkey) - ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, iv, IS_STRING, 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_method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, initialization_vector, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_get_md_methods, 0, 0, IS_ARRAY, 0) @@ -303,63 +308,63 @@ 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, method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, digest_method, 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, method, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_method, 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, "\'\'") - ZEND_ARG_INFO(1, tag) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, aad, IS_STRING, 0, "\'\'") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, initialization_vector, IS_STRING, 0, "\"\"") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, tag, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_authentication_data, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tag_length, IS_LONG, 0, "16") 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, method, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, password, 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, "\'\'") - ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, aad, IS_STRING, 0, "\'\'") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, initialization_vector, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tag, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_authentication_data, IS_STRING, 0, "\"\"") 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, method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_method, 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) - ZEND_ARG_TYPE_INFO(0, pub_key, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, dh_key, OpenSSLAsymmetricKey, 0) + ZEND_ARG_TYPE_INFO(0, public_key, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, private_key, OpenSSLAsymmetricKey, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkey_derive, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_INFO(0, peer_pub_key) - ZEND_ARG_INFO(0, priv_key) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, keylen, IS_LONG, 0, "0") + ZEND_ARG_INFO(0, public_key) + ZEND_ARG_INFO(0, private_key) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key_length, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_random_pseudo_bytes, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) - ZEND_ARG_INFO(1, result_is_strong) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, strong_result, "null") 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, privkey, OpenSSLAsymmetricKey, 0) + 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, algo, IS_LONG, 0, "OPENSSL_ALGO_MD5") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_method, 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) - ZEND_ARG_TYPE_INFO(0, spki, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, signed_public_key_and_challenge, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_spki_export, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, spki, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, signed_public_key_and_challenge, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_openssl_spki_export_challenge arginfo_openssl_spki_export diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt index 827f3aca75535..9cb16e3e8f70d 100644 --- a/ext/openssl/tests/bug38261.phpt +++ b/ext/openssl/tests/bug38261.phpt @@ -40,6 +40,6 @@ try { --EXPECT-- bool(false) bool(false) -openssl_x509_parse(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, array given +openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given bool(false) -openssl_x509_parse(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, stdClass given +openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, stdClass given diff --git a/ext/openssl/tests/bug60632.phpt b/ext/openssl/tests/bug60632.phpt index 3f2b0f0197e01..940106f571ca7 100644 --- a/ext/openssl/tests/bug60632.phpt +++ b/ext/openssl/tests/bug60632.phpt @@ -27,4 +27,4 @@ try { } ?> --EXPECT-- -openssl_seal(): Argument #6 ($iv) must provide an IV for chosen cipher algorithm +openssl_seal(): Argument #6 ($initialization_vector) cannot be null for the chosen cipher method diff --git a/ext/openssl/tests/bug68912.phpt b/ext/openssl/tests/bug68912.phpt index 64d1a9b60a515..97e75df54572d 100644 --- a/ext/openssl/tests/bug68912.phpt +++ b/ext/openssl/tests/bug68912.phpt @@ -19,4 +19,4 @@ try { } ?> --EXPECT-- -openssl_spki_new(): Argument #1 ($privkey) must be of type OpenSSLAsymmetricKey, resource given +openssl_spki_new(): Argument #1 ($private_key) must be of type OpenSSLAsymmetricKey, resource given diff --git a/ext/openssl/tests/bug70438.phpt b/ext/openssl/tests/bug70438.phpt index 173f0a0066645..23536c4bb09c7 100644 --- a/ext/openssl/tests/bug70438.phpt +++ b/ext/openssl/tests/bug70438.phpt @@ -26,7 +26,7 @@ openssl_open($sealed, $decrypted, $ekeys[0], $priv_key, $cipher, $iv); echo $decrypted; ?> --EXPECTF-- -openssl_seal(): Argument #6 ($iv) must provide an IV for chosen cipher algorithm +openssl_seal(): Argument #6 ($initialization_vector) cannot be null for the chosen cipher method Warning: openssl_seal(): Unknown signature algorithm in %s on line %d openssl_seal() test diff --git a/ext/openssl/tests/openssl_csr_export_basic.phpt b/ext/openssl/tests/openssl_csr_export_basic.phpt index 5f8c9f2c6d2f3..032174b58b0fa 100644 --- a/ext/openssl/tests/openssl_csr_export_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_basic.phpt @@ -44,5 +44,5 @@ bool(true) Warning: openssl_csr_export(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d bool(false) -openssl_csr_export(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given +openssl_csr_export(): Argument #1 ($request) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given bool(true) diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt index 4efa6f35d5d13..8d962444155d9 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt @@ -77,5 +77,5 @@ JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR Warning: openssl_csr_export_to_file(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d bool(false) -openssl_csr_export_to_file(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given +openssl_csr_export_to_file(): Argument #1 ($request) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given bool(true) diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt index 8d32ad1943acd..2045369e39046 100644 --- a/ext/openssl/tests/openssl_csr_sign_basic.phpt +++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt @@ -75,8 +75,8 @@ bool(false) Warning: openssl_csr_sign(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d bool(false) -openssl_csr_sign(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string, array given -openssl_csr_sign(): Argument #2 ($cacert) must be of type OpenSSLCertificate|string|null, array given +openssl_csr_sign(): Argument #1 ($request) must be of type OpenSSLCertificateSigningRequest|string, array given +openssl_csr_sign(): Argument #2 ($ca_certificate) must be of type OpenSSLCertificate|string|null, array given Key array must be of the form array(0 => key, 1 => phrase) object(OpenSSLCertificate)#%d (0) { } diff --git a/ext/openssl/tests/openssl_decrypt_error.phpt b/ext/openssl/tests/openssl_decrypt_error.phpt index 5f79cd86c2e5d..33a2ba82e9b18 100644 --- a/ext/openssl/tests/openssl_decrypt_error.phpt +++ b/ext/openssl/tests/openssl_decrypt_error.phpt @@ -29,17 +29,17 @@ string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM=" string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM=" bool(false) -Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d +Warning: openssl_decrypt(): Unknown cipher method in %s on line %d bool(false) bool(false) -Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d +Warning: openssl_decrypt(): Unknown cipher method in %s on line %d bool(false) -Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d +Warning: openssl_decrypt(): Unknown cipher method in %s on line %d bool(false) -Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d +Warning: openssl_decrypt(): Unknown cipher method in %s on line %d bool(false) Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d diff --git a/ext/openssl/tests/openssl_encrypt_error.phpt b/ext/openssl/tests/openssl_encrypt_error.phpt index 53bc371f4606f..b8fa8d5ba3b44 100644 --- a/ext/openssl/tests/openssl_encrypt_error.phpt +++ b/ext/openssl/tests/openssl_encrypt_error.phpt @@ -22,7 +22,7 @@ var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong)); var_dump(openssl_encrypt($data, $method, $password, OPENSSL_DONT_ZERO_PAD_KEY, $iv)); ?> --EXPECTF-- -Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d +Warning: openssl_encrypt(): Unknown cipher method in %s on line %d bool(false) Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d diff --git a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt index fc8a146c0c4e4..03947f3a497f5 100644 --- a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt @@ -53,4 +53,4 @@ bool(false) Warning: openssl_pkcs12_export(): X.509 Certificate cannot be retrieved in %s on line %d bool(false) -openssl_pkcs12_export(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, OpenSSLAsymmetricKey given +openssl_pkcs12_export(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, OpenSSLAsymmetricKey given diff --git a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt index 69363fe34f55a..43d51753a01a2 100644 --- a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt @@ -58,4 +58,4 @@ bool(false) Warning: openssl_pkcs12_export_to_file(): X.509 Certificate cannot be retrieved in %s on line %d bool(false) -openssl_pkcs12_export_to_file(): Argument #1 ($x509cert) must be of type OpenSSLCertificate|string, OpenSSLAsymmetricKey given +openssl_pkcs12_export_to_file(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, OpenSSLAsymmetricKey given diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt index bdbbd01208aa6..16efb05a665c5 100644 --- a/ext/openssl/tests/openssl_seal_basic.phpt +++ b/ext/openssl/tests/openssl_seal_basic.phpt @@ -40,13 +40,13 @@ var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong), $method)); --EXPECTF-- Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d bool(false) -openssl_seal(): Argument #4 ($pubkeys) cannot be empty +openssl_seal(): Argument #4 ($public_key) cannot be empty int(19) int(19) Warning: openssl_seal(): Not a public key (2th member of pubkeys) in %s on line %d bool(false) -openssl_seal(): Argument #4 ($pubkeys) cannot be empty +openssl_seal(): Argument #4 ($public_key) cannot be empty Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d bool(false) diff --git a/ext/openssl/tests/openssl_x509_export_basic.phpt b/ext/openssl/tests/openssl_x509_export_basic.phpt index 43dc843b702b3..2f872960199ca 100644 --- a/ext/openssl/tests/openssl_x509_export_basic.phpt +++ b/ext/openssl/tests/openssl_x509_export_basic.phpt @@ -40,7 +40,7 @@ bool(true) Warning: openssl_x509_export(): X.509 Certificate cannot be retrieved in %s on line %d bool(false) bool(true) -openssl_x509_export(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, array given +openssl_x509_export(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given int(0) int(0) int(%d) diff --git a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt index 71a494f40196f..60cbd480c3903 100644 --- a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt @@ -39,6 +39,6 @@ bool(true) Warning: openssl_x509_export_to_file(): X.509 Certificate cannot be retrieved in %s on line %d bool(false) bool(true) -openssl_x509_export_to_file(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, array given +openssl_x509_export_to_file(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given --- bool(true) diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt index c4524ada0b1a0..fdf2b7732260e 100644 --- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt +++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt @@ -40,5 +40,5 @@ Warning: openssl_x509_fingerprint(): X.509 Certificate cannot be retrieved in %s bool(false) ** Testing bad hash method ** -Warning: openssl_x509_fingerprint(): Unknown signature algorithm in %s on line %d +Warning: openssl_x509_fingerprint(): Unknown hashing algorithm in %s on line %d bool(false) diff --git a/ext/openssl/tests/openssl_x509_read_basic.phpt b/ext/openssl/tests/openssl_x509_read_basic.phpt index e4d956b120706..60d7a1eee7751 100644 --- a/ext/openssl/tests/openssl_x509_read_basic.phpt +++ b/ext/openssl/tests/openssl_x509_read_basic.phpt @@ -42,5 +42,5 @@ Warning: openssl_x509_read(): X.509 Certificate cannot be retrieved in %s on lin bool(false) object(OpenSSLCertificate)#%d (0) { } -openssl_x509_read(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, array given -openssl_x509_read(): Argument #1 ($x509) must be of type OpenSSLCertificate|string, array given +openssl_x509_read(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given +openssl_x509_read(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given From 69366ac1999a6c225c775729e3c27d3145a515df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 25 Aug 2020 10:08:55 +0200 Subject: [PATCH 2/4] Fix code review --- ext/openssl/openssl.c | 40 +++++++++---------- ext/openssl/openssl.stub.php | 36 ++++++++--------- ext/openssl/openssl_arginfo.h | 38 +++++++++--------- ext/openssl/tests/bug60632.phpt | 2 +- ext/openssl/tests/bug70438.phpt | 4 +- ext/openssl/tests/openssl_decrypt_error.phpt | 8 ++-- ext/openssl/tests/openssl_encrypt_error.phpt | 4 +- .../tests/openssl_x509_fingerprint_basic.phpt | 2 +- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 8a0f835fd8f45..fe38bb43a14dc 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -865,7 +865,7 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option zend_long cipher_algo = Z_LVAL_P(item); const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo); if (cipher == NULL) { - php_error_docref(NULL, E_WARNING, "Unknown cipher method for private key"); + php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm for private key"); return FAILURE; } else { req->priv_key_encrypt_cipher = cipher; @@ -1182,7 +1182,7 @@ PHP_MINIT_FUNCTION(openssl) REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); #endif - /* signature algorithm constants */ + /* digest algorithm constants */ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); @@ -1563,7 +1563,7 @@ PHP_FUNCTION(openssl_spki_new) mdtype = php_openssl_get_evp_md_from_algo(algo); if (!mdtype) { - php_error_docref(NULL, E_WARNING, "Unknown digest method"); + php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); goto cleanup; } @@ -1589,7 +1589,7 @@ PHP_FUNCTION(openssl_spki_new) if (!NETSCAPE_SPKI_sign(spki, pkey, mdtype)) { php_openssl_store_errors(); - php_error_docref(NULL, E_WARNING, "Unable to sign with specified digest method"); + php_error_docref(NULL, E_WARNING, "Unable to sign with specified digest algorithm"); goto cleanup; } @@ -1845,7 +1845,7 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_b zend_string *ret; if (!(mdtype = EVP_get_digestbyname(method))) { - php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); return NULL; } else if (!X509_digest(peer, mdtype, md, &n)) { php_openssl_store_errors(); @@ -4807,7 +4807,7 @@ PHP_FUNCTION(openssl_pbkdf2) } if (!digest) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); RETURN_FALSE; } @@ -6483,7 +6483,7 @@ PHP_FUNCTION(openssl_sign) mdtype = php_openssl_get_evp_md_from_algo(method_long); } if (!mdtype) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); RETURN_FALSE; } @@ -6540,7 +6540,7 @@ PHP_FUNCTION(openssl_verify) mdtype = php_openssl_get_evp_md_from_algo(method_long); } if (!mdtype) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); RETURN_FALSE; } @@ -6596,13 +6596,13 @@ PHP_FUNCTION(openssl_seal) cipher = EVP_get_cipherbyname(method); if (!cipher) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } iv_len = EVP_CIPHER_iv_length(cipher); if (!iv && iv_len > 0) { - zend_argument_value_error(6, "cannot be null for the chosen cipher method"); + zend_argument_value_error(6, "cannot be null for the chosen cipher algorithm"); RETURN_THROWS(); } @@ -6725,14 +6725,14 @@ PHP_FUNCTION(openssl_open) cipher = EVP_get_cipherbyname(method); if (!cipher) { - php_error_docref(NULL, E_WARNING, "Unknown cipher method"); + php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } cipher_iv_len = EVP_CIPHER_iv_length(cipher); if (cipher_iv_len > 0) { if (!iv) { - zend_argument_value_error(6, "cannot be null for the chosen cipher method"); + zend_argument_value_error(6, "cannot be null for the chosen cipher algorithm"); RETURN_THROWS(); } if ((size_t)cipher_iv_len != iv_len) { @@ -6778,7 +6778,7 @@ static void php_openssl_add_method(const OBJ_NAME *name, void *arg) /* {{{ */ } /* }}} */ -/* {{{ Return array of available digest methods */ +/* {{{ Return array of available digest algorithms */ PHP_FUNCTION(openssl_get_md_methods) { zend_bool aliases = 0; @@ -6793,7 +6793,7 @@ PHP_FUNCTION(openssl_get_md_methods) } /* }}} */ -/* {{{ Return array of available cipher methods */ +/* {{{ Return array of available cipher algorithms */ PHP_FUNCTION(openssl_get_cipher_methods) { zend_bool aliases = 0; @@ -6854,7 +6854,7 @@ PHP_FUNCTION(openssl_digest) } mdtype = EVP_get_digestbyname(method); if (!mdtype) { - php_error_docref(NULL, E_WARNING, "Unknown digest method"); + php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); RETURN_FALSE; } @@ -7008,7 +7008,7 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type, } } else if (!enc && tag && tag_len > 0) { if (!mode->is_aead) { - php_error_docref(NULL, E_WARNING, "The tag cannot be used because the cipher method does not support AEAD"); + php_error_docref(NULL, E_WARNING, "The tag cannot be used because the cipher algorithm does not support AEAD"); } else if (!EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, (unsigned char *) tag)) { php_error_docref(NULL, E_WARNING, "Setting tag for AEAD cipher decryption failed"); return FAILURE; @@ -7020,7 +7020,7 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type, if (key_len > password_len) { if ((OPENSSL_DONT_ZERO_PAD_KEY & options) && !EVP_CIPHER_CTX_set_key_length(cipher_ctx, password_len)) { php_openssl_store_errors(); - php_error_docref(NULL, E_WARNING, "Key length cannot be set for the cipher method"); + php_error_docref(NULL, E_WARNING, "Key length cannot be set for the cipher algorithm"); return FAILURE; } key = emalloc(key_len); @@ -7114,7 +7114,7 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt( cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { - php_error_docref(NULL, E_WARNING, "Unknown cipher method"); + php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); return NULL; } @@ -7230,7 +7230,7 @@ PHP_OPENSSL_API zend_string* php_openssl_decrypt( cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { - php_error_docref(NULL, E_WARNING, "Unknown cipher method"); + php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); return NULL; } @@ -7316,7 +7316,7 @@ PHP_OPENSSL_API zend_long php_openssl_cipher_iv_length(const char *method) cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { - php_error_docref(NULL, E_WARNING, "Unknown cipher method"); + php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); return -1; } diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index b2d595fe656fa..ee36a9152f131 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -14,12 +14,12 @@ final class OpenSSLAsymmetricKey { } -function openssl_x509_export_to_file(OpenSSLCertificate|string $certificate, string $output_filename, bool $no_description = true): bool {} +function openssl_x509_export_to_file(OpenSSLCertificate|string $certificate, string $output_filename, bool $no_text = true): bool {} /** @param string $output */ -function openssl_x509_export(OpenSSLCertificate|string $certificate, &$output, bool $no_description = true): bool {} +function openssl_x509_export(OpenSSLCertificate|string $certificate, &$output, bool $no_text = true): bool {} -function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $hashing_algorithm = "sha1", bool $raw_output = false): string|false {} +function openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $digest_algorithm = "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 {} @@ -29,7 +29,7 @@ function openssl_x509_verify(OpenSSLCertificate|string $certificate, $public_key function openssl_x509_parse(OpenSSLCertificate|string $certificate, bool $short_names = true): array|false {} -function openssl_x509_checkpurpose(OpenSSLCertificate|string $certificate, int $purpose, ?array $certificate_authority_info = [], ?string $untrusted_certificates_file = null): bool|int {} +function openssl_x509_checkpurpose(OpenSSLCertificate|string $certificate, int $purpose, ?array $ca_info = [], ?string $untrusted_certificates_file = null): bool|int {} function openssl_x509_read(OpenSSLCertificate|string $certificate): OpenSSLCertificate|false {} @@ -48,10 +48,10 @@ function openssl_pkcs12_export(OpenSSLCertificate|string $certificate, &$output, /** @param array $certificates */ function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase): bool {} -function openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $request, string $output_filename, bool $no_description = true): bool {} +function openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $request, string $output_filename, bool $no_text = true): bool {} /** @param OpenSSLAsymmetricKey $output */ -function openssl_csr_export(OpenSSLCertificateSigningRequest|string $request, &$output, bool $no_description = true): bool {} +function openssl_csr_export(OpenSSLCertificateSigningRequest|string $request, &$output, bool $no_text = true): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $request, OpenSSLCertificate|string|null $ca_certificate, $private_key, int $days, ?array $options = null, int $serial = 0): OpenSSLCertificate|false {} @@ -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_method = "sha1"): string|false {} +function openssl_pbkdf2(string $passphrase, string $salt, int $key_length, int $iterations, string $digest_algorithm = "sha1"): string|false {} -function openssl_pkcs7_verify(string $filename, int $flags, ?string $output_filename = null, ?array $certificate_authority_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7_filename = null): bool|int {} +function openssl_pkcs7_verify(string $filename, int $flags, ?string $output_filename = null, ?array $ca_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7_filename = null): bool|int {} /** @param OpenSSLCertificate|array|string $certificate */ -function openssl_pkcs7_encrypt(string $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_method = OPENSSL_CIPHER_RC2_40): bool {} +function openssl_pkcs7_encrypt(string $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_algorithm = OPENSSL_CIPHER_RC2_40): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_pkcs7_sign(string $filename, string $output_filename, OpenSSLCertificate|string $certificate, $private_key, ?array $headers, int $flags = PKCS7_DETACHED, ?string $untrusted_certificates_filename = null): bool {} @@ -122,10 +122,10 @@ function openssl_pkcs7_decrypt(string $filename, string $output_filename, $certi /** @param array $certificates */ function openssl_pkcs7_read(string $filename, &$certificates): bool {} -function openssl_cms_verify(string $filename, int $flags = 0, ?string $certificates = null, ?array $certificate_authority_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {} +function openssl_cms_verify(string $filename, int $flags = 0, ?string $certificates = null, ?array $ca_info = null, ?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 $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_method = OPENSSL_CIPHER_RC2_40): bool {} +function openssl_cms_encrypt(string $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_algorithm = OPENSSL_CIPHER_RC2_40): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ function openssl_cms_sign(string $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 $initialization_vector */ -function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_method, &$initialization_vector = null): int|false {} +function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_algorithm, &$initialization_vector = 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_method, ?string $initialization_vector = null): bool {} +function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_algorithm, ?string $initialization_vector = 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_method, bool $raw_output = false): string|false {} +function openssl_digest(string $data, string $digest_algorithm, bool $raw_output = false): string|false {} /** @param string $tag */ -function openssl_encrypt(string $data, string $cipher_method, string $passphrase, int $options = 0, string $initialization_vector = "", &$tag = null, string $additional_authentication_data = "", int $tag_length = 16): string|false {} +function openssl_encrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $initialization_vector = "", &$tag = null, string $additional_authentication_data = "", int $tag_length = 16): string|false {} -function openssl_decrypt(string $data, string $method, string $passphrase, int $options = 0, string $initialization_vector = "", ?string $tag = null, string $additional_authentication_data = ""): string|false {} +function openssl_decrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $initialization_vector = "", ?string $tag = null, string $additional_authentication_data = ""): string|false {} -function openssl_cipher_iv_length(string $cipher_method): int|false {} +function openssl_cipher_iv_length(string $cipher_algorithm): 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_method = OPENSSL_ALGO_MD5): string|false {} +function openssl_spki_new(OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algorithm = OPENSSL_ALGO_MD5): string|false {} function openssl_spki_verify(string $signed_public_key_and_challenge): bool {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 73dcfc45b0be5..84a022109356e 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,21 +1,21 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 15274eead6758c5c7ae2f9ecd4806bd78fa765c9 */ + * Stub hash: 3a2f2302110e99bec8f5d254aa2fc9702d34bcf1 */ 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) ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_text, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_INFO(1, output) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_text, _IS_BOOL, 0, "true") 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, hashing_algorithm, IS_STRING, 0, "\"sha1\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, IS_STRING, 0, "\"sha1\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -37,7 +37,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_checkpurpose, 0, 2, MAY_BE_BOOL|MAY_BE_LONG) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, purpose, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificate_authority_info, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 1, "[]") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_file, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -74,13 +74,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_text, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_INFO(1, output) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_description, _IS_BOOL, 0, "true") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_text, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_sign, 0, 4, OpenSSLCertificate, MAY_BE_FALSE) @@ -155,14 +155,14 @@ 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_method, IS_STRING, 0, "\"sha1\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, 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) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, output_filename, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificate_authority_info, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pk7_filename, IS_STRING, 1, "null") @@ -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_method, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_algorithm, 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) @@ -203,7 +203,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_verify, 0, 1, _IS_BO ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificates, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificate_authority_info, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pk7, IS_STRING, 1, "null") @@ -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_method, IS_LONG, 0, "OPENSSL_CIPHER_RC2_40") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cipher_algorithm, 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) @@ -282,7 +282,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_method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, initialization_vector, "null") ZEND_END_ARG_INFO() @@ -291,7 +291,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_method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algorithm, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, initialization_vector, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -308,13 +308,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_method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, digest_algorithm, 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_method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algorithm, 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, initialization_vector, IS_STRING, 0, "\"\"") @@ -325,7 +325,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, method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algorithm, 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, initialization_vector, IS_STRING, 0, "\"\"") @@ -334,7 +334,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_method, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, cipher_algorithm, 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) @@ -356,7 +356,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_method, IS_LONG, 0, "OPENSSL_ALGO_MD5") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, digest_algorithm, 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) diff --git a/ext/openssl/tests/bug60632.phpt b/ext/openssl/tests/bug60632.phpt index 940106f571ca7..f51189a50ea60 100644 --- a/ext/openssl/tests/bug60632.phpt +++ b/ext/openssl/tests/bug60632.phpt @@ -27,4 +27,4 @@ try { } ?> --EXPECT-- -openssl_seal(): Argument #6 ($initialization_vector) cannot be null for the chosen cipher method +openssl_seal(): Argument #6 ($initialization_vector) cannot be null for the chosen cipher algorithm diff --git a/ext/openssl/tests/bug70438.phpt b/ext/openssl/tests/bug70438.phpt index 23536c4bb09c7..dd74e272be8f6 100644 --- a/ext/openssl/tests/bug70438.phpt +++ b/ext/openssl/tests/bug70438.phpt @@ -26,7 +26,7 @@ openssl_open($sealed, $decrypted, $ekeys[0], $priv_key, $cipher, $iv); echo $decrypted; ?> --EXPECTF-- -openssl_seal(): Argument #6 ($initialization_vector) cannot be null for the chosen cipher method +openssl_seal(): Argument #6 ($initialization_vector) cannot be null for the chosen cipher algorithm -Warning: openssl_seal(): Unknown signature algorithm in %s on line %d +Warning: openssl_seal(): Unknown digest algorithm in %s on line %d openssl_seal() test diff --git a/ext/openssl/tests/openssl_decrypt_error.phpt b/ext/openssl/tests/openssl_decrypt_error.phpt index 33a2ba82e9b18..5f79cd86c2e5d 100644 --- a/ext/openssl/tests/openssl_decrypt_error.phpt +++ b/ext/openssl/tests/openssl_decrypt_error.phpt @@ -29,17 +29,17 @@ string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM=" string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM=" bool(false) -Warning: openssl_decrypt(): Unknown cipher method in %s on line %d +Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d bool(false) bool(false) -Warning: openssl_decrypt(): Unknown cipher method in %s on line %d +Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d bool(false) -Warning: openssl_decrypt(): Unknown cipher method in %s on line %d +Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d bool(false) -Warning: openssl_decrypt(): Unknown cipher method in %s on line %d +Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d bool(false) Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d diff --git a/ext/openssl/tests/openssl_encrypt_error.phpt b/ext/openssl/tests/openssl_encrypt_error.phpt index b8fa8d5ba3b44..0b1bc662f77cc 100644 --- a/ext/openssl/tests/openssl_encrypt_error.phpt +++ b/ext/openssl/tests/openssl_encrypt_error.phpt @@ -22,11 +22,11 @@ var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong)); var_dump(openssl_encrypt($data, $method, $password, OPENSSL_DONT_ZERO_PAD_KEY, $iv)); ?> --EXPECTF-- -Warning: openssl_encrypt(): Unknown cipher method in %s on line %d +Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d bool(false) Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d string(44) "iPR4HulskuaP5Z6me5uImk6BqVyJG73+63tkPauVZYk=" -Warning: openssl_encrypt(): Key length cannot be set for the cipher method in %s on line %d +Warning: openssl_encrypt(): Key length cannot be set for the cipher algorithm in %s on line %d bool(false) diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt index fdf2b7732260e..456049edf9585 100644 --- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt +++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt @@ -40,5 +40,5 @@ Warning: openssl_x509_fingerprint(): X.509 Certificate cannot be retrieved in %s bool(false) ** Testing bad hash method ** -Warning: openssl_x509_fingerprint(): Unknown hashing algorithm in %s on line %d +Warning: openssl_x509_fingerprint(): Unknown digest algorithm in %s on line %d bool(false) From f96620dbd2d120f85a9360d9c68974e45fb9f3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 9 Sep 2020 22:13:41 +0200 Subject: [PATCH 3/4] Minor fixes --- ext/openssl/openssl.c | 2 +- ext/openssl/openssl.stub.php | 18 +++++++++--------- ext/openssl/openssl_arginfo.h | 18 +++++++++--------- .../tests/openssl_csr_export_basic.phpt | 2 +- .../openssl_csr_export_to_file_basic.phpt | 2 +- ext/openssl/tests/openssl_csr_sign_basic.phpt | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index fe38bb43a14dc..f462caf2bd5bb 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -7292,7 +7292,7 @@ PHP_FUNCTION(openssl_decrypt) size_t data_len, method_len, password_len, iv_len = 0, tag_len = 0, aad_len = 0; zend_string *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lss!s", &data, &data_len, &method, &method_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lsss", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len, &tag, &tag_len, &aad, &aad_len) == FAILURE) { RETURN_THROWS(); } diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index ee36a9152f131..19b3ce0c10449 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -48,20 +48,20 @@ function openssl_pkcs12_export(OpenSSLCertificate|string $certificate, &$output, /** @param array $certificates */ function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase): bool {} -function openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $request, string $output_filename, bool $no_text = true): bool {} +function openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $csr, string $output_filename, bool $no_text = true): bool {} /** @param OpenSSLAsymmetricKey $output */ -function openssl_csr_export(OpenSSLCertificateSigningRequest|string $request, &$output, bool $no_text = true): bool {} +function openssl_csr_export(OpenSSLCertificateSigningRequest|string $csr, &$output, bool $no_text = true): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $request, OpenSSLCertificate|string|null $ca_certificate, $private_key, int $days, ?array $options = null, int $serial = 0): OpenSSLCertificate|false {} +function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $csr, OpenSSLCertificate|string|null $ca_certificate, $private_key, int $days, ?array $options = null, int $serial = 0): OpenSSLCertificate|false {} /** @param OpenSSLAsymmetricKey $private_key */ function openssl_csr_new(array $distinguished_names, &$private_key, ?array $options = null, ?array $extra_options = null): OpenSSLCertificateSigningRequest|false {} -function openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $request, bool $short_names = true): array|false {} +function openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): array|false {} -function openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $request, bool $short_names = true): OpenSSLAsymmetricKey|false {} +function openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): OpenSSLAsymmetricKey|false {} function openssl_pkey_new(?array $options = null): OpenSSLAsymmetricKey|false {} @@ -200,7 +200,7 @@ function openssl_digest(string $data, string $digest_algorithm, bool $raw_output /** @param string $tag */ function openssl_encrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $initialization_vector = "", &$tag = null, string $additional_authentication_data = "", int $tag_length = 16): string|false {} -function openssl_decrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $initialization_vector = "", ?string $tag = null, string $additional_authentication_data = ""): string|false {} +function openssl_decrypt(string $data, string $cipher_algorithm, string $passphrase, int $options = 0, string $initialization_vector = "", string $tag = "", string $additional_authentication_data = ""): string|false {} function openssl_cipher_iv_length(string $cipher_algorithm): int|false {} @@ -217,10 +217,10 @@ function openssl_random_pseudo_bytes(int $length, &$strong_result = null): strin function openssl_spki_new(OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algorithm = OPENSSL_ALGO_MD5): string|false {} -function openssl_spki_verify(string $signed_public_key_and_challenge): bool {} +function openssl_spki_verify(string $spki): bool {} -function openssl_spki_export(string $signed_public_key_and_challenge): string|false {} +function openssl_spki_export(string $spki): string|false {} -function openssl_spki_export_challenge(string $signed_public_key_and_challenge): string|false {} +function openssl_spki_export_challenge(string $spki): string|false {} function openssl_get_cert_locations(): array {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 84a022109356e..98d64c1a3dc08 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: 3a2f2302110e99bec8f5d254aa2fc9702d34bcf1 */ + * Stub hash: 1020153737b4c71f5811c0228fbcabb4c236e397 */ 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) @@ -72,19 +72,19 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_read, 0, 3, _IS_B ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export_to_file, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_text, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_INFO(1, output) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, no_text, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_sign, 0, 4, OpenSSLCertificate, MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_OBJ_TYPE_MASK(0, ca_certificate, OpenSSLCertificate, MAY_BE_STRING|MAY_BE_NULL, NULL) ZEND_ARG_INFO(0, private_key) ZEND_ARG_TYPE_INFO(0, days, IS_LONG, 0) @@ -100,12 +100,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_new, 0, 2, OpenS ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_csr_get_subject, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, short_names, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_csr_get_public_key, 0, 1, OpenSSLAsymmetricKey, MAY_BE_FALSE) - ZEND_ARG_OBJ_TYPE_MASK(0, request, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, csr, OpenSSLCertificateSigningRequest, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, short_names, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() @@ -329,7 +329,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_decrypt, 0, 3, MAY_BE_ST 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, initialization_vector, IS_STRING, 0, "\"\"") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tag, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tag, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_authentication_data, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() @@ -360,11 +360,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_spki_new, 0, 2, MAY_BE_S ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_spki_verify, 0, 1, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, signed_public_key_and_challenge, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, spki, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_spki_export, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, signed_public_key_and_challenge, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, spki, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_openssl_spki_export_challenge arginfo_openssl_spki_export diff --git a/ext/openssl/tests/openssl_csr_export_basic.phpt b/ext/openssl/tests/openssl_csr_export_basic.phpt index 032174b58b0fa..5f8c9f2c6d2f3 100644 --- a/ext/openssl/tests/openssl_csr_export_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_basic.phpt @@ -44,5 +44,5 @@ bool(true) Warning: openssl_csr_export(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d bool(false) -openssl_csr_export(): Argument #1 ($request) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given +openssl_csr_export(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given bool(true) diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt index 8d962444155d9..4efa6f35d5d13 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt @@ -77,5 +77,5 @@ JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR Warning: openssl_csr_export_to_file(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d bool(false) -openssl_csr_export_to_file(): Argument #1 ($request) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given +openssl_csr_export_to_file(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given bool(true) diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt index 2045369e39046..7d856b71bf677 100644 --- a/ext/openssl/tests/openssl_csr_sign_basic.phpt +++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt @@ -75,7 +75,7 @@ bool(false) Warning: openssl_csr_sign(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d bool(false) -openssl_csr_sign(): Argument #1 ($request) must be of type OpenSSLCertificateSigningRequest|string, array given +openssl_csr_sign(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string, array given openssl_csr_sign(): Argument #2 ($ca_certificate) must be of type OpenSSLCertificate|string|null, array given Key array must be of the form array(0 => key, 1 => phrase) object(OpenSSLCertificate)#%d (0) { From 125d39d9467738d4794be211faa1d588b5d34b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 12 Sep 2020 21:03:54 +0200 Subject: [PATCH 4/4] Last review fixes --- ext/openssl/openssl.c | 4 ++-- ext/openssl/openssl.stub.php | 14 +++++++------- ext/openssl/openssl_arginfo.h | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index f462caf2bd5bb..2fde70d0940ac 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2313,7 +2313,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) Z_PARAM_LONG(purpose) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY_OR_NULL(zcainfo) + Z_PARAM_ARRAY(zcainfo) Z_PARAM_STRING_OR_NULL(untrusted, untrusted_len) ZEND_PARSE_PARAMETERS_END(); @@ -4849,7 +4849,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) RETVAL_LONG(-1); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl|p!a!p!p!p!", &filename, &filename_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl|p!ap!p!p!", &filename, &filename_len, &flags, &signersfilename, &signersfilename_len, &cainfo, &extracerts, &extracerts_len, &datafilename, &datafilename_len, &p7bfilename, &p7bfilename_len) == FAILURE) { RETURN_THROWS(); diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index 19b3ce0c10449..8454c4fd162ba 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -29,7 +29,7 @@ function openssl_x509_verify(OpenSSLCertificate|string $certificate, $public_key function openssl_x509_parse(OpenSSLCertificate|string $certificate, bool $short_names = true): array|false {} -function openssl_x509_checkpurpose(OpenSSLCertificate|string $certificate, int $purpose, ?array $ca_info = [], ?string $untrusted_certificates_file = null): bool|int {} +function openssl_x509_checkpurpose(OpenSSLCertificate|string $certificate, int $purpose, array $ca_info = [], ?string $untrusted_certificates_file = null): bool|int {} function openssl_x509_read(OpenSSLCertificate|string $certificate): OpenSSLCertificate|false {} @@ -65,14 +65,14 @@ function openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $csr function openssl_pkey_new(?array $options = null): OpenSSLAsymmetricKey|false {} -/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key */ -function openssl_pkey_export_to_file($private_key, string $output_filename, ?string $passphrase = null, ?array $options = null): bool {} +/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key */ +function openssl_pkey_export_to_file($key, string $output_filename, ?string $passphrase = null, ?array $options = null): bool {} /** - * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key + * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key * @param string $output */ -function openssl_pkey_export($private_key, &$output, ?string $passphrase = null, ?array $options = null): bool {} +function openssl_pkey_export($key, &$output, ?string $passphrase = null, ?array $options = null): bool {} /** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */ function openssl_pkey_get_public($public_key): OpenSSLAsymmetricKey|false {} @@ -105,7 +105,7 @@ 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_pkcs7_verify(string $filename, int $flags, ?string $output_filename = null, ?array $ca_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7_filename = null): bool|int {} +function openssl_pkcs7_verify(string $filename, int $flags, ?string $output_filename = null, array $ca_info = [], ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7_filename = null): bool|int {} /** @param OpenSSLCertificate|array|string $certificate */ function openssl_pkcs7_encrypt(string $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_algorithm = OPENSSL_CIPHER_RC2_40): bool {} @@ -122,7 +122,7 @@ function openssl_pkcs7_decrypt(string $filename, string $output_filename, $certi /** @param array $certificates */ function openssl_pkcs7_read(string $filename, &$certificates): bool {} -function openssl_cms_verify(string $filename, int $flags = 0, ?string $certificates = null, ?array $ca_info = null, ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {} +function openssl_cms_verify(string $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 $filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_algorithm = OPENSSL_CIPHER_RC2_40): bool {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 98d64c1a3dc08..91a6ab4277b4f 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: 1020153737b4c71f5811c0228fbcabb4c236e397 */ + * Stub hash: 94b744d0176f126d491a9c385136708da124e332 */ 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) @@ -37,7 +37,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_checkpurpose, 0, 2, MAY_BE_BOOL|MAY_BE_LONG) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, purpose, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 0, "[]") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_file, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -114,14 +114,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_openssl_pkey_new, 0, 0, Open ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_export_to_file, 0, 2, _IS_BOOL, 0) - ZEND_ARG_INFO(0, private_key) + ZEND_ARG_INFO(0, key) ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, passphrase, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_export, 0, 2, _IS_BOOL, 0) - ZEND_ARG_INFO(0, private_key) + ZEND_ARG_INFO(0, key) ZEND_ARG_INFO(1, output) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, passphrase, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") @@ -162,7 +162,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkcs7_verify, 0, 2, MAY_ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, output_filename, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 0, "[]") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pk7_filename, IS_STRING, 1, "null") @@ -203,7 +203,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_verify, 0, 1, _IS_BO ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, certificates, IS_STRING, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ca_info, IS_ARRAY, 0, "[]") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, untrusted_certificates_filename, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pk7, IS_STRING, 1, "null")