OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
8 | 8 |
9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
(...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2258 } | 2258 } |
2259 | 2259 |
2260 if (result == OK) | 2260 if (result == OK) |
2261 LogConnectionTypeMetrics(); | 2261 LogConnectionTypeMetrics(); |
2262 | 2262 |
2263 completed_handshake_ = true; | 2263 completed_handshake_ = true; |
2264 // TODO(ukai): we may not need this call because it is now harmless to have a | 2264 // TODO(ukai): we may not need this call because it is now harmless to have a |
2265 // session with a bad cert. | 2265 // session with a bad cert. |
2266 InvalidateSessionIfBadCertificate(); | 2266 InvalidateSessionIfBadCertificate(); |
2267 | 2267 |
2268 // Likewise, if we merged a Write call into the handshake we need to make the | 2268 // If we merged a Write call into the handshake we need to make the |
2269 // callback now. | 2269 // callback now. |
2270 if (user_write_callback_) { | 2270 if (user_write_callback_) { |
2271 corked_ = false; | 2271 corked_ = false; |
2272 DoWriteCallback(user_write_buf_len_); | 2272 if (result != OK) { |
2273 DoWriteCallback(result); | |
2274 } else { | |
2275 SSLSnapStartResult snap_start_type; | |
2276 SECStatus rv = SSL_GetSnapStartResult(nss_fd_, &snap_start_type); | |
2277 DCHECK_EQ(rv, SECSuccess); | |
2278 DCHECK_NE(snap_start_type, SSL_SNAP_START_NONE); | |
2279 if (snap_start_type == SSL_SNAP_START_RECOVERY || | |
2280 snap_start_type == SSL_SNAP_START_RESUME_RECOVERY) { | |
2281 // If we mispredicted the server's handshake then Snap Start will have | |
2282 // triggered a recovery mode. The misprediction could have been caused | |
2283 // by the server having a different certificate so the application data | |
2284 // wasn't resent. Now that we have verified the certificate, we need to | |
2285 // resend the application data. | |
2286 int bytes_written = DoPayloadWrite(); | |
2287 if (bytes_written != ERR_IO_PENDING) | |
2288 DoWriteCallback(bytes_written); | |
2289 } | |
wtc
2010/11/02 22:29:17
IMPORTANT: I believe we need to add 'else' here, a
| |
2290 } | |
2273 } | 2291 } |
2274 | 2292 |
2275 // Exit DoHandshakeLoop and return the result to the caller to Connect. | 2293 // Exit DoHandshakeLoop and return the result to the caller to Connect. |
2276 DCHECK(next_handshake_state_ == STATE_NONE); | 2294 DCHECK(next_handshake_state_ == STATE_NONE); |
2277 return result; | 2295 return result; |
2278 } | 2296 } |
2279 | 2297 |
2280 int SSLClientSocketNSS::DoPayloadRead() { | 2298 int SSLClientSocketNSS::DoPayloadRead() { |
2281 EnterFunction(user_read_buf_len_); | 2299 EnterFunction(user_read_buf_len_); |
2282 DCHECK(user_read_buf_); | 2300 DCHECK(user_read_buf_); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2354 case SSL_CONNECTION_VERSION_TLS1_1: | 2372 case SSL_CONNECTION_VERSION_TLS1_1: |
2355 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_1); | 2373 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_1); |
2356 break; | 2374 break; |
2357 case SSL_CONNECTION_VERSION_TLS1_2: | 2375 case SSL_CONNECTION_VERSION_TLS1_2: |
2358 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_2); | 2376 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_2); |
2359 break; | 2377 break; |
2360 }; | 2378 }; |
2361 } | 2379 } |
2362 | 2380 |
2363 } // namespace net | 2381 } // namespace net |
OLD | NEW |