Commit graph

1794 commits

Author SHA1 Message Date
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
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
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
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
3fc013b2e2
Fix CS and checking for IPv6 SAN verify 2023-06-09 16:49:09 +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
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
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
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
500b28ad04
Fix GH-10000: Test failures when OpenSSL compiled with no-dsa 2022-11-25 14:02:03 +00:00
Jakub Zelenka
ce57221376 Fix GH-9064: PHP fails to build if openssl was built with no-ec 2022-11-25 12:49:12 +00:00
George Peter Banyard
a4acba9e52
Add missing EXTENSION section to tests 2022-10-27 14:39:43 +01:00
Jakub Zelenka
ec844ccc3f
Merge branch 'PHP-8.0' into PHP-8.1 2022-10-22 22:12:05 +01:00
Jakub Zelenka
fa1b6ab5db Fix GH-8430: OpenSSL compiled with old disgests does not build
Specifically no-md2, no-md4 or no-rmd160 were not supported
2022-10-22 22:11:05 +01:00
Jakub Zelenka
93bed982e8
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-17 19:50:16 +01:00
Jakub Zelenka
84dcf578b1
Fix GH-9339: OpenSSL oid_file path check warning contains uninitialized path 2022-08-17 19:49:36 +01:00
Jakub Zelenka
c9fa98a174
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-07 14:21:39 +01:00
Jakub Zelenka
d9ff5e079f
Fix GH-8472: stream_socket_accept result may have incorrect metadata 2022-08-07 14:17:38 +01:00
Jakub Zelenka
56382493eb
Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 23:02:50 +01:00
Jakub Zelenka
2f78c1f9d9 Fix and improve OpenSSL VCWD path checking test for bug #50293 2022-06-09 23:01:52 +01:00
Jakub Zelenka
95f6984216
Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 20:09:57 +01:00
Jakub Zelenka
cb9a48a0c5
Pass signature to openssl_verify in bug81713 test 2022-06-09 20:09:08 +01:00
Jakub Zelenka
976cbba76e Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 19:55:46 +01:00
Jakub Zelenka
b765d4cd41 Fix bug #50293 and #81713: file path checking in OpenSSL functions
It introduces a single function to check file paths passed to OpenSSL
functions. It expands the path, check null bytes and finally does
an open basedir check.
2022-06-09 19:49:59 +01:00
Remi Collet
03a4ccd912
use sha256 in openssl test suite 2022-06-01 11:46:47 +02:00
Jakub Zelenka
74f75db0c3
Fix bug #79589: ssl3_read_n:unexpected eof while reading
The unexpected EOF failure was introduced in OpenSSL 3.0 to prevent
truncation attack. However there are many non complaint servers and
it is causing break for many users including potential majority
of those where the truncation attack is not applicable. For that reason
we try to keep behavior consitent with older OpenSSL versions which is
also the path chosen by some other languages and web servers.

Closes GH-8369
2022-05-15 16:52:12 +01:00
Christoph M. Becker
c821886777
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix openssl_csr_export() stub
2022-04-13 15:23:09 +02:00
Mikko Pesari
16bf8331e0
Fix openssl_csr_export() stub
Closes GH-8362.
2022-04-13 15:20:58 +02:00
Christoph M. Becker
f19250a3a1
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix openssl_x509_checkpurpose_basic.phpt
2021-12-12 14:28:16 +01:00
Christoph M. Becker
2c2b0abd4a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix openssl_x509_checkpurpose_basic.phpt
2021-12-12 14:27:07 +01:00
Christoph M. Becker
98175fc7f1
Fix openssl_x509_checkpurpose_basic.phpt
This test fails because san-cert.pem and san-ca.pem have expired.  We
fix that by using the CertificateGenerator to generate temporary certs
during the test run.  Since san-cert.pem and san-ca.pem have been
identical, we only generate one certificate.

Closes GH-7763.
2021-12-12 14:26:17 +01:00
Christoph M. Becker
b29e85a0da
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #75725: ./configure: detecting RAND_egd
2021-11-22 14:13:52 +01:00
Дилян Палаузов
60fe575ce3
Fix #75725: ./configure: detecting RAND_egd
Closes GH-7668.
2021-11-22 14:11:07 +01:00
Nikita Popov
7f0d3f5413 Fixed bug #81502
Allow $tag to be null. This is the value that openssl_encrypt()
sets it to for non-AEAD ciphers, so we should also accept this
as an input to openssl_decrypt().

Prior to PHP 8.1, null was accepted in weak mode due to the special
treatment of null arguments to internal functions.
2021-10-08 14:07:05 +02:00
Máté Kocsis
d9e5e63032
Add more specific array return type hints for various extensions - part 6 (#7474) 2021-10-07 14:29:29 +02:00
Jakub Zelenka
43f0141d74
Make OpenSSL tests less dependent on system config
It fixes dependencies on system config if running tests with OpenSSL 3.0
2021-09-12 20:30:02 +01:00
Remi Collet
6ee96f095a
fix [-Wmaybe-uninitialized] build warnings 2021-09-10 15:57:56 +02:00
Nikita Popov
7b34db0659 Switch default PKCS7/CMS cipher to AES-128-CBC
Switch default cipher for openssl_pkcs7_encrypt() and
openssl_cms_encrypt() from RC2-40 to AES-128-CBC.

The RC2-40 cipher is considered insecure and is not loaded by
default in OpenSSL 3, which means that these functions will
always fail with default arguments.

As the used algorithm is embedded in the result (which makes this
different from the openssl_encrypt() case) changing the default
algorithm should be safe.

Closes GH-7357.
2021-08-16 12:31:48 +02:00
Remi Collet
c51af22fef
implement openssl_256 and openssl_512 for phar singatures 2021-08-11 14:13:57 +02:00
Nikita Popov
7d2a2c7dc0 Fix openssl memory leaks
Some leaks that snuck in during refactorings.
2021-08-11 10:11:12 +02:00
Nikita Popov
ef787bae24 Switch dh_param handling to EVP_PKEY API 2021-08-10 12:17:17 +02:00
Nikita Popov
e5f53e1ca1 Fork openssl_error_string() test for OpenSSL
The used error code differ signficantly, so use a separate test
file.

openssl_encrypt() no longer throws an error for invalid key length,
which looks like an upstream bug.
2021-08-10 11:50:18 +02:00
Nikita Popov
3724b49aa9 Use param API to create RSA key
Instead of deprecated low-level API.

A caveat here is that when using the high-level API, OpenSSL 3
requires that if the prime factors are set, the CRT parameters
are also set. See https://github.com/openssl/openssl/issues/16271.

As such, add CRT parameters to the manual construction test.

This fixes the last deprecation warnings in openssl.c, but there
are more elsewhere.
2021-08-09 17:02:17 +02:00