From f11ae1983ff55ba4c0056573fc061613a8be7244 Mon Sep 17 00:00:00 2001 From: vysheng Date: Tue, 24 Dec 2013 04:57:01 +0400 Subject: [PATCH] Support for layer 11 --- constants.h | 6 ++++-- queries.c | 5 +++-- structures.c | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/constants.h b/constants.h index fbd674f..54d7372 100644 --- a/constants.h +++ b/constants.h @@ -229,8 +229,8 @@ #define CODE_update_encrypted_messages_read 0x38fe25b7 #define CODE_encrypted_chat_empty 0xab7ec0a0 #define CODE_encrypted_chat_waiting 0x3bf703dc -#define CODE_encrypted_chat_requested 0xfda9a7b7 -#define CODE_encrypted_chat 0x6601d14f +#define CODE_encrypted_chat_requested 0xc878527e +#define CODE_encrypted_chat 0xfa56ce36 #define CODE_encrypted_chat_discarded 0x13d6dd27 #define CODE_input_encrypted_chat 0xf141b5e1 #define CODE_encrypted_file_empty 0xc21f497e @@ -258,6 +258,7 @@ #define CODE_input_encrypted_file_big_uploaded 0x2dc173c8 #define CODE_update_chat_participant_add 0x3a0eeb22 #define CODE_update_chat_participant_delete 0x6e5f8c22 +#define CODE_update_dc_options 0x8e5e9873 #define CODE_input_media_uploaded_audio 0x61a6d436 #define CODE_input_media_audio 0x89938781 #define CODE_input_media_uploaded_document 0x34e794bd @@ -377,4 +378,5 @@ #define CODE_init_connection 0x69796de9 #define CODE_invoke_with_layer9 0x76715a63 #define CODE_invoke_with_layer10 0x39620c41 +#define CODE_invoke_with_layer11 0xa6b88fdf #endif diff --git a/queries.c b/queries.c index edbae9c..537c324 100644 --- a/queries.c +++ b/queries.c @@ -318,7 +318,7 @@ void out_random (int n) { int allow_send_linux_version; void do_insert_header (void) { - out_int (CODE_invoke_with_layer10); + out_int (CODE_invoke_with_layer11); out_int (CODE_init_connection); out_int (TG_APP_ID); if (allow_send_linux_version) { @@ -2422,6 +2422,7 @@ void do_send_create_encr_chat (void *x, unsigned char *random) { int get_dh_config_on_answer (struct query *q UU) { unsigned x = fetch_int (); assert (x == CODE_messages_dh_config || x == CODE_messages_dh_config_not_modified || LOG_DH_CONFIG); + logprintf ("old = %d\n", encr_param_version); if (x == CODE_messages_dh_config || x == LOG_DH_CONFIG) { int a = fetch_int (); int l = prefetch_strlen (); @@ -2432,7 +2433,7 @@ int get_dh_config_on_answer (struct query *q UU) { BIGNUM *p = BN_bin2bn ((void *)s, 256, 0); assert (check_DH_params (p, a) >= 0); - BN_free (p); + BN_free (p); } if (x == LOG_DH_CONFIG) { return 0; } int l = prefetch_strlen (); diff --git a/structures.c b/structures.c index 3c88a24..014a8e9 100644 --- a/structures.c +++ b/structures.c @@ -342,14 +342,14 @@ void fetch_encrypted_chat (struct secret_chat *U) { memcpy (g_key, s + (l - 256), 256); } - l = prefetch_strlen (); + /*l = prefetch_strlen (); s = fetch_str (l); if (l != 256) { logprintf ("l = %d\n", l); } if (l < 256) { memcpy (nonce + 256 - l, s, l); } else { memcpy (nonce, s + (l - 256), 256); - } + }*/ if (x == CODE_encrypted_chat) { fetch_long (); // fingerprint @@ -393,14 +393,14 @@ void fetch_encrypted_chat (struct secret_chat *U) { memcpy (g_key, s + (l - 256), 256); } - l = prefetch_strlen (); + /*l = prefetch_strlen (); s = fetch_str (l); if (l != 256) { logprintf ("l = %d\n", l); } if (l < 256) { memcpy (nonce + 256 - l, s, l); } else { memcpy (nonce, s + (l - 256), 256); - } + }*/ if (x == CODE_encrypted_chat_requested) { return; // Duplicate?