diff --git a/td/telegram/CallActor.cpp b/td/telegram/CallActor.cpp index bc2cda5e..203ba711 100644 --- a/td/telegram/CallActor.cpp +++ b/td/telegram/CallActor.cpp @@ -457,8 +457,12 @@ void CallActor::do_load_dh_config(Promise> promise) { dh_config->version = dh->version_; dh_config->prime = dh->p_.as_slice().str(); dh_config->g = dh->g_; + Random::add_seed(dh->random_.as_slice()); G()->set_dh_config(dh_config); return std::move(dh_config); + } else if (new_dh_config->get_id() == telegram_api::messages_dhConfigNotModified::ID) { + auto dh = move_tl_object_as(new_dh_config); + Random::add_seed(dh->random_.as_slice()); } if (old_dh_config) { return std::move(old_dh_config); diff --git a/td/telegram/SecretChatActor.cpp b/td/telegram/SecretChatActor.cpp index 7ff98d71..0ac3f377 100644 --- a/td/telegram/SecretChatActor.cpp +++ b/td/telegram/SecretChatActor.cpp @@ -1913,12 +1913,6 @@ Status SecretChatActor::on_read_history(NetQueryPtr query) { return Status::OK(); } -// DH CONFIG -// messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; -// messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; -//---functions--- -// messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; - void SecretChatActor::start_up() { LOG(INFO) << "SecretChatActor: start_up"; // auto start = Time::now(); @@ -1983,15 +1977,17 @@ Status SecretChatActor::on_dh_config(NetQueryPtr query) { auth_state_.handshake.set_config(auth_state_.dh_config.g, auth_state_.dh_config.prime); return Status::OK(); } + void SecretChatActor::on_dh_config(telegram_api::messages_dhConfigNotModified &dh_not_modified) { - // TODO: use random_ + Random::add_seed(dh_not_modified.random_.as_slice()); } + void SecretChatActor::on_dh_config(telegram_api::messages_dhConfig &dh) { auto dh_config = std::make_shared(); dh_config->version = dh.version_; dh_config->prime = dh.p_.as_slice().str(); dh_config->g = dh.g_; - // TODO: use random_ + Random::add_seed(dh.random_.as_slice()); auth_state_.dh_config = *dh_config; context_->set_dh_config(dh_config); }