aboutsummaryrefslogtreecommitdiffhomepage
path: root/benchmark/check_tls.cpp
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2019-08-22 23:09:49 +0300
committerlevlam <levlam@telegram.org>2019-08-22 23:09:49 +0300
commitd02f0ffba91e41d917e53ecbc7bdb65fc9eb84ed (patch)
tree59cef93cd2bead539938c5caeab9cb41e171760e /benchmark/check_tls.cpp
parent2e8ec529e93e64dc3c8972cd1f420cb058cb5959 (diff)
TlsInit: better X25519 key generation.
GitOrigin-RevId: b7efb4bfd1d285a54292e5733c855d7693419af1
Diffstat (limited to 'benchmark/check_tls.cpp')
-rw-r--r--benchmark/check_tls.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/benchmark/check_tls.cpp b/benchmark/check_tls.cpp
index a7eb768e2..7ff1a1466 100644
--- a/benchmark/check_tls.cpp
+++ b/benchmark/check_tls.cpp
@@ -21,6 +21,8 @@
#include <map>
+static td::BigNumContext context;
+
static bool is_quadratic_residue(const td::BigNum &a) {
// 2^255 - 19
td::BigNum mod =
@@ -29,13 +31,12 @@ static bool is_quadratic_residue(const td::BigNum &a) {
td::BigNum pow =
td::BigNum::from_hex("3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6").move_as_ok();
- static td::BigNumContext context;
td::BigNum r;
td::BigNum::mod_exp(r, a, pow, mod, context);
td::BigNum one = td::BigNum::from_decimal("1").move_as_ok();
td::BigNum::mod_add(r, r, one, mod, context);
- std::string result = r.to_decimal();
+ td::string result = r.to_decimal();
CHECK(result == "0" || result == "1" || result == "2");
return result == "2";
}
@@ -64,7 +65,6 @@ td::Result<TlsInfo> test_tls(const td::string &url) {
};
auto add_key = [&] {
td::string key(32, '\0');
- td::BigNumContext context;
td::BigNum mod =
td::BigNum::from_hex("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed").move_as_ok();
while (true) {