Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Issue 280853002: Preserve transport errors for OpenSSL sockets. (Closed)

Created:
6 years, 7 months ago by davidben
Modified:
6 years, 5 months ago
Reviewers:
agl, wtc, Ryan Sleevi
CC:
chromium-reviews, cbentzel+watch_chromium.org
Visibility:
Public.

Description

Preserve transport errors for OpenSSL sockets. This makes the OpenSSL BIO pair behave like nss_memio with respect to errors, eliminating many discrepancies between the two backends in ssl_client_socket_unittest.cc. (While adding one as it exposes a difference in how OpenSSL and NSS behave internally.) This also makes our fallback behavior on TCP reset match; in NSS we take care to only fall back to TLS 1, but our OpenSSL code falls back all the way to SSL3. The new behavior is as follows: - As before, on transport read error, BIO_read will fail after consuming the buffer. The read error is now preserved even when returned synchronously. - On write error, future writes will fail as before. Unlike before, a write error does not prevent further data from the OS to be buffered into the read end of the BIO. Instead, on transport write failure, we continue to read from the transport and fill our read buffer. Whenever the buffer is empty, the write error is surfaced. This is so the consumer is still notified of a write failure on its final Write() call. - When interpreting an OpenSSL error, return the saved transport read or write error when appropriate by determining if the OpenSSL operation failed reading from the BIO (SSL_ERROR_WANT_READ) or writing to it (writing to a closed BIO pair gives BIO_R_RESET_PIPE). - On transport error, always pump the OpenSSL state machine first. This is so that, if OpenSSL provides its own error, that is used instead of the transport error. - Always return the transport error on handshake failure. Move the fallback logic for ERR_CONNECTION_CLOSED and ERR_CONNECTION_RESET out of SSLClientSocketNSS and into HttpNetworkTransaction with the rest of the fallback logic. - If, after there is no more to fallback (either we're at SSLv3 or got an inappropriate_fallback), ERR_CONNECTION_CLOSED or ERR_CONNECTION_RESET is sent, the user will now see an error page for one of those codes rather than ERR_SSL_PROTOCOL_ERROR. Add a test to assert that transport errors are returned out of the handshake and another to assert that TCP reset fallback behaves as expected. BUG=372849, 341178

Patch Set 1 #

Patch Set 2 : Sort out error handling a bit. #

Patch Set 3 : ERR_LIB_USER #

Patch Set 4 : New version of error-handling. #

Patch Set 5 : Rietveld, please behave. #

Patch Set 6 : USE_NSS -> USE_OPENSSL for Windows and Mac #

Total comments: 4

Patch Set 7 : Fix small typo (try jobs on previous patchset) #

Patch Set 8 : ERR_CONNECTION_CLOSED joys. #

Patch Set 9 : Fix clang build. Android failures still expected. #

Patch Set 10 : Disable TCP reset tests on Android. #

Total comments: 1

Patch Set 11 : Don't use a BIO callback. #

Patch Set 12 : Rebase. #

Total comments: 19

Patch Set 13 : Rephrase a lot of comments. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+561 lines, -139 lines) Patch
M net/http/http_network_transaction.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +21 lines, -0 lines 0 comments Download
M net/socket/openssl_ssl_util.cc View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_nss.cc View 1 2 3 4 5 6 7 8 6 chunks +6 lines, -37 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +15 lines, -5 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 16 chunks +81 lines, -48 lines 2 comments Download
M net/socket/ssl_client_socket_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +46 lines, -27 lines 0 comments Download
M net/test/spawned_test_server/base_test_server.h View 1 2 3 4 5 6 7 2 chunks +12 lines, -0 lines 0 comments Download
M net/test/spawned_test_server/base_test_server.cc View 1 2 3 4 5 6 7 4 chunks +20 lines, -0 lines 0 comments Download
M net/tools/testserver/testserver.py View 1 2 3 4 5 6 7 8 9 6 chunks +12 lines, -6 lines 0 comments Download
M net/url_request/url_request_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +109 lines, -0 lines 0 comments Download
M third_party/tlslite/README.chromium View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
A third_party/tlslite/patches/intolerance_options.patch View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +188 lines, -0 lines 0 comments Download
M third_party/tlslite/tlslite/handshakesettings.py View 1 2 3 4 5 6 7 5 chunks +20 lines, -0 lines 0 comments Download
M third_party/tlslite/tlslite/tlsconnection.py View 1 2 3 4 5 6 7 9 chunks +19 lines, -16 lines 0 comments Download
M third_party/tlslite/tlslite/tlsrecordlayer.py View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
davidben
Sending this out so I'm no longer sitting on it. This is kind of a ...
6 years, 6 months ago (2014-06-06 23:31:51 UTC) #1
agl
LGTM https://codereview.chromium.org/280853002/diff/100001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/280853002/diff/100001/net/socket/ssl_client_socket_openssl.cc#newcode1455 net/socket/ssl_client_socket_openssl.cc:1455: // transport error code out of OpenSSL. On ...
6 years, 6 months ago (2014-06-09 17:23:34 UTC) #2
davidben
https://codereview.chromium.org/280853002/diff/100001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/280853002/diff/100001/net/socket/ssl_client_socket_openssl.cc#newcode1455 net/socket/ssl_client_socket_openssl.cc:1455: // transport error code out of OpenSSL. On 2014/06/09 ...
6 years, 6 months ago (2014-06-10 19:16:30 UTC) #3
Ryan Sleevi
Comments on CL description: - On write error, future writes will fail as before. Unlike ...
6 years, 6 months ago (2014-06-18 01:13:18 UTC) #4
Ryan Sleevi
Lots of splitting of mega patches will help. In this case, splitting off the TestServer ...
6 years, 6 months ago (2014-06-18 01:39:53 UTC) #5
davidben
On 2014/06/18 01:39:53, Ryan Sleevi wrote: > Lots of splitting of mega patches will help. ...
6 years, 6 months ago (2014-06-18 17:25:05 UTC) #6
davidben
On 2014/06/18 01:13:18, Ryan Sleevi wrote: > Comments on CL description: > > - On ...
6 years, 6 months ago (2014-06-18 18:09:42 UTC) #7
davidben
(Oops, forgot to hit publish.) https://codereview.chromium.org/280853002/diff/220001/net/http/http_network_transaction.cc File net/http/http_network_transaction.cc (right): https://codereview.chromium.org/280853002/diff/220001/net/http/http_network_transaction.cc#newcode1352 net/http/http_network_transaction.cc:1352: should_fallback = true; On ...
6 years, 6 months ago (2014-06-18 22:27:23 UTC) #8
Ryan Sleevi
https://codereview.chromium.org/280853002/diff/220001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/280853002/diff/220001/net/socket/ssl_client_socket_openssl.cc#newcode1258 net/socket/ssl_client_socket_openssl.cc:1258: // never do. This matches the fix for https://crbug.com/249848 ...
6 years, 6 months ago (2014-06-19 00:27:06 UTC) #9
davidben
6 years, 5 months ago (2014-07-02 21:06:46 UTC) #10
This CL has gotten split up into several and the error handling made saner in
https://codereview.chromium.org/367963007/. Closing this instance.

Powered by Google App Engine
This is Rietveld 408576698