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 |
32 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { | 45 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { |
33 #if SSL_USE_SCHANNEL | 46 #if SSL_USE_SCHANNEL |
34 return NULL; | 47 return NULL; |
35 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL | 48 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL |
36 return new OpenSSLStreamAdapter(stream); | 49 return new OpenSSLStreamAdapter(stream); |
37 #else // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL | 50 #else // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL |
38 return NULL; | 51 return NULL; |
39 #endif | 52 #endif |
40 } | 53 } |
41 | 54 |
42 bool SSLStreamAdapter::GetSslCipher(std::string* cipher) { | 55 bool SSLStreamAdapter::GetSslCipherSuite(uint16_t* cipher) { |
43 return false; | 56 return false; |
44 } | 57 } |
45 | 58 |
46 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, | 59 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, |
47 const uint8* context, | 60 const uint8* context, |
48 size_t context_len, | 61 size_t context_len, |
49 bool use_context, | 62 bool use_context, |
50 uint8* result, | 63 uint8* result, |
51 size_t result_len) { | 64 size_t result_len) { |
52 return false; // Default is unsupported | 65 return false; // Default is unsupported |
53 } | 66 } |
54 | 67 |
55 bool SSLStreamAdapter::SetDtlsSrtpCiphers( | 68 bool SSLStreamAdapter::SetDtlsSrtpCiphers( |
56 const std::vector<std::string>& ciphers) { | 69 const std::vector<std::string>& ciphers) { |
57 return false; | 70 return false; |
58 } | 71 } |
59 | 72 |
60 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { | 73 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { |
61 return false; | 74 return false; |
62 } | 75 } |
63 | 76 |
64 // Note: this matches the logic above with SCHANNEL dominating | 77 // Note: this matches the logic above with SCHANNEL dominating |
65 #if SSL_USE_SCHANNEL | 78 #if SSL_USE_SCHANNEL |
66 bool SSLStreamAdapter::HaveDtls() { return false; } | 79 bool SSLStreamAdapter::HaveDtls() { return false; } |
67 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; } | 80 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; } |
68 bool SSLStreamAdapter::HaveExporter() { return false; } | 81 bool SSLStreamAdapter::HaveExporter() { return false; } |
69 std::string SSLStreamAdapter::GetDefaultSslCipher(SSLProtocolVersion version, | 82 uint16_t SSLStreamAdapter::GetDefaultSslCipherForTest( |
70 KeyType key_type) { | 83 SSLProtocolVersion version, |
71 return std::string(); | 84 KeyType key_type) { |
| 85 return 0; |
72 } | 86 } |
73 #elif SSL_USE_OPENSSL | 87 #elif SSL_USE_OPENSSL |
74 bool SSLStreamAdapter::HaveDtls() { | 88 bool SSLStreamAdapter::HaveDtls() { |
75 return OpenSSLStreamAdapter::HaveDtls(); | 89 return OpenSSLStreamAdapter::HaveDtls(); |
76 } | 90 } |
77 bool SSLStreamAdapter::HaveDtlsSrtp() { | 91 bool SSLStreamAdapter::HaveDtlsSrtp() { |
78 return OpenSSLStreamAdapter::HaveDtlsSrtp(); | 92 return OpenSSLStreamAdapter::HaveDtlsSrtp(); |
79 } | 93 } |
80 bool SSLStreamAdapter::HaveExporter() { | 94 bool SSLStreamAdapter::HaveExporter() { |
81 return OpenSSLStreamAdapter::HaveExporter(); | 95 return OpenSSLStreamAdapter::HaveExporter(); |
82 } | 96 } |
83 std::string SSLStreamAdapter::GetDefaultSslCipher(SSLProtocolVersion version, | 97 uint16_t SSLStreamAdapter::GetDefaultSslCipherForTest( |
84 KeyType key_type) { | 98 SSLProtocolVersion version, |
85 return OpenSSLStreamAdapter::GetDefaultSslCipher(version, key_type); | 99 KeyType key_type) { |
| 100 return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type); |
| 101 } |
| 102 |
| 103 std::string SSLStreamAdapter::GetSslCipherSuiteName(uint16_t cipher) { |
| 104 return OpenSSLStreamAdapter::GetSslCipherSuiteName(cipher); |
86 } | 105 } |
87 #endif // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL | 106 #endif // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL |
88 | 107 |
89 /////////////////////////////////////////////////////////////////////////////// | 108 /////////////////////////////////////////////////////////////////////////////// |
90 | 109 |
91 } // namespace rtc | 110 } // namespace rtc |
OLD | NEW |