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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 virtual void GetSSLCertRequestInfo( | 98 virtual void GetSSLCertRequestInfo( |
99 SSLCertRequestInfo* cert_request_info) = 0; | 99 SSLCertRequestInfo* cert_request_info) = 0; |
100 | 100 |
101 // Get the application level protocol that we negotiated with the server. | 101 // Get the application level protocol that we negotiated with the server. |
102 // *proto is set to the resulting protocol (n.b. that the string may have | 102 // *proto is set to the resulting protocol (n.b. that the string may have |
103 // embedded NULs). | 103 // embedded NULs). |
104 // kNextProtoUnsupported: *proto is cleared. | 104 // kNextProtoUnsupported: *proto is cleared. |
105 // kNextProtoNegotiated: *proto is set to the negotiated protocol. | 105 // kNextProtoNegotiated: *proto is set to the negotiated protocol. |
106 // kNextProtoNoOverlap: *proto is set to the first protocol in the | 106 // kNextProtoNoOverlap: *proto is set to the first protocol in the |
107 // supported list. | 107 // supported list. |
108 virtual NextProtoStatus GetNextProto(std::string* proto) = 0; | 108 virtual NextProtoStatus GetNextProto(std::string* proto) const = 0; |
109 | 109 |
110 static NextProto NextProtoFromString(const std::string& proto_string); | 110 static NextProto NextProtoFromString(const std::string& proto_string); |
111 | 111 |
112 static const char* NextProtoToString(NextProto next_proto); | 112 static const char* NextProtoToString(NextProto next_proto); |
113 | 113 |
114 static const char* NextProtoStatusToString(const NextProtoStatus status); | 114 static const char* NextProtoStatusToString(const NextProtoStatus status); |
115 | 115 |
116 // Returns true if |error| is OK or |load_flags| ignores certificate errors | 116 // Returns true if |error| is OK or |load_flags| ignores certificate errors |
117 // and |error| is a certificate error. | 117 // and |error| is a certificate error. |
118 static bool IgnoreCertError(int error, int load_flags); | 118 static bool IgnoreCertError(int error, int load_flags); |
119 | 119 |
120 // ClearSessionCache clears the SSL session cache, used to resume SSL | 120 // ClearSessionCache clears the SSL session cache, used to resume SSL |
121 // sessions. | 121 // sessions. |
122 static void ClearSessionCache(); | 122 static void ClearSessionCache(); |
123 | 123 |
124 // Get the maximum SSL version supported by the underlying library and | 124 // Get the maximum SSL version supported by the underlying library and |
125 // cryptographic implementation. | 125 // cryptographic implementation. |
126 static uint16 GetMaxSupportedSSLVersion(); | 126 static uint16 GetMaxSupportedSSLVersion(); |
127 | 127 |
128 virtual bool set_was_npn_negotiated(bool negotiated); | |
129 | |
130 virtual bool was_spdy_negotiated() const; | |
131 | |
132 virtual bool set_was_spdy_negotiated(bool negotiated); | |
133 | |
134 virtual void set_protocol_negotiated(NextProto protocol_negotiated); | |
135 | |
136 void set_negotiation_extension(SSLNegotiationExtension negotiation_extension); | 128 void set_negotiation_extension(SSLNegotiationExtension negotiation_extension); |
137 | 129 |
138 // Returns the ChannelIDService used by this socket, or NULL if | 130 // Returns the ChannelIDService used by this socket, or NULL if |
139 // channel ids are not supported. | 131 // channel ids are not supported. |
140 virtual ChannelIDService* GetChannelIDService() const = 0; | 132 virtual ChannelIDService* GetChannelIDService() const = 0; |
141 | 133 |
142 // Returns true if a channel ID was sent on this connection. | 134 // Returns true if a channel ID was sent on this connection. |
143 // This may be useful for protocols, like SPDY, which allow the same | 135 // This may be useful for protocols, like SPDY, which allow the same |
144 // connection to be shared between multiple domains, each of which need | 136 // connection to be shared between multiple domains, each of which need |
145 // a channel ID. | 137 // a channel ID. |
146 // | 138 // |
147 // Public for ssl_client_socket_openssl_unittest.cc. | 139 // Public for ssl_client_socket_openssl_unittest.cc. |
148 virtual bool WasChannelIDSent() const; | 140 virtual bool WasChannelIDSent() const; |
149 | 141 |
150 // Record which TLS extension was used to negotiate protocol and protocol | |
151 // chosen in a UMA histogram. | |
152 void RecordNegotiationExtension(); | |
153 | |
154 protected: | 142 protected: |
155 virtual void set_channel_id_sent(bool channel_id_sent); | 143 virtual void set_channel_id_sent(bool channel_id_sent); |
156 | 144 |
157 virtual void set_signed_cert_timestamps_received( | 145 virtual void set_signed_cert_timestamps_received( |
158 bool signed_cert_timestamps_received); | 146 bool signed_cert_timestamps_received); |
159 | 147 |
160 virtual void set_stapled_ocsp_response_received( | 148 virtual void set_stapled_ocsp_response_received( |
161 bool stapled_ocsp_response_received); | 149 bool stapled_ocsp_response_received); |
162 | 150 |
| 151 // Record which TLS extension was used to negotiate protocol and protocol |
| 152 // chosen in a UMA histogram. |
| 153 void RecordNegotiationExtension(); |
| 154 |
163 // Records histograms for channel id support during full handshakes - resumed | 155 // Records histograms for channel id support during full handshakes - resumed |
164 // handshakes are ignored. | 156 // handshakes are ignored. |
165 static void RecordChannelIDSupport( | 157 static void RecordChannelIDSupport( |
166 ChannelIDService* channel_id_service, | 158 ChannelIDService* channel_id_service, |
167 bool negotiated_channel_id, | 159 bool negotiated_channel_id, |
168 bool channel_id_enabled, | 160 bool channel_id_enabled, |
169 bool supports_ecc); | 161 bool supports_ecc); |
170 | 162 |
171 // Returns whether TLS channel ID is enabled. | 163 // Returns whether TLS channel ID is enabled. |
172 static bool IsChannelIDEnabled( | 164 static bool IsChannelIDEnabled( |
(...skipping 30 matching lines...) Expand all Loading... |
203 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. | 195 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. |
204 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 196 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
205 ConnectSignedCertTimestampsEnabledTLSExtension); | 197 ConnectSignedCertTimestampsEnabledTLSExtension); |
206 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 198 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
207 ConnectSignedCertTimestampsEnabledOCSP); | 199 ConnectSignedCertTimestampsEnabledOCSP); |
208 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 200 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
209 ConnectSignedCertTimestampsDisabled); | 201 ConnectSignedCertTimestampsDisabled); |
210 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 202 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
211 VerifyServerChainProperlyOrdered); | 203 VerifyServerChainProperlyOrdered); |
212 | 204 |
213 // True if NPN was responded to, independent of selecting SPDY or HTTP. | |
214 bool was_npn_negotiated_; | |
215 // True if NPN successfully negotiated SPDY. | |
216 bool was_spdy_negotiated_; | |
217 // Protocol that we negotiated with the server. | 205 // Protocol that we negotiated with the server. |
218 NextProto protocol_negotiated_; | 206 NextProto protocol_negotiated_; |
219 // True if a channel ID was sent. | 207 // True if a channel ID was sent. |
220 bool channel_id_sent_; | 208 bool channel_id_sent_; |
221 // True if SCTs were received via a TLS extension. | 209 // True if SCTs were received via a TLS extension. |
222 bool signed_cert_timestamps_received_; | 210 bool signed_cert_timestamps_received_; |
223 // True if a stapled OCSP response was received. | 211 // True if a stapled OCSP response was received. |
224 bool stapled_ocsp_response_received_; | 212 bool stapled_ocsp_response_received_; |
225 // Protocol negotiation extension used. | 213 // Protocol negotiation extension used. |
226 SSLNegotiationExtension negotiation_extension_; | 214 SSLNegotiationExtension negotiation_extension_; |
227 }; | 215 }; |
228 | 216 |
229 } // namespace net | 217 } // namespace net |
230 | 218 |
231 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 219 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |