| 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 #include "net/socket/ssl_client_socket_win.h" | 5 #include "net/socket/ssl_client_socket_win.h" |
| 6 | 6 |
| 7 #include <schnlsp.h> | 7 #include <schnlsp.h> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/lock.h" | 11 #include "base/lock.h" |
| 12 #include "base/singleton.h" | 12 #include "base/singleton.h" |
| 13 #include "base/stl_util-inl.h" | 13 #include "base/stl_util-inl.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "net/base/cert_verifier.h" | 16 #include "net/base/cert_verifier.h" |
| 17 #include "net/base/connection_type_histograms.h" | 17 #include "net/base/connection_type_histograms.h" |
| 18 #include "net/base/host_port_pair.h" |
| 18 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
| 19 #include "net/base/net_log.h" | 20 #include "net/base/net_log.h" |
| 20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 21 #include "net/base/ssl_cert_request_info.h" | 22 #include "net/base/ssl_cert_request_info.h" |
| 22 #include "net/base/ssl_connection_status_flags.h" | 23 #include "net/base/ssl_connection_status_flags.h" |
| 23 #include "net/base/ssl_info.h" | 24 #include "net/base/ssl_info.h" |
| 24 #include "net/socket/client_socket_handle.h" | 25 #include "net/socket/client_socket_handle.h" |
| 25 | 26 |
| 26 #pragma comment(lib, "secur32.lib") | 27 #pragma comment(lib, "secur32.lib") |
| 27 | 28 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 const SSLConfig& ssl_config) | 376 const SSLConfig& ssl_config) |
| 376 : ALLOW_THIS_IN_INITIALIZER_LIST( | 377 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 377 handshake_io_callback_(this, | 378 handshake_io_callback_(this, |
| 378 &SSLClientSocketWin::OnHandshakeIOComplete)), | 379 &SSLClientSocketWin::OnHandshakeIOComplete)), |
| 379 ALLOW_THIS_IN_INITIALIZER_LIST( | 380 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 380 read_callback_(this, &SSLClientSocketWin::OnReadComplete)), | 381 read_callback_(this, &SSLClientSocketWin::OnReadComplete)), |
| 381 ALLOW_THIS_IN_INITIALIZER_LIST( | 382 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 382 write_callback_(this, &SSLClientSocketWin::OnWriteComplete)), | 383 write_callback_(this, &SSLClientSocketWin::OnWriteComplete)), |
| 383 transport_(transport_socket), | 384 transport_(transport_socket), |
| 384 hostname_(hostname), | 385 hostname_(hostname), |
| 386 port_(port), |
| 385 ssl_config_(ssl_config), | 387 ssl_config_(ssl_config), |
| 386 user_connect_callback_(NULL), | 388 user_connect_callback_(NULL), |
| 387 user_read_callback_(NULL), | 389 user_read_callback_(NULL), |
| 388 user_read_buf_len_(0), | 390 user_read_buf_len_(0), |
| 389 user_write_callback_(NULL), | 391 user_write_callback_(NULL), |
| 390 user_write_buf_len_(0), | 392 user_write_buf_len_(0), |
| 391 next_state_(STATE_NONE), | 393 next_state_(STATE_NONE), |
| 392 creds_(NULL), | 394 creds_(NULL), |
| 393 isc_status_(SEC_E_OK), | 395 isc_status_(SEC_E_OK), |
| 394 payload_send_buffer_len_(0), | 396 payload_send_buffer_len_(0), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // SChannel doesn't support TLS compression, so cipher_info doesn't have | 448 // SChannel doesn't support TLS compression, so cipher_info doesn't have |
| 447 // any field related to the compression method. | 449 // any field related to the compression method. |
| 448 } | 450 } |
| 449 | 451 |
| 450 if (ssl_config_.ssl3_fallback) | 452 if (ssl_config_.ssl3_fallback) |
| 451 ssl_info->connection_status |= SSL_CONNECTION_SSL3_FALLBACK; | 453 ssl_info->connection_status |= SSL_CONNECTION_SSL3_FALLBACK; |
| 452 } | 454 } |
| 453 | 455 |
| 454 void SSLClientSocketWin::GetSSLCertRequestInfo( | 456 void SSLClientSocketWin::GetSSLCertRequestInfo( |
| 455 SSLCertRequestInfo* cert_request_info) { | 457 SSLCertRequestInfo* cert_request_info) { |
| 456 cert_request_info->host_and_port = hostname_; // TODO(wtc): no port! | 458 cert_request_info->host_and_port = HostPortPair(hostname_, port_).ToString(); |
| 457 cert_request_info->client_certs.clear(); | 459 cert_request_info->client_certs.clear(); |
| 458 | 460 |
| 459 // Get the certificate_authorities field of the CertificateRequest message. | 461 // Get the certificate_authorities field of the CertificateRequest message. |
| 460 // Schannel doesn't return the certificate_types field of the | 462 // Schannel doesn't return the certificate_types field of the |
| 461 // CertificateRequest message to us, so we can't filter the client | 463 // CertificateRequest message to us, so we can't filter the client |
| 462 // certificates properly. :-( | 464 // certificates properly. :-( |
| 463 SecPkgContext_IssuerListInfoEx issuer_list; | 465 SecPkgContext_IssuerListInfoEx issuer_list; |
| 464 SECURITY_STATUS status = QueryContextAttributes( | 466 SECURITY_STATUS status = QueryContextAttributes( |
| 465 &ctxt_, SECPKG_ATTR_ISSUER_LIST_EX, &issuer_list); | 467 &ctxt_, SECPKG_ATTR_ISSUER_LIST_EX, &issuer_list); |
| 466 if (status != SEC_E_OK) { | 468 if (status != SEC_E_OK) { |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); | 1511 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); |
| 1510 } | 1512 } |
| 1511 | 1513 |
| 1512 void SSLClientSocketWin::FreeSendBuffer() { | 1514 void SSLClientSocketWin::FreeSendBuffer() { |
| 1513 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); | 1515 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); |
| 1514 DCHECK(status == SEC_E_OK); | 1516 DCHECK(status == SEC_E_OK); |
| 1515 memset(&send_buffer_, 0, sizeof(send_buffer_)); | 1517 memset(&send_buffer_, 0, sizeof(send_buffer_)); |
| 1516 } | 1518 } |
| 1517 | 1519 |
| 1518 } // namespace net | 1520 } // namespace net |
| OLD | NEW |