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 const char CS_AES_CM_128_HMAC_SHA1_80[] = "AES_CM_128_HMAC_SHA1_80"; | |
33 const char CS_AES_CM_128_HMAC_SHA1_32[] = "AES_CM_128_HMAC_SHA1_32"; | |
pthatcher1
2015/09/29 22:25:16
Is this used anywhere that isn't PeerConnection or
guoweis_webrtc
2015/09/30 04:09:47
If I don't misunderstand, I was following Justin's
pthatcher1
2015/09/30 05:46:22
The constant in abstract form (which could be an i
guoweis_webrtc
2015/09/30 17:41:55
This makes sense. I'd like to do this in a separat
| |
34 | |
35 SrtpCipherType GetSrtpCipherType(const std::string& cipher) { | |
36 if (cipher == CS_AES_CM_128_HMAC_SHA1_32) | |
37 return SrtpCipher_AES_CM_128_HMAC_SHA1_32; | |
38 if (cipher == CS_AES_CM_128_HMAC_SHA1_80) | |
39 return SrtpCipher_AES_CM_128_HMAC_SHA1_80; | |
40 return SrtpCipher_Unknown; | |
41 } | |
42 | |
32 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { | 43 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { |
33 #if SSL_USE_SCHANNEL | 44 #if SSL_USE_SCHANNEL |
34 return NULL; | 45 return NULL; |
35 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL | 46 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL |
36 return new OpenSSLStreamAdapter(stream); | 47 return new OpenSSLStreamAdapter(stream); |
37 #else // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL | 48 #else // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL |
38 return NULL; | 49 return NULL; |
39 #endif | 50 #endif |
40 } | 51 } |
41 | 52 |
42 bool SSLStreamAdapter::GetSslCipher(std::string* cipher) { | 53 bool SSLStreamAdapter::GetSslCipher(uint16_t* cipher) { |
43 return false; | 54 return false; |
44 } | 55 } |
45 | 56 |
46 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, | 57 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, |
47 const uint8* context, | 58 const uint8* context, |
48 size_t context_len, | 59 size_t context_len, |
49 bool use_context, | 60 bool use_context, |
50 uint8* result, | 61 uint8* result, |
51 size_t result_len) { | 62 size_t result_len) { |
52 return false; // Default is unsupported | 63 return false; // Default is unsupported |
53 } | 64 } |
54 | 65 |
55 bool SSLStreamAdapter::SetDtlsSrtpCiphers( | 66 bool SSLStreamAdapter::SetDtlsSrtpCiphers( |
56 const std::vector<std::string>& ciphers) { | 67 const std::vector<std::string>& ciphers) { |
57 return false; | 68 return false; |
58 } | 69 } |
59 | 70 |
60 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { | 71 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { |
61 return false; | 72 return false; |
62 } | 73 } |
63 | 74 |
64 // Note: this matches the logic above with SCHANNEL dominating | 75 // Note: this matches the logic above with SCHANNEL dominating |
65 #if SSL_USE_SCHANNEL | 76 #if SSL_USE_SCHANNEL |
66 bool SSLStreamAdapter::HaveDtls() { return false; } | 77 bool SSLStreamAdapter::HaveDtls() { return false; } |
67 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; } | 78 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; } |
68 bool SSLStreamAdapter::HaveExporter() { return false; } | 79 bool SSLStreamAdapter::HaveExporter() { return false; } |
69 std::string SSLStreamAdapter::GetDefaultSslCipher(SSLProtocolVersion version, | 80 uint16_t SSLStreamAdapter::GetDefaultSslCipherForTest( |
70 KeyType key_type) { | 81 SSLProtocolVersion version, |
71 return std::string(); | 82 KeyType key_type) { |
83 return 0; | |
72 } | 84 } |
73 #elif SSL_USE_OPENSSL | 85 #elif SSL_USE_OPENSSL |
74 bool SSLStreamAdapter::HaveDtls() { | 86 bool SSLStreamAdapter::HaveDtls() { |
75 return OpenSSLStreamAdapter::HaveDtls(); | 87 return OpenSSLStreamAdapter::HaveDtls(); |
76 } | 88 } |
77 bool SSLStreamAdapter::HaveDtlsSrtp() { | 89 bool SSLStreamAdapter::HaveDtlsSrtp() { |
78 return OpenSSLStreamAdapter::HaveDtlsSrtp(); | 90 return OpenSSLStreamAdapter::HaveDtlsSrtp(); |
79 } | 91 } |
80 bool SSLStreamAdapter::HaveExporter() { | 92 bool SSLStreamAdapter::HaveExporter() { |
81 return OpenSSLStreamAdapter::HaveExporter(); | 93 return OpenSSLStreamAdapter::HaveExporter(); |
82 } | 94 } |
83 std::string SSLStreamAdapter::GetDefaultSslCipher(SSLProtocolVersion version, | 95 uint16_t SSLStreamAdapter::GetDefaultSslCipherForTest( |
84 KeyType key_type) { | 96 SSLProtocolVersion version, |
85 return OpenSSLStreamAdapter::GetDefaultSslCipher(version, key_type); | 97 KeyType key_type) { |
98 return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type); | |
99 } | |
100 | |
101 std::string SSLStreamAdapter::GetRfcSslCipherName(uint16_t cipher) { | |
102 return OpenSSLStreamAdapter::GetRfcSslCipherName(cipher); | |
86 } | 103 } |
87 #endif // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL | 104 #endif // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL |
88 | 105 |
89 /////////////////////////////////////////////////////////////////////////////// | 106 /////////////////////////////////////////////////////////////////////////////// |
90 | 107 |
91 } // namespace rtc | 108 } // namespace rtc |
OLD | NEW |