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

Unified Diff: talk/app/webrtc/webrtcsessiondescriptionfactory.cc

Issue 1151943005: Ability to specify KeyType (RSA, ECDSA) for SSLIdentity generation in libjingle (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressing ASAN, LSAN issues in unittests Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/webrtcsessiondescriptionfactory.cc
diff --git a/talk/app/webrtc/webrtcsessiondescriptionfactory.cc b/talk/app/webrtc/webrtcsessiondescriptionfactory.cc
index aab24cf0654b01054355842d54c22ea470c2c3d7..48eb81fe81fd555e9f7805a8f5516bce1ceafd7c 100644
--- a/talk/app/webrtc/webrtcsessiondescriptionfactory.cc
+++ b/talk/app/webrtc/webrtcsessiondescriptionfactory.cc
@@ -65,8 +65,7 @@ static bool ValidStreams(const MediaSessionOptions::Streams& streams) {
enum {
MSG_CREATE_SESSIONDESCRIPTION_SUCCESS,
- MSG_CREATE_SESSIONDESCRIPTION_FAILED,
- MSG_GENERATE_IDENTITY,
+ MSG_CREATE_SESSIONDESCRIPTION_FAILED
};
struct CreateSessionDescriptionMsg : public rtc::MessageData {
@@ -128,11 +127,12 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
MediaStreamSignaling* mediastream_signaling,
- DTLSIdentityServiceInterface* dtls_identity_service,
+ DtlsIdentityStoreInterface* dtls_identity_store,
WebRtcSession* session,
const std::string& session_id,
cricket::DataChannelType dct,
- bool dtls_enabled)
+ bool dtls_enabled,
+ rtc::KeyType key_type)
: signaling_thread_(signaling_thread),
mediastream_signaling_(mediastream_signaling),
session_desc_factory_(channel_manager, &transport_desc_factory_),
@@ -141,21 +141,21 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
// to just use a random number as session id and start version from
// |kInitSessionVersion|.
session_version_(kInitSessionVersion),
- identity_service_(dtls_identity_service),
+ identity_store_(dtls_identity_store),
session_(session),
session_id_(session_id),
data_channel_type_(dct),
- identity_request_state_(IDENTITY_NOT_NEEDED) {
+ identity_request_state_(IDENTITY_NOT_NEEDED),
+ key_type_(key_type) {
transport_desc_factory_.set_protocol(cricket::ICEPROTO_RFC5245);
session_desc_factory_.set_add_legacy_streams(false);
// SRTP-SDES is disabled if DTLS is on.
SetSdesPolicy(dtls_enabled ? cricket::SEC_DISABLED : cricket::SEC_REQUIRED);
- if (!dtls_enabled) {
- return;
- }
+ // If |dtls_enabled| we must have an |identity_store_|.
+ DCHECK(!dtls_enabled || identity_store_);
- if (identity_service_.get()) {
+ if (dtls_enabled && identity_store_) {
identity_request_observer_ =
new rtc::RefCountedObject<WebRtcIdentityRequestObserver>();
@@ -164,21 +164,10 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
identity_request_observer_->SignalIdentityReady.connect(
this, &WebRtcSessionDescriptionFactory::SetIdentity);
- if (identity_service_->RequestIdentity(
- DtlsIdentityStore::kIdentityName,
- DtlsIdentityStore::kIdentityName,
- identity_request_observer_)) {
- LOG(LS_VERBOSE) << "DTLS-SRTP enabled; sent DTLS identity request.";
- identity_request_state_ = IDENTITY_WAITING;
- } else {
- LOG(LS_ERROR) << "Failed to send DTLS identity request.";
- identity_request_state_ = IDENTITY_FAILED;
- }
- } else {
+ LOG(LS_VERBOSE) << "DTLS-SRTP enabled; sending DTLS identity request.";
identity_request_state_ = IDENTITY_WAITING;
- // Do not generate the identity in the constructor since the caller has
- // not got a chance to connect to SignalIdentityReady.
- signaling_thread_->Post(this, MSG_GENERATE_IDENTITY, NULL);
+ identity_store_->RequestIdentity(key_type_,
+ identity_request_observer_.get());
}
}
@@ -310,11 +299,6 @@ void WebRtcSessionDescriptionFactory::OnMessage(rtc::Message* msg) {
delete param;
break;
}
- case MSG_GENERATE_IDENTITY: {
- LOG(LS_INFO) << "Generating identity.";
- SetIdentity(rtc::SSLIdentity::Generate(DtlsIdentityStore::kIdentityName));
- break;
- }
default:
ASSERT(false);
break;

Powered by Google App Engine
This is Rietveld 408576698