| 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 11 matching lines...) Expand all Loading... |
| 22 #elif SSL_USE_OPENSSL // && !SSL_USE_SCHANNEL | 22 #elif SSL_USE_OPENSSL // && !SSL_USE_SCHANNEL |
| 23 | 23 |
| 24 #include "webrtc/base/opensslstreamadapter.h" | 24 #include "webrtc/base/opensslstreamadapter.h" |
| 25 | 25 |
| 26 #endif // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL | 26 #endif // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL |
| 27 | 27 |
| 28 /////////////////////////////////////////////////////////////////////////////// | 28 /////////////////////////////////////////////////////////////////////////////// |
| 29 | 29 |
| 30 namespace rtc { | 30 namespace rtc { |
| 31 | 31 |
| 32 // TODO(guoweis): Move this to SDP layer and use int form internally. | |
| 33 // webrtc:5043. | |
| 34 const char CS_AES_CM_128_HMAC_SHA1_80[] = "AES_CM_128_HMAC_SHA1_80"; | |
| 35 const char CS_AES_CM_128_HMAC_SHA1_32[] = "AES_CM_128_HMAC_SHA1_32"; | |
| 36 | |
| 37 uint16_t GetSrtpCryptoSuiteFromName(const std::string& cipher) { | |
| 38 if (cipher == CS_AES_CM_128_HMAC_SHA1_32) | |
| 39 return SRTP_AES128_CM_SHA1_32; | |
| 40 if (cipher == CS_AES_CM_128_HMAC_SHA1_80) | |
| 41 return SRTP_AES128_CM_SHA1_80; | |
| 42 return 0; | |
| 43 } | |
| 44 | |
| 45 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { | 32 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { |
| 46 #if SSL_USE_SCHANNEL | 33 #if SSL_USE_SCHANNEL |
| 47 return NULL; | 34 return NULL; |
| 48 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL | 35 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL |
| 49 return new OpenSSLStreamAdapter(stream); | 36 return new OpenSSLStreamAdapter(stream); |
| 50 #else // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL | 37 #else // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL |
| 51 return NULL; | 38 return NULL; |
| 52 #endif | 39 #endif |
| 53 } | 40 } |
| 54 | 41 |
| 55 bool SSLStreamAdapter::GetSslCipherSuite(uint16_t* cipher) { | 42 bool SSLStreamAdapter::GetSslCipher(std::string* cipher) { |
| 56 return false; | 43 return false; |
| 57 } | 44 } |
| 58 | 45 |
| 59 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, | 46 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, |
| 60 const uint8* context, | 47 const uint8* context, |
| 61 size_t context_len, | 48 size_t context_len, |
| 62 bool use_context, | 49 bool use_context, |
| 63 uint8* result, | 50 uint8* result, |
| 64 size_t result_len) { | 51 size_t result_len) { |
| 65 return false; // Default is unsupported | 52 return false; // Default is unsupported |
| 66 } | 53 } |
| 67 | 54 |
| 68 bool SSLStreamAdapter::SetDtlsSrtpCiphers( | 55 bool SSLStreamAdapter::SetDtlsSrtpCiphers( |
| 69 const std::vector<std::string>& ciphers) { | 56 const std::vector<std::string>& ciphers) { |
| 70 return false; | 57 return false; |
| 71 } | 58 } |
| 72 | 59 |
| 73 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { | 60 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { |
| 74 return false; | 61 return false; |
| 75 } | 62 } |
| 76 | 63 |
| 77 // Note: this matches the logic above with SCHANNEL dominating | 64 // Note: this matches the logic above with SCHANNEL dominating |
| 78 #if SSL_USE_SCHANNEL | 65 #if SSL_USE_SCHANNEL |
| 79 bool SSLStreamAdapter::HaveDtls() { return false; } | 66 bool SSLStreamAdapter::HaveDtls() { return false; } |
| 80 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; } | 67 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; } |
| 81 bool SSLStreamAdapter::HaveExporter() { return false; } | 68 bool SSLStreamAdapter::HaveExporter() { return false; } |
| 82 uint16_t SSLStreamAdapter::GetDefaultSslCipherForTest( | 69 std::string SSLStreamAdapter::GetDefaultSslCipher(SSLProtocolVersion version, |
| 83 SSLProtocolVersion version, | 70 KeyType key_type) { |
| 84 KeyType key_type) { | 71 return std::string(); |
| 85 return 0; | |
| 86 } | 72 } |
| 87 #elif SSL_USE_OPENSSL | 73 #elif SSL_USE_OPENSSL |
| 88 bool SSLStreamAdapter::HaveDtls() { | 74 bool SSLStreamAdapter::HaveDtls() { |
| 89 return OpenSSLStreamAdapter::HaveDtls(); | 75 return OpenSSLStreamAdapter::HaveDtls(); |
| 90 } | 76 } |
| 91 bool SSLStreamAdapter::HaveDtlsSrtp() { | 77 bool SSLStreamAdapter::HaveDtlsSrtp() { |
| 92 return OpenSSLStreamAdapter::HaveDtlsSrtp(); | 78 return OpenSSLStreamAdapter::HaveDtlsSrtp(); |
| 93 } | 79 } |
| 94 bool SSLStreamAdapter::HaveExporter() { | 80 bool SSLStreamAdapter::HaveExporter() { |
| 95 return OpenSSLStreamAdapter::HaveExporter(); | 81 return OpenSSLStreamAdapter::HaveExporter(); |
| 96 } | 82 } |
| 97 uint16_t SSLStreamAdapter::GetDefaultSslCipherForTest( | 83 std::string SSLStreamAdapter::GetDefaultSslCipher(SSLProtocolVersion version, |
| 98 SSLProtocolVersion version, | 84 KeyType key_type) { |
| 99 KeyType key_type) { | 85 return OpenSSLStreamAdapter::GetDefaultSslCipher(version, key_type); |
| 100 return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type); | |
| 101 } | |
| 102 | |
| 103 std::string SSLStreamAdapter::GetSslCipherSuiteName(uint16_t cipher) { | |
| 104 return OpenSSLStreamAdapter::GetSslCipherSuiteName(cipher); | |
| 105 } | 86 } |
| 106 #endif // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL | 87 #endif // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL |
| 107 | 88 |
| 108 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
| 109 | 90 |
| 110 } // namespace rtc | 91 } // namespace rtc |
| OLD | NEW |