Commit 2ddd7a1d authored by Vysheng's avatar Vysheng

Fixed check g_a in encr chats

parent efc7673a
......@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <openssl/bn.h>
#include "binlog.h"
#include "mtproto-common.h"
......@@ -525,6 +526,7 @@ void replay_log_event (void) {
memcpy (encr_prime, rptr, 256);
rptr += 64;
encr_param_version = *(rptr ++);
}
break;
case CODE_binlog_encr_chat_init:
......
......@@ -20,9 +20,12 @@
#ifndef __MTPROTO_CLIENT_H__
#define __MTPROTO_CLIENT_H__
#include "net.h"
#include <openssl/bn.h>
void on_start (void);
long long encrypt_send_message (struct connection *c, int *msg, int msg_ints, int useful);
void dc_authorize (struct dc *DC);
void work_update (struct connection *c, long long msg_id);
void work_update_binlog (void);
int check_g (BIGNUM *g);
int check_DH_params (BIGNUM *p, int g);
#endif
......@@ -2270,6 +2270,7 @@ void do_send_accept_encr_chat (struct secret_chat *E, unsigned char *random) {
assert (b);
BIGNUM *g_a = BN_bin2bn (E->g_key, 256, 0);
assert (g_a);
assert (check_g (g_a) >= 0);
if (!ctx) {
ctx = BN_CTX_new ();
BN_CTX_init (ctx);
......@@ -2315,6 +2316,7 @@ void do_create_keys_end (struct secret_chat *U) {
assert (encr_prime);
BIGNUM *g_b = BN_bin2bn (U->g_key, 256, 0);
assert (g_b);
assert (check_g (g_b) >= 0);
if (!ctx) {
ctx = BN_CTX_new ();
BN_CTX_init (ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment