1/*
2 This file is part of Mtproto-proxy Library.
3
4 Mtproto-proxy Library is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 Mtproto-proxy Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with Mtproto-proxy Library. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright 2014 Telegram Messenger Inc
18 2014 Nikolai Durov
19 2014 Andrey Lopatin
20*/
21
22#pragma once
23
24#define CRYPTO_TEMP_DH_PARAMS_MAGIC 0xab45ccd3
25
26struct crypto_temp_dh_params {
27 int magic;
28 int dh_params_select;
29 unsigned char a[256];
30};
31
32extern int dh_params_select;
33
34int init_dh_params (void); // result: 1 = OK, 0 = already done, -1 = error
35int dh_first_round (unsigned char g_a[256], struct crypto_temp_dh_params *dh_params);
36int dh_second_round (unsigned char g_ab[256], unsigned char g_a[256], const unsigned char g_b[256]);
37int dh_third_round (unsigned char g_ab[256], const unsigned char g_b[256], struct crypto_temp_dh_params *dh_params);
38
39void fetch_tot_dh_rounds_stat (long long _tot_dh_rounds[3]);
40