diff --git a/benchmark/bench_handshake.cpp b/benchmark/bench_handshake.cpp index e57c78dbb..d56840a2c 100644 --- a/benchmark/bench_handshake.cpp +++ b/benchmark/bench_handshake.cpp @@ -6,6 +6,7 @@ // #include "td/utils/benchmark.h" +#include "td/mtproto/DhCallback.h" #include "td/mtproto/DhHandshake.h" #include "td/utils/base64.h" diff --git a/td/mtproto/DhCallback.h b/td/mtproto/DhCallback.h new file mode 100644 index 000000000..c26cd50e4 --- /dev/null +++ b/td/mtproto/DhCallback.h @@ -0,0 +1,29 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#pragma once + +#include "td/utils/Slice.h" + +namespace td { +namespace mtproto { + +class DhCallback { + public: + DhCallback() = default; + DhCallback(const DhCallback &) = delete; + DhCallback &operator=(const DhCallback &) = delete; + DhCallback(DhCallback &&) = delete; + DhCallback &operator=(DhCallback &&) = delete; + virtual ~DhCallback() = default; + + virtual int is_good_prime(Slice prime_str) const = 0; + virtual void add_good_prime(Slice prime_str) const = 0; + virtual void add_bad_prime(Slice prime_str) const = 0; +}; + +} // namespace mtproto +} // namespace td diff --git a/td/mtproto/DhHandshake.cpp b/td/mtproto/DhHandshake.cpp index 1b976c391..dfcdea28a 100644 --- a/td/mtproto/DhHandshake.cpp +++ b/td/mtproto/DhHandshake.cpp @@ -6,6 +6,8 @@ // #include "td/mtproto/DhHandshake.h" +#include "td/mtproto/DhCallback.h" + #include "td/utils/as.h" #include "td/utils/crypto.h" #include "td/utils/logging.h" diff --git a/td/mtproto/DhHandshake.h b/td/mtproto/DhHandshake.h index 3bc7cea7a..8a2a24fc3 100644 --- a/td/mtproto/DhHandshake.h +++ b/td/mtproto/DhHandshake.h @@ -16,19 +16,7 @@ namespace td { namespace mtproto { -class DhCallback { - public: - DhCallback() = default; - DhCallback(const DhCallback &) = delete; - DhCallback &operator=(const DhCallback &) = delete; - DhCallback(DhCallback &&) = delete; - DhCallback &operator=(DhCallback &&) = delete; - virtual ~DhCallback() = default; - - virtual int is_good_prime(Slice prime_str) const = 0; - virtual void add_good_prime(Slice prime_str) const = 0; - virtual void add_bad_prime(Slice prime_str) const = 0; -}; +class DhCallback; class DhHandshake { public: diff --git a/td/mtproto/Handshake.cpp b/td/mtproto/Handshake.cpp index 62d4be2e1..30d8ed5bc 100644 --- a/td/mtproto/Handshake.cpp +++ b/td/mtproto/Handshake.cpp @@ -6,6 +6,7 @@ // #include "td/mtproto/Handshake.h" +#include "td/mtproto/DhHandshake.h" #include "td/mtproto/KDF.h" #include "td/mtproto/mtproto_api.h" #include "td/mtproto/utils.h" diff --git a/td/mtproto/Handshake.h b/td/mtproto/Handshake.h index b09e345e2..ae94e8853 100644 --- a/td/mtproto/Handshake.h +++ b/td/mtproto/Handshake.h @@ -7,7 +7,6 @@ #pragma once #include "td/mtproto/AuthKey.h" -#include "td/mtproto/DhHandshake.h" #include "td/mtproto/RSA.h" #include "td/utils/buffer.h" @@ -24,6 +23,8 @@ class Object; namespace mtproto { +class DhCallback; + class AuthKeyHandshakeContext { public: virtual ~AuthKeyHandshakeContext() = default; diff --git a/td/telegram/DhCache.h b/td/telegram/DhCache.h index 3e7310e20..a34c07d5a 100644 --- a/td/telegram/DhCache.h +++ b/td/telegram/DhCache.h @@ -6,7 +6,7 @@ // #pragma once -#include "td/mtproto/DhHandshake.h" +#include "td/mtproto/DhCallback.h" #include "td/utils/Slice.h" diff --git a/td/telegram/SecretChatActor.h b/td/telegram/SecretChatActor.h index 846fefdaa..73905a52d 100644 --- a/td/telegram/SecretChatActor.h +++ b/td/telegram/SecretChatActor.h @@ -19,6 +19,7 @@ #include "td/telegram/UserId.h" #include "td/mtproto/AuthKey.h" +#include "td/mtproto/DhCallback.h" #include "td/mtproto/DhHandshake.h" #include "td/actor/actor.h" diff --git a/td/telegram/SecretChatsManager.cpp b/td/telegram/SecretChatsManager.cpp index 6c40929f7..1e1c1c13f 100644 --- a/td/telegram/SecretChatsManager.cpp +++ b/td/telegram/SecretChatsManager.cpp @@ -22,7 +22,7 @@ #include "td/telegram/secret_api.h" #include "td/telegram/telegram_api.hpp" -#include "td/mtproto/DhHandshake.h" +#include "td/mtproto/DhCallback.h" #include "td/actor/PromiseFuture.h" diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 5a1fc9035..c1909c50d 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -114,7 +114,7 @@ #include "td/db/binlog/BinlogEvent.h" -#include "td/mtproto/DhHandshake.h" +#include "td/mtproto/DhCallback.h" #include "td/mtproto/Handshake.h" #include "td/mtproto/HandshakeActor.h" #include "td/mtproto/RawConnection.h" diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index 0c05a5b01..55ab6bd96 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -20,7 +20,7 @@ #include "td/telegram/StateManager.h" #include "td/telegram/UniqueId.h" -#include "td/mtproto/DhHandshake.h" +#include "td/mtproto/DhCallback.h" #include "td/mtproto/Handshake.h" #include "td/mtproto/HandshakeActor.h" #include "td/mtproto/RawConnection.h" diff --git a/test/mtproto.cpp b/test/mtproto.cpp index 369ea7aea..85ce334a9 100644 --- a/test/mtproto.cpp +++ b/test/mtproto.cpp @@ -11,6 +11,7 @@ #include "td/telegram/NotificationManager.h" #include "td/mtproto/AuthData.h" +#include "td/mtproto/DhCallback.h" #include "td/mtproto/DhHandshake.h" #include "td/mtproto/Handshake.h" #include "td/mtproto/HandshakeActor.h" diff --git a/test/secret.cpp b/test/secret.cpp index 4bf32ddfc..db6794f3a 100644 --- a/test/secret.cpp +++ b/test/secret.cpp @@ -22,7 +22,7 @@ #include "td/db/BinlogKeyValue.h" #include "td/db/DbKey.h" -#include "td/mtproto/DhHandshake.h" +#include "td/mtproto/DhCallback.h" #include "td/mtproto/utils.h" #include "td/tl/tl_object_parse.h"