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