Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvvaltman <vvaltman@neon>2014-12-15 19:12:41 +0300
committervvaltman <vvaltman@neon>2014-12-15 19:12:41 +0300
commitdaeb8871918945bf18e64523d879e5a0c17dc419 (patch)
treec91d9bf74753df5d56c20db44343885838e497a9
parent09b88339bacb0acc9a5efa2550e5cd12e9be2b07 (diff)
fixed problems
-rw-r--r--mtproto-client.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mtproto-client.c b/mtproto-client.c
index 533de27..df870da 100644
--- a/mtproto-client.c
+++ b/mtproto-client.c
@@ -591,12 +591,21 @@ static int process_auth_complete (struct tgl_state *TLS, struct connection *c, c
vlogprintf (E_ERROR, "nonce mismatch\n");
return -1;
}
+ if (op != CODE_dh_gen_ok) {
+ vlogprintf (E_ERROR, "something bad. Retry regen\n");
+ return -1;
+ }
fetch_ints (tmp, 4);
static unsigned char th[44], sha1_buffer[20];
memcpy (th, DC->new_nonce, 32);
th[32] = 1;
+ if (!temp_key) {
+ sha1 ((unsigned char *)DC->auth_key, 256, sha1_buffer);
+ } else {
+ sha1 ((unsigned char *)DC->temp_auth_key, 256, sha1_buffer);
+ }
memcpy (th + 33, sha1_buffer, 8);
sha1 (th, 41, sha1_buffer);
if (memcmp (tmp, sha1_buffer + 4, 16)) {