Fixed check g_a in encr chats
This commit is contained in:
parent
64a804ffc5
commit
b13434e378
3 changed files with 7 additions and 0 deletions
2
binlog.c
2
binlog.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue