2014-05-13 18:00:26 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#endif // HAVE_CONFIG_H
|
|
|
|
|
|
|
|
|
|
#include "webrtc/base/sslstreamadapter.h"
|
|
|
|
|
#include "webrtc/base/sslconfig.h"
|
|
|
|
|
|
2015-10-07 04:57:55 -07:00
|
|
|
#if SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
|
|
|
|
|
#include "webrtc/base/opensslstreamadapter.h"
|
|
|
|
|
|
2015-10-07 04:57:55 -07:00
|
|
|
#endif // SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
namespace rtc {
|
|
|
|
|
|
2015-09-30 21:48:54 -07:00
|
|
|
// TODO(guoweis): Move this to SDP layer and use int form internally.
|
|
|
|
|
// webrtc:5043.
|
|
|
|
|
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";
|
|
|
|
|
|
2015-11-18 19:03:38 -08:00
|
|
|
int GetSrtpCryptoSuiteFromName(const std::string& cipher) {
|
|
|
|
|
if (cipher == CS_AES_CM_128_HMAC_SHA1_32)
|
2015-09-30 21:48:54 -07:00
|
|
|
return SRTP_AES128_CM_SHA1_32;
|
2015-11-18 19:03:38 -08:00
|
|
|
if (cipher == CS_AES_CM_128_HMAC_SHA1_80)
|
2015-09-30 21:48:54 -07:00
|
|
|
return SRTP_AES128_CM_SHA1_80;
|
2015-11-18 19:03:38 -08:00
|
|
|
return 0;
|
2015-09-30 21:48:54 -07:00
|
|
|
}
|
|
|
|
|
|
2014-05-13 18:00:26 +00:00
|
|
|
SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) {
|
2015-10-07 04:57:55 -07:00
|
|
|
#if SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
return new OpenSSLStreamAdapter(stream);
|
2015-10-07 04:57:55 -07:00
|
|
|
#else // !SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
return NULL;
|
2015-10-07 04:57:55 -07:00
|
|
|
#endif // SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-18 19:03:38 -08:00
|
|
|
bool SSLStreamAdapter::GetSslCipherSuite(int* cipher) {
|
2015-03-09 22:21:53 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
const uint8_t* context,
|
2015-03-09 22:21:53 +00:00
|
|
|
size_t context_len,
|
|
|
|
|
bool use_context,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint8_t* result,
|
2015-03-09 22:21:53 +00:00
|
|
|
size_t result_len) {
|
|
|
|
|
return false; // Default is unsupported
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-18 19:03:38 -08:00
|
|
|
bool SSLStreamAdapter::SetDtlsSrtpCiphers(
|
|
|
|
|
const std::vector<std::string>& ciphers) {
|
2015-03-09 22:21:53 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-18 19:03:38 -08:00
|
|
|
bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) {
|
2015-03-09 22:21:53 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-07 04:57:55 -07:00
|
|
|
#if SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
bool SSLStreamAdapter::HaveDtls() {
|
|
|
|
|
return OpenSSLStreamAdapter::HaveDtls();
|
|
|
|
|
}
|
|
|
|
|
bool SSLStreamAdapter::HaveDtlsSrtp() {
|
|
|
|
|
return OpenSSLStreamAdapter::HaveDtlsSrtp();
|
|
|
|
|
}
|
|
|
|
|
bool SSLStreamAdapter::HaveExporter() {
|
|
|
|
|
return OpenSSLStreamAdapter::HaveExporter();
|
|
|
|
|
}
|
2015-10-05 12:43:27 -07:00
|
|
|
int SSLStreamAdapter::GetDefaultSslCipherForTest(SSLProtocolVersion version,
|
|
|
|
|
KeyType key_type) {
|
2015-09-30 21:48:54 -07:00
|
|
|
return OpenSSLStreamAdapter::GetDefaultSslCipherForTest(version, key_type);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-18 19:03:38 -08:00
|
|
|
std::string SSLStreamAdapter::GetSslCipherSuiteName(int cipher) {
|
|
|
|
|
return OpenSSLStreamAdapter::GetSslCipherSuiteName(cipher);
|
2015-02-11 22:34:36 +00:00
|
|
|
}
|
2015-10-07 04:57:55 -07:00
|
|
|
#endif // SSL_USE_OPENSSL
|
2014-05-13 18:00:26 +00:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
} // namespace rtc
|