OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_mac.h" | 5 #include "net/socket/ssl_client_socket_mac.h" |
6 | 6 |
7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
8 #include <netdb.h> | 8 #include <netdb.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 547 |
548 SSLClientSocketMac::~SSLClientSocketMac() { | 548 SSLClientSocketMac::~SSLClientSocketMac() { |
549 Disconnect(); | 549 Disconnect(); |
550 } | 550 } |
551 | 551 |
552 int SSLClientSocketMac::Connect(const CompletionCallback& callback) { | 552 int SSLClientSocketMac::Connect(const CompletionCallback& callback) { |
553 DCHECK(transport_.get()); | 553 DCHECK(transport_.get()); |
554 DCHECK(next_handshake_state_ == STATE_NONE); | 554 DCHECK(next_handshake_state_ == STATE_NONE); |
555 DCHECK(user_connect_callback_.is_null()); | 555 DCHECK(user_connect_callback_.is_null()); |
556 | 556 |
557 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL); | 557 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT); |
558 | 558 |
559 int rv = InitializeSSLContext(); | 559 int rv = InitializeSSLContext(); |
560 if (rv != OK) { | 560 if (rv != OK) { |
561 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); | 561 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); |
562 return rv; | 562 return rv; |
563 } | 563 } |
564 | 564 |
565 next_handshake_state_ = STATE_HANDSHAKE; | 565 next_handshake_state_ = STATE_HANDSHAKE; |
566 rv = DoHandshakeLoop(OK); | 566 rv = DoHandshakeLoop(OK); |
567 if (rv == ERR_IO_PENDING) { | 567 if (rv == ERR_IO_PENDING) { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 (client_cert_state == kSSLClientCertRejected || | 1135 (client_cert_state == kSSLClientCertRejected || |
1136 net_error == ERR_BAD_SSL_CLIENT_AUTH_CERT)) { | 1136 net_error == ERR_BAD_SSL_CLIENT_AUTH_CERT)) { |
1137 // The server unexpectedly sent a peer certificate error alert when no | 1137 // The server unexpectedly sent a peer certificate error alert when no |
1138 // certificate had been sent. | 1138 // certificate had been sent. |
1139 net_error = ERR_SSL_PROTOCOL_ERROR; | 1139 net_error = ERR_SSL_PROTOCOL_ERROR; |
1140 } | 1140 } |
1141 break; | 1141 break; |
1142 } | 1142 } |
1143 | 1143 |
1144 net_log_.AddEvent(NetLog::TYPE_SSL_HANDSHAKE_ERROR, | 1144 net_log_.AddEvent(NetLog::TYPE_SSL_HANDSHAKE_ERROR, |
1145 new SSLErrorParams(net_error, status)); | 1145 CreateNetLogSSLErrorCallback(net_error, status)); |
1146 return net_error; | 1146 return net_error; |
1147 } | 1147 } |
1148 | 1148 |
1149 int SSLClientSocketMac::DoVerifyCert() { | 1149 int SSLClientSocketMac::DoVerifyCert() { |
1150 next_handshake_state_ = STATE_VERIFY_CERT_COMPLETE; | 1150 next_handshake_state_ = STATE_VERIFY_CERT_COMPLETE; |
1151 | 1151 |
1152 DCHECK(server_cert_); | 1152 DCHECK(server_cert_); |
1153 | 1153 |
1154 VLOG(1) << "DoVerifyCert..."; | 1154 VLOG(1) << "DoVerifyCert..."; |
1155 CertStatus cert_status; | 1155 CertStatus cert_status; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 if (rv < 0 && rv != ERR_IO_PENDING) { | 1440 if (rv < 0 && rv != ERR_IO_PENDING) { |
1441 us->write_io_buf_ = NULL; | 1441 us->write_io_buf_ = NULL; |
1442 return OSStatusFromNetError(rv); | 1442 return OSStatusFromNetError(rv); |
1443 } | 1443 } |
1444 | 1444 |
1445 // always lie to our caller | 1445 // always lie to our caller |
1446 return noErr; | 1446 return noErr; |
1447 } | 1447 } |
1448 | 1448 |
1449 } // namespace net | 1449 } // namespace net |
OLD | NEW |