OLD | NEW |
---|---|
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 SSL_PROTOCOL_TLS_10, | 69 SSL_PROTOCOL_TLS_10, |
70 SSL_PROTOCOL_TLS_11, | 70 SSL_PROTOCOL_TLS_11, |
71 SSL_PROTOCOL_TLS_12, | 71 SSL_PROTOCOL_TLS_12, |
72 SSL_PROTOCOL_DTLS_10 = SSL_PROTOCOL_TLS_11, | 72 SSL_PROTOCOL_DTLS_10 = SSL_PROTOCOL_TLS_11, |
73 SSL_PROTOCOL_DTLS_12 = SSL_PROTOCOL_TLS_12, | 73 SSL_PROTOCOL_DTLS_12 = SSL_PROTOCOL_TLS_12, |
74 }; | 74 }; |
75 | 75 |
76 // Errors for Read -- in the high range so no conflict with OpenSSL. | 76 // Errors for Read -- in the high range so no conflict with OpenSSL. |
77 enum { SSE_MSG_TRUNC = 0xff0001 }; | 77 enum { SSE_MSG_TRUNC = 0xff0001 }; |
78 | 78 |
79 // Used to back UMA histogram value. | |
honghaiz3
2016/07/22 21:35:26
=> "Used to send back UMA histogram values." or so
Zhi Huang
2016/07/25 17:24:28
Done.
| |
80 enum class SSLHandshakeError { ERR_INCOMPATIBLE_CIPHERSUITE, ERR_OTHER }; | |
skvlad
2016/07/22 01:25:14
Would it be better to make ERR_OTHER the first val
Zhi Huang
2016/07/25 17:24:28
Yes, this is better!
| |
81 | |
79 class SSLStreamAdapter : public StreamAdapterInterface { | 82 class SSLStreamAdapter : public StreamAdapterInterface { |
80 public: | 83 public: |
81 // Instantiate an SSLStreamAdapter wrapping the given stream, | 84 // Instantiate an SSLStreamAdapter wrapping the given stream, |
82 // (using the selected implementation for the platform). | 85 // (using the selected implementation for the platform). |
83 // Caller is responsible for freeing the returned object. | 86 // Caller is responsible for freeing the returned object. |
84 static SSLStreamAdapter* Create(StreamInterface* stream); | 87 static SSLStreamAdapter* Create(StreamInterface* stream); |
85 | 88 |
86 explicit SSLStreamAdapter(StreamInterface* stream) | 89 explicit SSLStreamAdapter(StreamInterface* stream) |
87 : StreamAdapterInterface(stream), ignore_bad_cert_(false), | 90 : StreamAdapterInterface(stream), ignore_bad_cert_(false), |
88 client_auth_enabled_(true) { } | 91 client_auth_enabled_(true) { } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 // Returns true iff the supplied cipher is deemed to be strong. | 203 // Returns true iff the supplied cipher is deemed to be strong. |
201 // TODO(torbjorng): Consider removing the KeyType argument. | 204 // TODO(torbjorng): Consider removing the KeyType argument. |
202 static bool IsAcceptableCipher(int cipher, KeyType key_type); | 205 static bool IsAcceptableCipher(int cipher, KeyType key_type); |
203 static bool IsAcceptableCipher(const std::string& cipher, KeyType key_type); | 206 static bool IsAcceptableCipher(const std::string& cipher, KeyType key_type); |
204 | 207 |
205 // TODO(guoweis): Move this away from a static class method. Currently this is | 208 // TODO(guoweis): Move this away from a static class method. Currently this is |
206 // introduced such that any caller could depend on sslstreamadapter.h without | 209 // introduced such that any caller could depend on sslstreamadapter.h without |
207 // depending on specific SSL implementation. | 210 // depending on specific SSL implementation. |
208 static std::string SslCipherSuiteToName(int cipher_suite); | 211 static std::string SslCipherSuiteToName(int cipher_suite); |
209 | 212 |
213 sigslot::signal1<SSLHandshakeError> SignalSSLHandshakeError; | |
214 | |
210 private: | 215 private: |
211 // If true, the server certificate need not match the configured | 216 // If true, the server certificate need not match the configured |
212 // server_name, and in fact missing certificate authority and other | 217 // server_name, and in fact missing certificate authority and other |
213 // verification errors are ignored. | 218 // verification errors are ignored. |
214 bool ignore_bad_cert_; | 219 bool ignore_bad_cert_; |
215 | 220 |
216 // If true (default), the client is required to provide a certificate during | 221 // If true (default), the client is required to provide a certificate during |
217 // handshake. If no certificate is given, handshake fails. This applies to | 222 // handshake. If no certificate is given, handshake fails. This applies to |
218 // server mode only. | 223 // server mode only. |
219 bool client_auth_enabled_; | 224 bool client_auth_enabled_; |
220 }; | 225 }; |
221 | 226 |
222 } // namespace rtc | 227 } // namespace rtc |
223 | 228 |
224 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ | 229 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ |
OLD | NEW |