Commit graph

1866 commits

Author SHA1 Message Date
Jakub Zelenka
3c176d4189
Merge branch 'PHP-8.2' into PHP-8.3 2023-12-21 16:43:16 +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
b3947744c7
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-17 19:43:34 +00: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
ac07b6e7ac
Merge branch 'PHP-8.2' into PHP-8.3 2023-10-22 13:23:10 +01: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
Eno
0dadd6616a
Improve openssl ext to generate EC keys with custom EC parameters
This change extends supported parameter when generating EC keys.

Specifically following parameters are now supported: p, a, b, order,
generator, seed, cofactory, g_x, g_y, x, y and d.

Those parameters can be passed to ec field in openssl_pkey_new options.

It also fixes some issues openssl_pkey_get_details related to SM2
support.

Closes GH-9991
2023-07-06 15:51:50 +01:00
Jakub Zelenka
981f01e131
Merge branch 'PHP-8.2' 2023-06-09 16:50:57 +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
45eae90dab
Merge branch 'PHP-8.2' 2023-06-09 16:39:02 +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
Florian Moser
4d4b9604ca
Fix GH-11054: Reset OpenSSL errors when using a PEM public key
The error happens when the PEM contains a public key, as it will be
first tried to be parsed as a certificate. The parsing as a certificate
fails, which then leads to a corresponding error tracked by PHP with
the next call to php_openssl_store_errors().

This change introduces an error marking to be able to reset the stored
errors to the state before trying the certificate.

Closes GH-11055
2023-05-06 11:56:31 +01:00
Daniel Kesselberg
fa10dfcc81
Add PKCS7_NOOLDMIMETYPE and OPENSSL_CMS_OLDMIMETYPE
PKCS7_NOOLDMIMETYPE to use Content-Type application/pkcs7-mime
OPENSSL_CMS_OLDMIMETYPE to use Content-Type application/x-pkcs7-mime

SMIME_write_PKCS7 and SMIME_write_CMS are using SMIME_write_ASN1_ex.
The Content-Type application/x-pkcs7-mime is generated with the flag SMIME_OLDMIME (0x400).[^1]

SMIME_write_PKCS7 set SMIME_OLDMIME by default.[^2]
SMIME_write_CMS does not.[^3]

I picked OPENSSL_CMS_OLDMIMETYPE over OPENSSL_CMS_NOOLDMIMETYPE because that's what the flag actually does.

[^1]: 9a2f78e14a/crypto/asn1/asn_mime.c (L248-L251)
[^2]: 9a2f78e14a/crypto/pkcs7/pk7_mime.c (L41-L43)
[^3]: 9a2f78e14a/crypto/cms/cms_io.c (L93)

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2023-05-06 11:12:31 +01:00
Javier Eguiluz
732d92c0e5
[skip ci] Fix various typos and grammar issues (#11143) 2023-04-28 11:05:32 +02:00
Jakub Holubansky
5a4083181b ext/openssl: pass ini options to extra processes in tests 2023-04-17 12:25:35 +01:00
Jakub Zelenka
c0b89e064c
Merge branch 'PHP-8.2' 2023-03-30 13:36:14 +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
aef5250eae Merge branch 'PHP-8.2'
* PHP-8.2:
  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:16:23 +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
George Peter Banyard
f13d541ca6
Fix GCC 12 compiler warnings (#10713)
* Fix -Wunused-but-set-variable compiler warning in ext/mysqli

* Fix -Wstrict-prototypes compiler warning in ext/mysqlnd

* Fix -Wstrict-prototypes compiler warning in ext/soap

* Fix -Wunused-but-set-variable compiler warning in ext/exif

However, this code looks really sketchy...

* Fix -Wstrict-prototypes compiler warning in ext/openssl

* Fix -Wstrict-prototypes compiler warning in ext/dba

Add void to our bundled libraries

* Refactor bundled BCMath library

Fix -Wdeprecated-non-prototype compiler warnings
Use bool instead of char/int
Cleanup some useless header includes
2023-02-28 14:21:01 +00:00
Niels Dossche
f0cfebc2b8 Use zend_result where appropriate in ext/openssl
Remove dead code

s is always NULL, so the check is always false.

Closes GH-10704.
2023-02-26 08:28:23 +00:00
David Carlier
c54948378d Merge branch 'PHP-8.2' 2023-02-26 08:19:05 +00: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
21e5dfc8ed
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix duplicated FILE section in test bug80747.phpt
2023-01-23 13:51:26 +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
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01: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
Max Kellermann
308fd311ea ext/{standard,json,random,...}: add missing includes 2023-01-10 14:19:03 +00: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
eb83e0206c
Merge branch 'PHP-8.2' 2022-11-25 14:08:17 +00: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
Jakub Zelenka
d526773d20
Merge branch 'PHP-8.2' 2022-11-25 12:51:23 +00:00
Jakub Zelenka
c022ce92fb
Merge branch 'PHP-8.1' into PHP-8.2 2022-11-25 12:50:38 +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
Jakub Zelenka
ce58ae5e79
Merge branch 'PHP-8.2' 2022-11-24 18:30:57 +00:00
Jakub Zelenka
3d90a24e93
Fix GH-9997: OpenSSL engine clean up segfault 2022-11-24 18:29:44 +00:00
George Peter Banyard
a123ce9dd4
Merge branch 'PHP-8.2'
* PHP-8.2:
  Add missing EXTENSION section to tests
2022-10-27 14:42:40 +01:00
George Peter Banyard
a27ae67c0f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing EXTENSION section to tests
2022-10-27 14:42:17 +01:00