Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: webrtc/base/sslstreamadapter.cc

Issue 1416673006: Convert internal representation of Srtp cryptos from string to int. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: change srtp crypto name conversion Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/sslstreamadapter.h ('k') | webrtc/base/sslstreamadapter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 int GetSrtpCryptoSuiteFromName(const std::string& cipher) { 33 std::string SrtpCryptoSuiteToName(int crypto_suite) {
34 if (cipher == CS_AES_CM_128_HMAC_SHA1_32) 34 if (crypto_suite == SRTP_AES128_CM_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)
35 return SRTP_AES128_CM_SHA1_32; 43 return SRTP_AES128_CM_SHA1_32;
36 if (cipher == CS_AES_CM_128_HMAC_SHA1_80) 44 if (crypto_suite == CS_AES_CM_128_HMAC_SHA1_80)
37 return SRTP_AES128_CM_SHA1_80; 45 return SRTP_AES128_CM_SHA1_80;
38 return 0; 46 return SRTP_INVALID_CRYPTO_SUITE;
39 } 47 }
40 48
41 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) { 49 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) {
42 #if SSL_USE_OPENSSL 50 #if SSL_USE_OPENSSL
43 return new OpenSSLStreamAdapter(stream); 51 return new OpenSSLStreamAdapter(stream);
44 #else // !SSL_USE_OPENSSL 52 #else // !SSL_USE_OPENSSL
45 return NULL; 53 return NULL;
46 #endif // SSL_USE_OPENSSL 54 #endif // SSL_USE_OPENSSL
47 } 55 }
48 56
49 bool SSLStreamAdapter::GetSslCipherSuite(int* cipher) { 57 bool SSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) {
50 return false; 58 return false;
51 } 59 }
52 60
53 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label, 61 bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
54 const uint8_t* context, 62 const uint8_t* context,
55 size_t context_len, 63 size_t context_len,
56 bool use_context, 64 bool use_context,
57 uint8_t* result, 65 uint8_t* result,
58 size_t result_len) { 66 size_t result_len) {
59 return false; // Default is unsupported 67 return false; // Default is unsupported
60 } 68 }
61 69
62 bool SSLStreamAdapter::SetDtlsSrtpCiphers( 70 bool SSLStreamAdapter::SetDtlsSrtpCryptoSuites(
63 const std::vector<std::string>& ciphers) { 71 const std::vector<int>& crypto_suites) {
64 return false; 72 return false;
65 } 73 }
66 74
67 bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) { 75 bool SSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) {
68 return false; 76 return false;
69 } 77 }
70 78
71 #if SSL_USE_OPENSSL 79 #if SSL_USE_OPENSSL
72 bool SSLStreamAdapter::HaveDtls() { 80 bool SSLStreamAdapter::HaveDtls() {
73 return OpenSSLStreamAdapter::HaveDtls(); 81 return OpenSSLStreamAdapter::HaveDtls();
74 } 82 }
75 bool SSLStreamAdapter::HaveDtlsSrtp() { 83 bool SSLStreamAdapter::HaveDtlsSrtp() {
76 return OpenSSLStreamAdapter::HaveDtlsSrtp(); 84 return OpenSSLStreamAdapter::HaveDtlsSrtp();
77 } 85 }
78 bool SSLStreamAdapter::HaveExporter() { 86 bool SSLStreamAdapter::HaveExporter() {
79 return OpenSSLStreamAdapter::HaveExporter(); 87 return OpenSSLStreamAdapter::HaveExporter();
80 } 88 }
81 int SSLStreamAdapter::GetDefaultSslCipherForTest(SSLProtocolVersion version, 89 int SSLStreamAdapter::GetDefaultSslCipherForTest(SSLProtocolVersion version,
82 KeyType key_type) { 90 KeyType key_type) {
83 return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type); 91 return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type);
84 } 92 }
85 93
86 std::string SSLStreamAdapter::GetSslCipherSuiteName(int cipher) { 94 std::string SSLStreamAdapter::SslCipherSuiteToName(int cipher_suite) {
87 return OpenSSLStreamAdapter::GetSslCipherSuiteName(cipher); 95 return OpenSSLStreamAdapter::SslCipherSuiteToName(cipher_suite);
88 } 96 }
89 #endif // SSL_USE_OPENSSL 97 #endif // SSL_USE_OPENSSL
90 98
91 /////////////////////////////////////////////////////////////////////////////// 99 ///////////////////////////////////////////////////////////////////////////////
92 100
93 } // namespace rtc 101 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/sslstreamadapter.h ('k') | webrtc/base/sslstreamadapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698