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