| 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.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "crypto/ec_private_key.h" | 10 #include "crypto/ec_private_key.h" |
| 11 #include "net/base/connection_type_histograms.h" | 11 #include "net/base/connection_type_histograms.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/ssl/channel_id_service.h" | 13 #include "net/ssl/channel_id_service.h" |
| 14 #include "net/ssl/ssl_cipher_suite_names.h" | 14 #include "net/ssl/ssl_cipher_suite_names.h" |
| 15 #include "net/ssl/ssl_config_service.h" | 15 #include "net/ssl/ssl_config_service.h" |
| 16 #include "net/ssl/ssl_connection_status_flags.h" | 16 #include "net/ssl/ssl_connection_status_flags.h" |
| 17 | 17 |
| 18 #if defined(USE_OPENSSL) |
| 19 #include "net/socket/ssl_client_socket_openssl.h" |
| 20 #endif |
| 21 |
| 18 namespace net { | 22 namespace net { |
| 19 | 23 |
| 20 SSLClientSocket::SSLClientSocket() | 24 SSLClientSocket::SSLClientSocket() |
| 21 : signed_cert_timestamps_received_(false), | 25 : signed_cert_timestamps_received_(false), |
| 22 stapled_ocsp_response_received_(false), | 26 stapled_ocsp_response_received_(false), |
| 23 negotiation_extension_(kExtensionUnknown) { | 27 negotiation_extension_(kExtensionUnknown) { |
| 24 } | 28 } |
| 25 | 29 |
| 26 // static | 30 // static |
| 27 NextProto SSLClientSocket::NextProtoFromString( | 31 NextProto SSLClientSocket::NextProtoFromString( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 case kNextProtoUnsupported: | 75 case kNextProtoUnsupported: |
| 72 return "unsupported"; | 76 return "unsupported"; |
| 73 case kNextProtoNegotiated: | 77 case kNextProtoNegotiated: |
| 74 return "negotiated"; | 78 return "negotiated"; |
| 75 case kNextProtoNoOverlap: | 79 case kNextProtoNoOverlap: |
| 76 return "no-overlap"; | 80 return "no-overlap"; |
| 77 } | 81 } |
| 78 return NULL; | 82 return NULL; |
| 79 } | 83 } |
| 80 | 84 |
| 85 // static |
| 86 void SSLClientSocket::SetSSLKeyLogFile(std::string ssl_keylog_file) { |
| 87 #if defined(USE_OPENSSL) |
| 88 SSLClientSocketOpenSSL::SetSSLKeyLogFile(ssl_keylog_file); |
| 89 #else |
| 90 LOG(WARNING) << "No openSSL support"; |
| 91 #endif |
| 92 } |
| 93 |
| 81 bool SSLClientSocket::WasNpnNegotiated() const { | 94 bool SSLClientSocket::WasNpnNegotiated() const { |
| 82 std::string unused_proto; | 95 std::string unused_proto; |
| 83 return GetNextProto(&unused_proto) == kNextProtoNegotiated; | 96 return GetNextProto(&unused_proto) == kNextProtoNegotiated; |
| 84 } | 97 } |
| 85 | 98 |
| 86 NextProto SSLClientSocket::GetNegotiatedProtocol() const { | 99 NextProto SSLClientSocket::GetNegotiatedProtocol() const { |
| 87 std::string proto; | 100 std::string proto; |
| 88 if (GetNextProto(&proto) != kNextProtoNegotiated) | 101 if (GetNextProto(&proto) != kNextProtoNegotiated) |
| 89 return kProtoUnknown; | 102 return kProtoUnknown; |
| 90 return NextProtoFromString(proto); | 103 return NextProtoFromString(proto); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 wire_protos.push_back(proto.size()); | 217 wire_protos.push_back(proto.size()); |
| 205 for (const char ch : proto) { | 218 for (const char ch : proto) { |
| 206 wire_protos.push_back(static_cast<uint8_t>(ch)); | 219 wire_protos.push_back(static_cast<uint8_t>(ch)); |
| 207 } | 220 } |
| 208 } | 221 } |
| 209 | 222 |
| 210 return wire_protos; | 223 return wire_protos; |
| 211 } | 224 } |
| 212 | 225 |
| 213 } // namespace net | 226 } // namespace net |
| OLD | NEW |