Reland Convert internal representation of Srtp cryptos from string to int
TBR=pthatcher@webrtc.org
BUG=webrtc:5043
Review URL: https://codereview.webrtc.org/1458023002 .
Cr-Original-Commit-Position: refs/heads/master@{#10703}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 521ed7bf022c4e30574d7970c2be5be46567f4cd
diff --git a/base/sslstreamadapter.cc b/base/sslstreamadapter.cc
index b9ba9d3..a2cff3e 100644
--- a/base/sslstreamadapter.cc
+++ b/base/sslstreamadapter.cc
@@ -30,12 +30,20 @@
const char CS_AES_CM_128_HMAC_SHA1_80[] = "AES_CM_128_HMAC_SHA1_80";
const char CS_AES_CM_128_HMAC_SHA1_32[] = "AES_CM_128_HMAC_SHA1_32";
-int GetSrtpCryptoSuiteFromName(const std::string& cipher) {
- if (cipher == CS_AES_CM_128_HMAC_SHA1_32)
+std::string SrtpCryptoSuiteToName(int crypto_suite) {
+ if (crypto_suite == SRTP_AES128_CM_SHA1_32)
+ return CS_AES_CM_128_HMAC_SHA1_32;
+ if (crypto_suite == SRTP_AES128_CM_SHA1_80)
+ return CS_AES_CM_128_HMAC_SHA1_80;
+ return std::string();
+}
+
+int SrtpCryptoSuiteFromName(const std::string& crypto_suite) {
+ if (crypto_suite == CS_AES_CM_128_HMAC_SHA1_32)
return SRTP_AES128_CM_SHA1_32;
- if (cipher == CS_AES_CM_128_HMAC_SHA1_80)
+ if (crypto_suite == CS_AES_CM_128_HMAC_SHA1_80)
return SRTP_AES128_CM_SHA1_80;
- return 0;
+ return SRTP_INVALID_CRYPTO_SUITE;
}
SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) {
@@ -46,7 +54,7 @@
#endif // SSL_USE_OPENSSL
}
-bool SSLStreamAdapter::GetSslCipherSuite(int* cipher) {
+bool SSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) {
return false;
}
@@ -59,12 +67,12 @@
return false; // Default is unsupported
}
-bool SSLStreamAdapter::SetDtlsSrtpCiphers(
- const std::vector<std::string>& ciphers) {
+bool SSLStreamAdapter::SetDtlsSrtpCryptoSuites(
+ const std::vector<int>& crypto_suites) {
return false;
}
-bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) {
+bool SSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) {
return false;
}
@@ -83,8 +91,8 @@
return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type);
}
-std::string SSLStreamAdapter::GetSslCipherSuiteName(int cipher) {
- return OpenSSLStreamAdapter::GetSslCipherSuiteName(cipher);
+std::string SSLStreamAdapter::SslCipherSuiteToName(int cipher_suite) {
+ return OpenSSLStreamAdapter::SslCipherSuiteToName(cipher_suite);
}
#endif // SSL_USE_OPENSSL