Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: webrtc/base/sslstreamadapter.h

Issue 2167363002: Log how often DTLS negotiation failed because of incompatible ciphersuites. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use enum for handshake error code. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sslstreamadapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 SSL_PROTOCOL_TLS_10, 103 SSL_PROTOCOL_TLS_10,
104 SSL_PROTOCOL_TLS_11, 104 SSL_PROTOCOL_TLS_11,
105 SSL_PROTOCOL_TLS_12, 105 SSL_PROTOCOL_TLS_12,
106 SSL_PROTOCOL_DTLS_10 = SSL_PROTOCOL_TLS_11, 106 SSL_PROTOCOL_DTLS_10 = SSL_PROTOCOL_TLS_11,
107 SSL_PROTOCOL_DTLS_12 = SSL_PROTOCOL_TLS_12, 107 SSL_PROTOCOL_DTLS_12 = SSL_PROTOCOL_TLS_12,
108 }; 108 };
109 109
110 // Errors for Read -- in the high range so no conflict with OpenSSL. 110 // Errors for Read -- in the high range so no conflict with OpenSSL.
111 enum { SSE_MSG_TRUNC = 0xff0001 }; 111 enum { SSE_MSG_TRUNC = 0xff0001 };
112 112
113 // Used to send back UMA histogram value. Logged when Dtls handshake fails.
114 enum class SSLHandshakeError { UNKNOWN, INCOMPATIBLE_CIPHERSUITE, MAX_VALUE };
115
113 class SSLStreamAdapter : public StreamAdapterInterface { 116 class SSLStreamAdapter : public StreamAdapterInterface {
114 public: 117 public:
115 // Instantiate an SSLStreamAdapter wrapping the given stream, 118 // Instantiate an SSLStreamAdapter wrapping the given stream,
116 // (using the selected implementation for the platform). 119 // (using the selected implementation for the platform).
117 // Caller is responsible for freeing the returned object. 120 // Caller is responsible for freeing the returned object.
118 static SSLStreamAdapter* Create(StreamInterface* stream); 121 static SSLStreamAdapter* Create(StreamInterface* stream);
119 122
120 explicit SSLStreamAdapter(StreamInterface* stream) 123 explicit SSLStreamAdapter(StreamInterface* stream);
121 : StreamAdapterInterface(stream), ignore_bad_cert_(false), 124 ~SSLStreamAdapter() override;
122 client_auth_enabled_(true) { }
123 125
124 void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } 126 void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; }
125 bool ignore_bad_cert() const { return ignore_bad_cert_; } 127 bool ignore_bad_cert() const { return ignore_bad_cert_; }
126 128
127 void set_client_auth_enabled(bool enabled) { client_auth_enabled_ = enabled; } 129 void set_client_auth_enabled(bool enabled) { client_auth_enabled_ = enabled; }
128 bool client_auth_enabled() const { return client_auth_enabled_; } 130 bool client_auth_enabled() const { return client_auth_enabled_; }
129 131
130 // Specify our SSL identity: key and certificate. SSLStream takes ownership 132 // Specify our SSL identity: key and certificate. SSLStream takes ownership
131 // of the SSLIdentity object and will free it when appropriate. Should be 133 // of the SSLIdentity object and will free it when appropriate. Should be
132 // called no more than once on a given SSLStream instance. 134 // called no more than once on a given SSLStream instance.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Returns true iff the supplied cipher is deemed to be strong. 220 // Returns true iff the supplied cipher is deemed to be strong.
219 // TODO(torbjorng): Consider removing the KeyType argument. 221 // TODO(torbjorng): Consider removing the KeyType argument.
220 static bool IsAcceptableCipher(int cipher, KeyType key_type); 222 static bool IsAcceptableCipher(int cipher, KeyType key_type);
221 static bool IsAcceptableCipher(const std::string& cipher, KeyType key_type); 223 static bool IsAcceptableCipher(const std::string& cipher, KeyType key_type);
222 224
223 // TODO(guoweis): Move this away from a static class method. Currently this is 225 // TODO(guoweis): Move this away from a static class method. Currently this is
224 // introduced such that any caller could depend on sslstreamadapter.h without 226 // introduced such that any caller could depend on sslstreamadapter.h without
225 // depending on specific SSL implementation. 227 // depending on specific SSL implementation.
226 static std::string SslCipherSuiteToName(int cipher_suite); 228 static std::string SslCipherSuiteToName(int cipher_suite);
227 229
230 sigslot::signal1<SSLHandshakeError> SignalSSLHandshakeError;
231
228 private: 232 private:
229 // If true, the server certificate need not match the configured 233 // If true, the server certificate need not match the configured
230 // server_name, and in fact missing certificate authority and other 234 // server_name, and in fact missing certificate authority and other
231 // verification errors are ignored. 235 // verification errors are ignored.
232 bool ignore_bad_cert_; 236 bool ignore_bad_cert_;
233 237
234 // If true (default), the client is required to provide a certificate during 238 // If true (default), the client is required to provide a certificate during
235 // handshake. If no certificate is given, handshake fails. This applies to 239 // handshake. If no certificate is given, handshake fails. This applies to
236 // server mode only. 240 // server mode only.
237 bool client_auth_enabled_; 241 bool client_auth_enabled_;
238 }; 242 };
239 243
240 } // namespace rtc 244 } // namespace rtc
241 245
242 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ 246 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_
OLDNEW
« no previous file with comments | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sslstreamadapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698