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
George Peter Banyard
a4acba9e52
Add missing EXTENSION section to tests
2022-10-27 14:39:43 +01:00
Jakub Zelenka
59f8f2df9c
Merge branch 'PHP-8.2'
2022-10-23 00:40:19 +01:00
Jakub Zelenka
3e2184f795
Fix OpenSSL conflicting merge for compilation issue with old digests
2022-10-23 00:39:42 +01:00
Jakub Zelenka
14c2480396
Merge branch 'PHP-8.2'
2022-10-22 22:15:12 +01:00
Jakub Zelenka
cb3d5a772d
Merge branch 'PHP-8.1' into PHP-8.2
2022-10-22 22:14:27 +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
6da528cf8a
Merge branch 'PHP-8.2'
2022-10-22 11:21:39 +01:00
Jakub Zelenka
1ef65c1cf0
Clean up OpenSSL engine list when OpenSSL 1.0.2 used
...
Attempt to fix GH-8620.
2022-10-22 11:20:00 +01:00
Bob Weinand
a01dd9feda
Revert "Port all internally used classes to use default_object_handlers"
...
This reverts commit 94ee4f9834 .
The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Jakub Zelenka
f126769a29
Fix bug GH-9517: Compilation error in openssl extension
2022-09-11 15:40:57 +01:00
Bob Weinand
94ee4f9834
Port all internally used classes to use default_object_handlers
...
Signed-off-by: Bob Weinand <bobwei9@hotmail.com >
2022-08-31 16:45:27 +02:00
Jakub Zelenka
35e2a25d83
Add openssl_cipher_key_length function
...
This function works in exactly the same way as openssl_cipher_iv_length
but for a key length. This is especially useful to make sure that the
right key length is provided to openssl_encrypt and openssl_decrypt.
In addtion the change also updates implementation of
openssl_cipher_iv_length and adds a test for it.
2022-08-28 12:27:16 +01:00
Jakub Zelenka
1407968891
Implement FR #76935 : OpenSSL chacha20-poly1305 AEAD support
...
This adds support for ChaCha20-Poly1305 AEAD algorithm so it is possible
to use it in the same way as AES GCM and other AEAD algorithms. This is
available in OpenSSL 1.1.0+.
2022-08-28 12:15:58 +01:00