Commit graph

1867 commits

Author SHA1 Message Date
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
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
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
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
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
dce0d97640
Fix stub for openssl_csr_new 2024-09-28 16:22:08 +01:00
Arnaud Le Blanc
070779c874
Fix test race condition
Closes GH-14790
2024-07-03 19:17:13 +02:00
Jakub Zelenka
46013f1c55
Skip test for OpenSSL bug #74341 which is not a bug 2024-06-09 12:40:24 +01:00
Ilija Tovilo
fa7933ef17
[skip ci] Fix typo 2024-05-13 13:08:28 +02:00
Ilija Tovilo
91c53e43c4
[skip ci] Adjust port for gh13860.phpt
Port 64325 is already used in ext/standard/tests/streams/gh11418.phpt. The test
randomly times out, and it's unclear whether it might be related to the
conflicting port.
2024-05-13 12:16:57 +02:00
Jakub Zelenka
04b864e566
Fix GH-13806: openssl_x509_parse_basic test fails with OpenSSL 3.2+ (#13961)
Closes GH-13961
2024-04-19 14:09:22 +01:00
Niels Dossche
a86256c950
Improve stability of test gh13860.phpt 2024-04-07 22:49:58 +02:00
Niels Dossche
2aae14c8a9
Fix GH-13860: Incorrect PHP_STREAM_OPTION_CHECK_LIVENESS case in ext/openssl/xp_ssl.c - causing use of dead socket
php_socket_errno() may return a stale value when recv returns a
value >= 0. As such, the liveness check is wrong.
This is the same bug as #70198 (fixed in GH-1456). So we fix it in the
same way.

Closes GH-13895.
2024-04-07 21:35:43 +02:00
Jakub Zelenka
11caf094f1
Fix GH-13620: Failing openssl_private_decrypt tests
Use OPENSSL_PKCS1_OAEP_PADDING padding in tests

Closes GH-13667
2024-03-29 19:33:37 +00:00
Jakub Zelenka
100258ffd6
Fix test for GH-10495: feof on OpenSSL stream hangs 2024-03-29 16:32:23 +00:00
Jakub Zelenka
c1bd9a932a
Fix GH-10495: feof on OpenSSL stream hangs indefinitely
This fixes the issue with unbounded waiting on SSL_peek which can happen
when only part of the record is fetched. It makes socket non blocking so
it is possible to verify if OpenSSL is expecting some more data or if
there is an error.

This also fixes bug #79501

Closes GH-13487
2024-03-29 16:22:22 +00:00
Ilija Tovilo
bc6a1c933f
[skip ci] Mark another openssl test as xfail 2024-03-10 15:15:12 +01:00
Ilija Tovilo
932982f867
[skip ci] Mark problematic openssl tests as xfail for now 2024-03-08 19:09:14 +01:00
Peter Kokot
218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
David Carlier
5e2a586c9a ext/openssl: fix libressl build.
Close GH-12919
2024-01-14 18:23:18 +00:00
Jakub Zelenka
7c4763ab8b
Fix GH-12987: openssl_csr_sign might leak new cert on error
Closes GH-12988
2023-12-21 16:42:09 +00:00
Jakub Zelenka
55e0748487
Fix #50713: openssl_pkcs7_verify() may ignore untrusted CAs
Closes GH-12499
2023-11-22 21:03:55 -06:00
Ben Ramsey
2b4a47ccec
Merge changes to CertificateGenerator.inc from PHP-8.2
This pulls only the changes made to CertificateGenerator.inc in the PHP-8.2
branch from commit 505e8d2a04.

Co-authored-by: Jakub Zelenka <bukka@php.net>
2023-11-22 20:39:30 -06:00
Jakub Zelenka
f90b40416f
Fix #50713: openssl_pkcs7_verify() may ignore untrusted CAs
Closes GH-12499
2023-11-17 19:42:28 +00:00
Jakub Zelenka
b2f6b6ea9c
Merge branch 'PHP-8.1' into PHP-8.2 2023-10-22 13:21:56 +01:00
Jakub Zelenka
83a242ec0c
Fix GH-12489: Missing sigbio creation checking in openssl_cms_verify
Closes GH-12490
2023-10-22 13:20:43 +01:00
Jakub Zelenka
d687a1bf57
Merge branch 'PHP-8.1' into PHP-8.2 2023-06-09 16:50:24 +01:00
Jakub Zelenka
3fc013b2e2
Fix CS and checking for IPv6 SAN verify 2023-06-09 16:49:09 +01:00
Jakub Zelenka
58141f062b
Merge branch 'PHP-8.1' into PHP-8.2 2023-06-09 16:38:14 +01:00
James Lucas
fd09728bb6
Fix bug GH-9356: Incomplete SAN validation of IPv6 address
IPv6 addresses are valid entries in subjectAltNames. Certificate
Authorities may issue certificates including IPv6 addresses except
if they fall within addresses in the RFC 4193 range. Google and
CloudFlare provide IPv6 addresses in their DNS over HTTPS services.

Internal CAs do not have those restrictions and can issue Unique
local addresses in certificates.

Closes GH-11145
2023-06-09 16:33:46 +01:00
Jakub Zelenka
e80073d3d2
Fix GH-10406: feof() behavior change for UNIX based socket resources
This change restores the old behaviour for the server socket streams
that don't support IO. This is now stored in the stream flags so it can
be later used to do some other decisions and possibly introduce some
better error reporting.

Closes GH-10877
2023-03-30 13:31:46 +01:00
Niels Dossche
a13cca8a81 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing error check on PEM_write_bio_PKCS7()
  Add missing error check on PEM_write_bio_CMS()
  Add missing error check on i2d_PKCS12_bio()
  Add missing error checks on EVP_MD_CTX_create() and EVP_VerifyInit()
2023-03-05 22:12:36 +01:00
Niels Dossche
22c9e7e27e Add missing error check on PEM_write_bio_PKCS7()
Closes GH-10752.
2023-03-05 22:07:43 +01:00
nielsdos
51ea4a680d Add missing error check on PEM_write_bio_CMS()
On failure, this function returns 0. 2 other callers of this function
already check the return value, but this one was missed.
2023-03-05 22:06:23 +01:00
nielsdos
d2ef1561fb Add missing error check on i2d_PKCS12_bio()
This function returns 0 on error and 1 on success. The error case was
not checked and the function therefore would've returned true.
The only other caller of i2d_PKCS12_bio() in the file has
a correct error check.

Closes GH-10761.
2023-03-05 22:05:53 +01:00
David Carlier
bf2e778c71 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-26 08:18:09 +00:00
Niels Dossche
b09be29ac1 Fix incorrect error checking in php_openssl_set_server_dh_param()
SSL_CTX_set_tmp_dh() and SSL_CTX_set0_tmp_dh_pkey() return 1 on success
and 0 on error. But only < 0 was checked which means that errors were
never caught.

Closes GH-10705.
2023-02-26 08:17:14 +00:00
George Peter Banyard
81732056fe
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix duplicated FILE section in test bug80747.phpt
2023-01-23 13:51:13 +00:00
Niels Dossche
974dba3b80
Fix duplicated FILE section in test bug80747.phpt
Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-23 13:50:49 +00:00
Dmitry Stogov
0d011e4626 Revert "Merge branch 'PHP-8.0' into PHP-8.1"
This reverts commit 0116864cd3, reversing
changes made to 1f715f5658.
2023-01-16 11:15:30 +03:00
Tim Düsterhus
0116864cd3
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert "Make build work with newer OpenSSL"
  [ci skip] Next release will be 8.0.28
  [ci skip] Prepare for PHP 8.0.27 GA
2023-01-12 21:48:23 +01:00
Gabriel Caruso
255e08ac56
Revert "Make build work with newer OpenSSL"
This reverts commit 5f90134bb6.
2023-01-03 13:00:44 -03:00
Stanislav Malyshev
5f90134bb6 Make build work with newer OpenSSL 2022-12-18 22:52:30 -07:00
Jakub Zelenka
c8d8bf7c59
Merge branch 'PHP-8.1' into PHP-8.2 2022-11-25 14:07:41 +00:00
Jakub Zelenka
500b28ad04
Fix GH-10000: Test failures when OpenSSL compiled with no-dsa 2022-11-25 14:02:03 +00:00