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 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/lock.h" | 10 #include "base/lock.h" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 SSLClientSocketWin::GetNextProto(std::string* proto) { | 429 SSLClientSocketWin::GetNextProto(std::string* proto) { |
430 proto->clear(); | 430 proto->clear(); |
431 return kNextProtoUnsupported; | 431 return kNextProtoUnsupported; |
432 } | 432 } |
433 | 433 |
434 int SSLClientSocketWin::Connect(CompletionCallback* callback) { | 434 int SSLClientSocketWin::Connect(CompletionCallback* callback) { |
435 DCHECK(transport_.get()); | 435 DCHECK(transport_.get()); |
436 DCHECK(next_state_ == STATE_NONE); | 436 DCHECK(next_state_ == STATE_NONE); |
437 DCHECK(!user_connect_callback_); | 437 DCHECK(!user_connect_callback_); |
438 | 438 |
439 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT); | 439 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL); |
440 | 440 |
441 int rv = InitializeSSLContext(); | 441 int rv = InitializeSSLContext(); |
442 if (rv != OK) { | 442 if (rv != OK) { |
443 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); | 443 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); |
444 return rv; | 444 return rv; |
445 } | 445 } |
446 | 446 |
447 writing_first_token_ = true; | 447 writing_first_token_ = true; |
448 next_state_ = STATE_HANDSHAKE_WRITE; | 448 next_state_ = STATE_HANDSHAKE_WRITE; |
449 rv = DoLoop(OK); | 449 rv = DoLoop(OK); |
450 if (rv == ERR_IO_PENDING) { | 450 if (rv == ERR_IO_PENDING) { |
451 user_connect_callback_ = callback; | 451 user_connect_callback_ = callback; |
452 } else { | 452 } else { |
453 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); | 453 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); |
454 } | 454 } |
455 return rv; | 455 return rv; |
456 } | 456 } |
457 | 457 |
458 int SSLClientSocketWin::InitializeSSLContext() { | 458 int SSLClientSocketWin::InitializeSSLContext() { |
459 int ssl_version_mask = 0; | 459 int ssl_version_mask = 0; |
460 if (ssl_config_.ssl2_enabled) | 460 if (ssl_config_.ssl2_enabled) |
461 ssl_version_mask |= SSL2; | 461 ssl_version_mask |= SSL2; |
462 if (ssl_config_.ssl3_enabled) | 462 if (ssl_config_.ssl3_enabled) |
463 ssl_version_mask |= SSL3; | 463 ssl_version_mask |= SSL3; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 // (which occurs because we are in the middle of a Read when the | 647 // (which occurs because we are in the middle of a Read when the |
648 // renegotiation process starts). So we complete the Read here. | 648 // renegotiation process starts). So we complete the Read here. |
649 if (!user_connect_callback_) { | 649 if (!user_connect_callback_) { |
650 CompletionCallback* c = user_read_callback_; | 650 CompletionCallback* c = user_read_callback_; |
651 user_read_callback_ = NULL; | 651 user_read_callback_ = NULL; |
652 user_read_buf_ = NULL; | 652 user_read_buf_ = NULL; |
653 user_read_buf_len_ = 0; | 653 user_read_buf_len_ = 0; |
654 c->Run(rv); | 654 c->Run(rv); |
655 return; | 655 return; |
656 } | 656 } |
657 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); | 657 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); |
658 CompletionCallback* c = user_connect_callback_; | 658 CompletionCallback* c = user_connect_callback_; |
659 user_connect_callback_ = NULL; | 659 user_connect_callback_ = NULL; |
660 c->Run(rv); | 660 c->Run(rv); |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 void SSLClientSocketWin::OnReadComplete(int result) { | 664 void SSLClientSocketWin::OnReadComplete(int result) { |
665 DCHECK(completed_handshake()); | 665 DCHECK(completed_handshake()); |
666 | 666 |
667 result = DoPayloadReadComplete(result); | 667 result = DoPayloadReadComplete(result); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); | 1336 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); |
1337 } | 1337 } |
1338 | 1338 |
1339 void SSLClientSocketWin::FreeSendBuffer() { | 1339 void SSLClientSocketWin::FreeSendBuffer() { |
1340 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); | 1340 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); |
1341 DCHECK(status == SEC_E_OK); | 1341 DCHECK(status == SEC_E_OK); |
1342 memset(&send_buffer_, 0, sizeof(send_buffer_)); | 1342 memset(&send_buffer_, 0, sizeof(send_buffer_)); |
1343 } | 1343 } |
1344 | 1344 |
1345 } // namespace net | 1345 } // namespace net |
OLD | NEW |