Commit graph

1993 commits

Author SHA1 Message Date
Jakub Zelenka
7a15d2a5c0
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-05 18:05:24 +02:00
Jakub Zelenka
444cc78a3e
Skip OpenSSL proxy test for bug #74796 on Windows 2025-06-05 16:18:06 +02:00
Jakub Zelenka
086a470208
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-05 14:10:57 +02:00
Jakub Zelenka
42f6c15186
Fix bug #74796: Requests through http proxy set peer name
This issue happens because http wrapper sets peer_name but then does not
remove so it stays in the context. The fix removes the peer name from
the context after enabling crypto.

In addition to bug #74796, this also fixes bug #76196.

In addition it should be a final fix for those SOAP bugs:

bug #69783
bug #52913
bug #61463
2025-06-05 14:08:28 +02:00
Niels Dossche
87ff5479fc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
2025-06-03 23:46:21 +02:00
Niels Dossche
08a9579883
Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
Closes GH-18750.
2025-06-03 23:45:51 +02:00
Niels Dossche
1e94f3423b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Split off php_set_sock_blocking() and s.is_blocked to a separate function
  Fix missing checks against php_set_blocking() in xp_ssl.c
2025-05-20 08:08:39 +02:00
Niels Dossche
1863014fbd
Split off php_set_sock_blocking() and s.is_blocked to a separate function
This makes it harder to forget the check and keeps the variable and
function call consistent.

Closes GH-18604.
2025-05-20 08:08:06 +02:00
Niels Dossche
31ebb42268
Fix missing checks against php_set_blocking() in xp_ssl.c 2025-05-20 08:07:34 +02:00
Niels Dossche
8a927c284d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential leaks when writing to BIO fails
2025-04-11 21:02:59 +02:00
Niels Dossche
29f96fb1f1
Fix potential leaks when writing to BIO fails
When the BIO is created but writing fails, these can leak.

Closes GH-18186.
2025-04-11 21:02:37 +02:00
Niels Dossche
a6e76ac010
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix inverted call to php_openssl_store_errors()
  Fix openssl_random_pseudo_bytes() always setting strong_result to true
2025-04-02 20:25:32 +02:00
Niels Dossche
5e68671f88
Fix inverted call to php_openssl_store_errors()
This calls php_openssl_store_errors() in the success path right now,
change it to call php_openssl_store_errors() in the error path.
2025-04-02 20:25:21 +02:00
Niels Dossche
0dc600c69a
Fix openssl_random_pseudo_bytes() always setting strong_result to true
This regressed in 62c7432f, prior to that commit the value was set to
false in case random number generation failed, but now even if an
exception is thrown it is set to true. This likely does not _really_
matter as the user will handle the exception, still the value in
$strong_result is observable.
2025-04-02 20:25:21 +02:00
Niels Dossche
d689ff63e8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in openssl_sign() when passing invalid algorithm
2025-04-02 20:18:57 +02:00
Niels Dossche
74720a22f3
Fix memory leak in openssl_sign() when passing invalid algorithm
Closes GH-18185.
2025-04-02 20:15:53 +02:00
Jakub Zelenka
4936c32772
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-28 14:51:52 +01:00
Jakub Zelenka
6bb56fe0cf
Change openssl_x509_verify test to use cert generator (#17882)
This also prevents verifying cert with SHA1 signature
2025-02-28 14:51:12 +01:00
Jakub Zelenka
d2977b026f
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-31 15:20:06 +01:00
Jakub Zelenka
e0dabe326f
Merge branch 'PHP-8.2' into PHP-8.3 2024-12-31 15:05:18 +01:00
Jakub Zelenka
37504f123d
Port OpenSSL gh10495, gh13860 and gh9310 test to use ephemeral ports 2024-12-31 15:02:08 +01:00
Jakub Zelenka
44a9154e75
Merge branch 'PHP-8.1' into PHP-8.2 2024-12-31 14:39:59 +01:00
Jakub Zelenka
b8731767d8
Fix GH-16955: Use empheral ports for OpenSSL server client tests
And refactor some client server tests.

Closes GH-17180
2024-12-31 14:25:19 +01:00
Niels Dossche
ef1e1868ed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix wrong merge
2024-11-09 11:49:16 +01:00
Niels Dossche
80dd5a0306
Fix wrong merge 2024-11-09 11:49:08 +01:00
Niels Dossche
fd68e9ba2c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in php_openssl_pkey_from_zval()
  Fix various memory leaks related to openssl exports
  Prevent unexpected array entry conversion when reading key
2024-11-09 11:01:29 +01:00
Niels Dossche
591fe92724
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leak in php_openssl_pkey_from_zval()
  Fix various memory leaks related to openssl exports
  Prevent unexpected array entry conversion when reading key
2024-11-09 11:01:21 +01:00
Niels Dossche
994e866cf2
Fix memory leak in php_openssl_pkey_from_zval()
Closes GH-16691.
2024-11-09 10:58:44 +01:00
Niels Dossche
2f4f09f7e6
Fix various memory leaks related to openssl exports
Closes GH-16692.
2024-11-09 10:58:17 +01:00
Niels Dossche
ac8d0e57d9
Prevent unexpected array entry conversion when reading key
When passing an array, the key entry can get converted to a string if it
is an object, but this actually modifies the original array entry.
The test originally outputted:

```
array(2) {
  [0]=>
  string(...) => ...
  [1]=>
  string(0) ""
}
```

This is unexpected. Use zval_try_get_string() to prevent this behaviour.

Closes GH-16693.
2024-11-09 10:57:50 +01:00
Niels Dossche
faef0dfb49
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix various memory leaks on error conditions in openssl_x509_parse()
2024-11-04 20:04:51 +01:00
Niels Dossche
673e8d1011
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix various memory leaks on error conditions in openssl_x509_parse()
2024-11-04 20:04:18 +01:00
Niels Dossche
5ddb75660d
Fix various memory leaks on error conditions in openssl_x509_parse()
Closes GH-16690.
2024-11-04 20:03:53 +01:00
Christoph M. Becker
ef1c3b82ff
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16433: Large values for openssl_csr_sign() $days overflow
2024-10-16 11:10:12 +02:00
Christoph M. Becker
931762c626
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16433: Large values for openssl_csr_sign() $days overflow
2024-10-16 11:09:00 +02:00
Christoph M. Becker
2bdf2f9100
Fix GH-16433: Large values for openssl_csr_sign() $days overflow
The `offset_sec` parameter of `X509_gmtime_adj()` expects a `long`, but
the `$days` parameter of `openssl_csr_sign()` a `zend_long`.  We must
avoid signed integer overflow (UB), but also must not silently truncate.
Thus we check the given `$days` for the permissible range, and bail out
otherwise.

Closes GH-16437.
2024-10-16 11:08:02 +02:00
Christoph M. Becker
33fab73730
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16357: openssl may modify member types of certificate arrays
2024-10-12 16:07:50 +02:00
Christoph M. Becker
76a819e7d1
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16357: openssl may modify member types of certificate arrays
2024-10-12 16:06:44 +02:00
Christoph M. Becker
549bcdb7fb
Fix GH-16357: openssl may modify member types of certificate arrays
We must not use `try_convert_to_string()` on members of unseparated
array arguments; instead of separating, we use `zval_try_get_string()`.

Closes GH-16370.
2024-10-12 16:05:31 +02:00
Jakub Zelenka
53cc92c85c
Fix failing openssl_private_decrypt tests
We backport 11caf094f1af6b47ea2138c5fa907838911ebe01[1] as a step to
get back to a green CI.

[1] <11caf094f1>
2024-10-07 01:06:04 +02:00
Jakub Zelenka
e05121563f
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-28 16:29:18 +01:00
Jakub Zelenka
37a73a83c3
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-28 16:24:01 +01:00
Jakub Zelenka
dce0d97640
Fix stub for openssl_csr_new 2024-09-28 16:22:08 +01:00
Christoph M. Becker
5121acaa66
Support --with-openssl-argon2 on Windows (GH-15713)
We change the error for ZTS builds to a warning, to not break snapshot
builds which automatically will try to enable OpenSSL password hashing.

We also change some messages to better fit building on Windows.

And of course, we cannot easily check whether `OSSL_set_max_threads()`
is actually available; instead we're looking up the function declaration
in its header file.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-09-15 17:06:50 +02:00
DanielEScherzer
db545767e5
Rename ZEND_STR_DEPRECATED to ZEND_STR_DEPRECATED_CAPITALIZED (#15831)
To match other capitalized strings like `ZEND_STR_UNKNOWN_CAPITALIZED` and
`ZEND_STR_ARRAY_CAPITALIZED`. Since this known string was only added in PHP
8.4, no backwards compatibility alias is needed.
2024-09-10 22:45:23 +01:00
Christoph M. Becker
6732b8892d
Support --openssl-legacy-providers on Windows, too (GH-15747)
This is not necessarily useful for Windows (few use custom builds on
that platform), but for feature parity with other platforms it seems
reasonable to support it on Windows.

We make sure, though, that the feature is not enabled for snapshot
builds by adding the option to the build exclusions.
2024-09-05 10:49:16 +02:00
DanielEScherzer
5dd0575698
Generated arginfo header files: combine preprocessor conditional blocks (#15736)
When functions' or class methods' availability is based on some preprocessor
condition, the generated arginfo header files wrap the declarations in the
preprocessor `#if` conditional blocks, one per declaration, even if they are in
the same conditional block based on comments in the stub file. Instead of
having multiple conditional blocks one after the other with the same condition,
combine them into a single conditional block.
2024-09-04 13:04:22 +02:00
DanielEScherzer
53cb89670c
Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Peter Kokot
45ebe47569
Autotools: Sync CS in ext/openssl 2024-09-02 18:39:11 +02:00
Remi Collet
32c5ce3451
Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2 (#13635)
* Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2

* simplify init/shutdown

* use php_base64_encode_ex

* - rename macros - use openssl RAND_bytes - CS

* add --with-openssl-argon2 build option

* check OSSL_KDF_PARAM_ARGON2_LANES instead of OSSL_set_max_threads

* Cleanup and CS

* save/restore old threads config + CS

* remove unneeded check
2024-09-02 13:01:09 +02:00