| 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 |
| 11 #include "webrtc/base/sslstreamadapter.h" | 11 #include "webrtc/base/sslstreamadapter.h" |
| 12 #include "webrtc/base/sslconfig.h" | |
| 13 | |
| 14 #if SSL_USE_OPENSSL | |
| 15 | 12 |
| 16 #include "webrtc/base/opensslstreamadapter.h" | 13 #include "webrtc/base/opensslstreamadapter.h" |
| 17 | 14 |
| 18 #endif // SSL_USE_OPENSSL | |
| 19 | |
| 20 /////////////////////////////////////////////////////////////////////////////// | 15 /////////////////////////////////////////////////////////////////////////////// |
| 21 | 16 |
| 22 namespace rtc { | 17 namespace rtc { |
| 23 | 18 |
| 24 // TODO(guoweis): Move this to SDP layer and use int form internally. | 19 // TODO(guoweis): Move this to SDP layer and use int form internally. |
| 25 // webrtc:5043. | 20 // webrtc:5043. |
| 26 const char CS_AES_CM_128_HMAC_SHA1_80[] = "AES_CM_128_HMAC_SHA1_80"; | 21 const char CS_AES_CM_128_HMAC_SHA1_80[] = "AES_CM_128_HMAC_SHA1_80"; |
| 27 const char CS_AES_CM_128_HMAC_SHA1_32[] = "AES_CM_128_HMAC_SHA1_32"; | 22 const char CS_AES_CM_128_HMAC_SHA1_32[] = "AES_CM_128_HMAC_SHA1_32"; |
| 28 const char CS_AEAD_AES_128_GCM[] = "AEAD_AES_128_GCM"; | 23 const char CS_AEAD_AES_128_GCM[] = "AEAD_AES_128_GCM"; |
| 29 const char CS_AEAD_AES_256_GCM[] = "AEAD_AES_256_GCM"; | 24 const char CS_AEAD_AES_256_GCM[] = "AEAD_AES_256_GCM"; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 89 } |
| 95 | 90 |
| 96 // static | 91 // static |
| 97 CryptoOptions CryptoOptions::NoGcm() { | 92 CryptoOptions CryptoOptions::NoGcm() { |
| 98 CryptoOptions options; | 93 CryptoOptions options; |
| 99 options.enable_gcm_crypto_suites = false; | 94 options.enable_gcm_crypto_suites = false; |
| 100 return options; | 95 return options; |
| 101 } | 96 } |
| 102 | 97 |
| 103 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { | 98 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { |
| 104 #if SSL_USE_OPENSSL | |
| 105 return new OpenSSLStreamAdapter(stream); | 99 return new OpenSSLStreamAdapter(stream); |
| 106 #else // !SSL_USE_OPENSSL | |
| 107 return NULL; | |
| 108 #endif // SSL_USE_OPENSSL | |
| 109 } | 100 } |
| 110 | 101 |
| 111 SSLStreamAdapter::SSLStreamAdapter(StreamInterface* stream) | 102 SSLStreamAdapter::SSLStreamAdapter(StreamInterface* stream) |
| 112 : StreamAdapterInterface(stream), | 103 : StreamAdapterInterface(stream), |
| 113 ignore_bad_cert_(false), | 104 ignore_bad_cert_(false), |
| 114 client_auth_enabled_(true) {} | 105 client_auth_enabled_(true) {} |
| 115 | 106 |
| 116 SSLStreamAdapter::~SSLStreamAdapter() {} | 107 SSLStreamAdapter::~SSLStreamAdapter() {} |
| 117 | 108 |
| 118 bool SSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) { | 109 bool SSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 130 | 121 |
| 131 bool SSLStreamAdapter::SetDtlsSrtpCryptoSuites( | 122 bool SSLStreamAdapter::SetDtlsSrtpCryptoSuites( |
| 132 const std::vector<int>& crypto_suites) { | 123 const std::vector<int>& crypto_suites) { |
| 133 return false; | 124 return false; |
| 134 } | 125 } |
| 135 | 126 |
| 136 bool SSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) { | 127 bool SSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) { |
| 137 return false; | 128 return false; |
| 138 } | 129 } |
| 139 | 130 |
| 140 #if SSL_USE_OPENSSL | |
| 141 bool SSLStreamAdapter::HaveDtls() { | |
| 142 return OpenSSLStreamAdapter::HaveDtls(); | |
| 143 } | |
| 144 bool SSLStreamAdapter::HaveDtlsSrtp() { | |
| 145 return OpenSSLStreamAdapter::HaveDtlsSrtp(); | |
| 146 } | |
| 147 bool SSLStreamAdapter::HaveExporter() { | |
| 148 return OpenSSLStreamAdapter::HaveExporter(); | |
| 149 } | |
| 150 bool SSLStreamAdapter::IsBoringSsl() { | 131 bool SSLStreamAdapter::IsBoringSsl() { |
| 151 return OpenSSLStreamAdapter::IsBoringSsl(); | 132 return OpenSSLStreamAdapter::IsBoringSsl(); |
| 152 } | 133 } |
| 153 bool SSLStreamAdapter::IsAcceptableCipher(int cipher, KeyType key_type) { | 134 bool SSLStreamAdapter::IsAcceptableCipher(int cipher, KeyType key_type) { |
| 154 return OpenSSLStreamAdapter::IsAcceptableCipher(cipher, key_type); | 135 return OpenSSLStreamAdapter::IsAcceptableCipher(cipher, key_type); |
| 155 } | 136 } |
| 156 bool SSLStreamAdapter::IsAcceptableCipher(const std::string& cipher, | 137 bool SSLStreamAdapter::IsAcceptableCipher(const std::string& cipher, |
| 157 KeyType key_type) { | 138 KeyType key_type) { |
| 158 return OpenSSLStreamAdapter::IsAcceptableCipher(cipher, key_type); | 139 return OpenSSLStreamAdapter::IsAcceptableCipher(cipher, key_type); |
| 159 } | 140 } |
| 160 std::string SSLStreamAdapter::SslCipherSuiteToName(int cipher_suite) { | 141 std::string SSLStreamAdapter::SslCipherSuiteToName(int cipher_suite) { |
| 161 return OpenSSLStreamAdapter::SslCipherSuiteToName(cipher_suite); | 142 return OpenSSLStreamAdapter::SslCipherSuiteToName(cipher_suite); |
| 162 } | 143 } |
| 163 void SSLStreamAdapter::enable_time_callback_for_testing() { | 144 void SSLStreamAdapter::enable_time_callback_for_testing() { |
| 164 OpenSSLStreamAdapter::enable_time_callback_for_testing(); | 145 OpenSSLStreamAdapter::enable_time_callback_for_testing(); |
| 165 } | 146 } |
| 166 #endif // SSL_USE_OPENSSL | |
| 167 | 147 |
| 168 /////////////////////////////////////////////////////////////////////////////// | 148 /////////////////////////////////////////////////////////////////////////////// |
| 169 | 149 |
| 170 } // namespace rtc | 150 } // namespace rtc |
| OLD | NEW |