Chromium Code Reviews| 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 "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 11 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 13 #include "net/socket/ssl_socket.h" | 14 #include "net/socket/ssl_socket.h" |
| 14 #include "net/socket/stream_socket.h" | 15 #include "net/socket/stream_socket.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 | 18 |
| 18 class CertVerifier; | 19 class CertVerifier; |
| 19 class CTVerifier; | 20 class CTVerifier; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 virtual ServerBoundCertService* GetServerBoundCertService() const = 0; | 125 virtual ServerBoundCertService* GetServerBoundCertService() const = 0; |
| 125 | 126 |
| 126 // Returns true if a channel ID was sent on this connection. | 127 // Returns true if a channel ID was sent on this connection. |
| 127 // This may be useful for protocols, like SPDY, which allow the same | 128 // This may be useful for protocols, like SPDY, which allow the same |
| 128 // connection to be shared between multiple domains, each of which need | 129 // connection to be shared between multiple domains, each of which need |
| 129 // a channel ID. | 130 // a channel ID. |
| 130 // | 131 // |
| 131 // Public for ssl_client_socket_openssl_unittest.cc. | 132 // Public for ssl_client_socket_openssl_unittest.cc. |
| 132 virtual bool WasChannelIDSent() const; | 133 virtual bool WasChannelIDSent() const; |
| 133 | 134 |
| 134 // Returns true if the server sent Certificate Transparency SCTs | |
| 135 // via a TLS extension. | |
| 136 // Temporary glue for testing while the CT code hasn't landed. | |
| 137 // TODO(ekasper): expose received SCTs via SSLInfo instead. | |
| 138 virtual bool WereSignedCertTimestampsReceived() const; | |
| 139 | |
| 140 protected: | 135 protected: |
| 141 virtual void set_channel_id_sent(bool channel_id_sent); | 136 virtual void set_channel_id_sent(bool channel_id_sent); |
| 142 | 137 |
| 143 virtual void set_signed_cert_timestamps_received( | 138 virtual void set_signed_cert_timestamps_received( |
| 144 bool signed_cert_timestamps_received); | 139 bool signed_cert_timestamps_received); |
| 145 | 140 |
| 141 virtual void set_stapled_ocsp_response_received( | |
| 142 bool stapled_ocsp_response_received); | |
| 143 | |
| 146 // Records histograms for channel id support during full handshakes - resumed | 144 // Records histograms for channel id support during full handshakes - resumed |
| 147 // handshakes are ignored. | 145 // handshakes are ignored. |
| 148 static void RecordChannelIDSupport( | 146 static void RecordChannelIDSupport( |
| 149 ServerBoundCertService* server_bound_cert_service, | 147 ServerBoundCertService* server_bound_cert_service, |
| 150 bool negotiated_channel_id, | 148 bool negotiated_channel_id, |
| 151 bool channel_id_enabled, | 149 bool channel_id_enabled, |
| 152 bool supports_ecc); | 150 bool supports_ecc); |
| 153 | 151 |
| 154 // Returns whether TLS channel ID is enabled. | 152 // Returns whether TLS channel ID is enabled. |
| 155 static bool IsChannelIDEnabled( | 153 static bool IsChannelIDEnabled( |
| 156 const SSLConfig& ssl_config, | 154 const SSLConfig& ssl_config, |
| 157 ServerBoundCertService* server_bound_cert_service); | 155 ServerBoundCertService* server_bound_cert_service); |
| 158 | 156 |
| 159 private: | 157 private: |
| 158 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. | |
| 159 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | |
| 160 ConnectSignedCertTimestampsEnabledTLSExtension); | |
| 161 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | |
| 162 ConnectSignedCertTimestampsEnabledOCSP); | |
| 163 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | |
| 164 ConnectSignedCertTimestampsDisabled); | |
|
wtc
2013/12/13 16:15:50
Nit: add a blank line to separate the friend test
ekasper
2013/12/13 17:26:10
Done.
| |
| 160 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 165 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
| 161 bool was_npn_negotiated_; | 166 bool was_npn_negotiated_; |
| 162 // True if NPN successfully negotiated SPDY. | 167 // True if NPN successfully negotiated SPDY. |
| 163 bool was_spdy_negotiated_; | 168 bool was_spdy_negotiated_; |
| 164 // Protocol that we negotiated with the server. | 169 // Protocol that we negotiated with the server. |
| 165 NextProto protocol_negotiated_; | 170 NextProto protocol_negotiated_; |
| 166 // True if a channel ID was sent. | 171 // True if a channel ID was sent. |
| 167 bool channel_id_sent_; | 172 bool channel_id_sent_; |
| 168 // True if SCTs were received via a TLS extension. | 173 // True if SCTs were received via a TLS extension. |
| 169 bool signed_cert_timestamps_received_; | 174 bool signed_cert_timestamps_received_; |
| 175 // True if a stapled OCSP response was received. | |
| 176 bool stapled_ocsp_response_received_; | |
| 170 }; | 177 }; |
| 171 | 178 |
| 172 } // namespace net | 179 } // namespace net |
| 173 | 180 |
| 174 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 181 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |