Commit 9cebc24d authored by Vysheng's avatar Vysheng

mtproto-client: fixed bad bignum pad

parent ce1d3a13
...@@ -506,7 +506,7 @@ int tglmp_check_g (unsigned char p[256], BIGNUM *g) { ...@@ -506,7 +506,7 @@ int tglmp_check_g (unsigned char p[256], BIGNUM *g) {
static unsigned char s[256]; static unsigned char s[256];
memset (s, 0, 256); memset (s, 0, 256);
assert (BN_num_bytes (g) <= 256); assert (BN_num_bytes (g) <= 256);
BN_bn2bin (g, s); BN_bn2bin (g, s + (256 - BN_num_bytes (g)));
int ok = 0; int ok = 0;
int i; int i;
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
...@@ -541,7 +541,7 @@ int tglmp_check_g (unsigned char p[256], BIGNUM *g) { ...@@ -541,7 +541,7 @@ int tglmp_check_g (unsigned char p[256], BIGNUM *g) {
int tglmp_check_g_bn (BIGNUM *p, BIGNUM *g) { int tglmp_check_g_bn (BIGNUM *p, BIGNUM *g) {
static unsigned char s[256]; static unsigned char s[256];
memset (s, 0, 256); memset (s, 0, 256);
assert (BN_num_bytes (p) <= 256); assert (BN_num_bytes (p) == 256);
BN_bn2bin (p, s); BN_bn2bin (p, s);
return tglmp_check_g (s, g); return tglmp_check_g (s, g);
} }
......
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