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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 } | 708 } |
709 | 709 |
710 bool SSLClientSocketMac::SetReceiveBufferSize(int32 size) { | 710 bool SSLClientSocketMac::SetReceiveBufferSize(int32 size) { |
711 return transport_->socket()->SetReceiveBufferSize(size); | 711 return transport_->socket()->SetReceiveBufferSize(size); |
712 } | 712 } |
713 | 713 |
714 bool SSLClientSocketMac::SetSendBufferSize(int32 size) { | 714 bool SSLClientSocketMac::SetSendBufferSize(int32 size) { |
715 return transport_->socket()->SetSendBufferSize(size); | 715 return transport_->socket()->SetSendBufferSize(size); |
716 } | 716 } |
717 | 717 |
718 void SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) { | 718 bool SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) { |
719 ssl_info->Reset(); | 719 ssl_info->Reset(); |
720 if (!server_cert_) | 720 if (!server_cert_) |
721 return; | 721 return false; |
722 | 722 |
723 ssl_info->cert = server_cert_verify_result_.verified_cert; | 723 ssl_info->cert = server_cert_verify_result_.verified_cert; |
724 ssl_info->cert_status = server_cert_verify_result_.cert_status; | 724 ssl_info->cert_status = server_cert_verify_result_.cert_status; |
725 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; | 725 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; |
726 ssl_info->is_issued_by_known_root = | 726 ssl_info->is_issued_by_known_root = |
727 server_cert_verify_result_.is_issued_by_known_root; | 727 server_cert_verify_result_.is_issued_by_known_root; |
728 ssl_info->client_cert_sent = | 728 ssl_info->client_cert_sent = |
729 ssl_config_.send_client_cert && ssl_config_.client_cert; | 729 ssl_config_.send_client_cert && ssl_config_.client_cert; |
730 ssl_info->channel_id_sent = WasChannelIDSent(); | 730 ssl_info->channel_id_sent = WasChannelIDSent(); |
731 | 731 |
732 // security info | 732 // security info |
733 SSLCipherSuite suite; | 733 SSLCipherSuite suite; |
734 OSStatus status = SSLGetNegotiatedCipher(ssl_context_, &suite); | 734 OSStatus status = SSLGetNegotiatedCipher(ssl_context_, &suite); |
735 if (!status) { | 735 if (!status) { |
736 ssl_info->security_bits = KeySizeOfCipherSuite(suite); | 736 ssl_info->security_bits = KeySizeOfCipherSuite(suite); |
737 ssl_info->connection_status |= | 737 ssl_info->connection_status |= |
738 (suite & SSL_CONNECTION_CIPHERSUITE_MASK) << | 738 (suite & SSL_CONNECTION_CIPHERSUITE_MASK) << |
739 SSL_CONNECTION_CIPHERSUITE_SHIFT; | 739 SSL_CONNECTION_CIPHERSUITE_SHIFT; |
740 } | 740 } |
741 | 741 |
742 if (ssl_config_.version_fallback) | 742 if (ssl_config_.version_fallback) |
743 ssl_info->connection_status |= SSL_CONNECTION_VERSION_FALLBACK; | 743 ssl_info->connection_status |= SSL_CONNECTION_VERSION_FALLBACK; |
| 744 |
| 745 return true; |
744 } | 746 } |
745 | 747 |
746 void SSLClientSocketMac::GetSSLCertRequestInfo( | 748 void SSLClientSocketMac::GetSSLCertRequestInfo( |
747 SSLCertRequestInfo* cert_request_info) { | 749 SSLCertRequestInfo* cert_request_info) { |
748 // I'm being asked for available client certs (identities). | 750 // I'm being asked for available client certs (identities). |
749 // First, get the cert issuer names allowed by the server. | 751 // First, get the cert issuer names allowed by the server. |
750 std::vector<CertPrincipal> valid_issuers; | 752 std::vector<CertPrincipal> valid_issuers; |
751 CFArrayRef valid_issuer_names = NULL; | 753 CFArrayRef valid_issuer_names = NULL; |
752 if (SSLCopyDistinguishedNames(ssl_context_, &valid_issuer_names) == noErr && | 754 if (SSLCopyDistinguishedNames(ssl_context_, &valid_issuer_names) == noErr && |
753 valid_issuer_names != NULL) { | 755 valid_issuer_names != NULL) { |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 if (rv < 0 && rv != ERR_IO_PENDING) { | 1443 if (rv < 0 && rv != ERR_IO_PENDING) { |
1442 us->write_io_buf_ = NULL; | 1444 us->write_io_buf_ = NULL; |
1443 return OSStatusFromNetError(rv); | 1445 return OSStatusFromNetError(rv); |
1444 } | 1446 } |
1445 | 1447 |
1446 // always lie to our caller | 1448 // always lie to our caller |
1447 return noErr; | 1449 return noErr; |
1448 } | 1450 } |
1449 | 1451 |
1450 } // namespace net | 1452 } // namespace net |
OLD | NEW |