Commit Graph

381 Commits

Author SHA1 Message Date
Kamil Tekiela
cd0cd3d31e
Fix typos (#7327) 2021-08-01 18:03:30 +01:00
Christoph M. Becker
509d34955c
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #76694: native Windows cert verification uses CN as sever name
2021-05-31 14:37:55 +02:00
Christoph M. Becker
108105b2c6
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76694: native Windows cert verification uses CN as sever name
2021-05-31 14:36:57 +02:00
Christoph M. Becker
7fd48264de
Fix #76694: native Windows cert verification uses CN as sever name
This is not guaranteed to work, since the actual server name may only
be given as SAN.  Since we're doing the peer verification later anyway
(using the respective context options as appropriate), there is no need
to even supply a server name when verifying against the Windows cert
store.

Closes GH-7060.
2021-05-31 14:35:17 +02:00
George Peter Banyard
c40231afbf
Mark various functions with void arguments.
This fixes a bunch of [-Wstrict-prototypes] warning,
because in C func() and func(void) have different semantics.
2021-05-12 14:55:53 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
09efad615b
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
twosee
db33af7104 Remove duplicated SSL_CTX_set_verify()
Duplicated with line 920.
Our minimal OpenSSL version is v1.0.1 (See https://github.com/openssl/openssl/blob/OpenSSL_1_0_1-stable/ssl/ssl_lib.c#L2039).
Removing it does not affect program behavior.
Closes GH-6751.
2021-03-04 17:51:29 +08:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Jakub Zelenka
c3a6debc08 Bump minimal OpenSSL version to 1.0.2 2020-11-01 20:10:37 +00:00
Máté Kocsis
9f44eca6b6
Convert resources to objects in ext/openssl
Closes GH-5860

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-08-01 22:47:20 +02:00
Nikita Popov
0280b83e11 Avoid some unnecessary uses of no_separation=0
For the rare cases where references are part of the API,
construct them explicitly. Otherwise do not allow separation.
2020-07-06 19:05:57 +02:00
Nikita Popov
4f0ae4ad6e Merge branch 'PHP-7.4' 2020-06-18 14:22:29 +02:00
Nikita Popov
51e3cb3916 Don't generate spurious warning is security_level not supported
People should not have to worry about the used openssl version
when downgrading security_level.
2020-06-18 14:21:53 +02:00
Christoph M. Becker
4b76a2ddb3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout
2020-06-09 16:48:41 +02:00
Christoph M. Becker
85657b486f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout
2020-06-09 16:47:00 +02:00
Christoph M. Becker
eadd980706 Fix #62890: default_socket_timeout=-1 causes connection to timeout
While unencrypted connections ignore negative timeouts, SSL/TLS
connections did not special case that, and so always failed due to
timeout.
2020-06-09 16:45:34 +02:00
Nikita Popov
8e9bc90004 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79497: Fix php_openssl_subtract_timeval()
2020-04-20 10:26:45 +02:00
Nikita Popov
a230b5a6c9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79497: Fix php_openssl_subtract_timeval()
2020-04-20 10:26:22 +02:00
Joe Cai
94e09bfe55 Fix #79497: Fix php_openssl_subtract_timeval()
I stumbled upon this while debugging a strange issue with
stream_socket_client() where it randomly throws out errors when
the connection timeout is set to below 1s. The logic to calculate
time difference in php_openssl_subtract_timeval() is wrong when
a.tv_usec < b.tv_usec, causing connection errors before the timeout
is reached.
2020-04-20 10:25:54 +02:00
George Peter Banyard
1fdc53bc96 Remove deprecated capture_session_meta OpenSSL stream context
Closes GH-5200
2020-02-26 03:09:13 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Nikita Popov
c849438bd0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78775
2019-11-05 12:16:17 +01:00
Nikita Popov
3e41ade638 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78775
2019-11-05 12:16:09 +01:00
Nikita Popov
747cb46244 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78775
2019-11-05 12:15:44 +01:00
Nikita Popov
4f984a2fdb Fixed bug #78775
Clear the OpenSSL error queue before performing SSL stream operations.
As we don't control all code that could possibly be using OpenSSL,
we can't rely on the error queue being empty.
2019-11-05 12:13:46 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
626bc0e7cc Remove php_openssl_cipher_get_version()
This was added in 7.1 when add_assoc_string mistakenly accepted
a char* rather than const char* parameter and is no longer needed.
We can use SSL_CIPHER_get_version() directly.
2019-07-24 16:41:20 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Nikita Popov
a023eb3967 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-03 12:37:12 +02:00
Nikita Popov
af3c854074 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-03 12:36:50 +02:00
Nikita Popov
0e48e35e04 Fixed bug #78231 2019-07-03 12:36:06 +02:00
Nikita Popov
021bb35aec Merge branch 'PHP-7.3' into PHP-7.4 2019-06-21 15:08:12 +02:00
Nikita Popov
66e4b78519 Merge branch 'PHP-7.2' into PHP-7.3 2019-06-21 15:07:59 +02:00
Nikita Popov
90cb3743be Free cert in php_openssl_load_stream_cafile()
X509_STORE_add_cert() increments the refcount of the cert, so we
should free it here.
2019-06-21 15:07:00 +02:00
Nikita Popov
e7ef2b52db Merge branch 'PHP-7.3' into PHP-7.4 2019-06-21 12:56:12 +02:00
Nikita Popov
414db07bdb Merge branch 'PHP-7.2' into PHP-7.3 2019-06-21 12:55:12 +02:00
Niklas Keller
fea9f93166 Fix memory leak in TLS matches_san_list 2019-06-21 12:54:30 +02:00
Rosen Penev
32e6d08dcd Fix compilation without deprecated OpenSSL 1.1 APIs 2019-06-14 15:38:12 +02:00
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov
829f18b48d Merge branch 'PHP-7.3' into PHP-7.4 2019-06-03 15:15:22 +02:00
Nikita Popov
37bba7a678 Merge branch 'PHP-7.2' into PHP-7.3 2019-06-03 15:15:07 +02:00
Nikita Popov
ac60007bec Clear errors after SSL_CTX_load_verify_locations()
We report our own errors here. Make sure these don't clog up the
error queue.
2019-06-03 15:14:01 +02:00
Jakub Zelenka
c2e9c71e36 Fix tests and logic for TLS 1.3 2019-04-28 17:37:43 +01:00
codarrenvelvindron
5c05f5e6d3 Added tls 1.3 support for PHP 2019-04-28 17:37:43 +01:00
Nikita Popov
c9ff095758 Merge branch 'PHP-7.3' into PHP-7.4 2019-04-15 10:54:39 +02:00
Nikita Popov
5611058766 Merge branch 'PHP-7.2' into PHP-7.3 2019-04-15 10:54:31 +02:00
Nikita Popov
917952453c Fix uninitialized cert_captured
This is a legimitimate bug and also shows up under valgrind.
2019-04-15 10:53:33 +02:00