fixed last commit
This commit is contained in:
parent
50a92dc44a
commit
d2a6fa4d6d
@ -345,12 +345,12 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||
}
|
||||
|
||||
BigInteger p = new BigInteger(1, dhInnerData.dh_prime);
|
||||
BigInteger g_b = BigInteger.valueOf(dhInnerData.g);
|
||||
BigInteger g_a = new BigInteger(1, dhInnerData.g_a);
|
||||
if (!Utilities.isGoodGaAndGb(g_a, g_b, p)) {
|
||||
if (!Utilities.isGoodGaAndGb(g_a, p)) {
|
||||
throw new RuntimeException("bad prime");
|
||||
}
|
||||
|
||||
BigInteger g_b = BigInteger.valueOf(dhInnerData.g);
|
||||
g_b = g_b.modPow(new BigInteger(1, b), p);
|
||||
g_a = g_a.modPow(new BigInteger(1, b), p);
|
||||
|
||||
|
@ -4814,7 +4814,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
BigInteger p = new BigInteger(1, MessagesStorage.secretPBytes);
|
||||
BigInteger i_authKey = new BigInteger(1, encryptedChat.g_a_or_b);
|
||||
|
||||
if (!Utilities.isGoodGaAndGb(null, i_authKey, p)) {
|
||||
if (!Utilities.isGoodGaAndGb(i_authKey, p)) {
|
||||
declineSecretChat(encryptedChat.id);
|
||||
return;
|
||||
}
|
||||
@ -4911,7 +4911,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
g_b = g_b.modPow(new BigInteger(1, salt), p);
|
||||
BigInteger g_a = new BigInteger(1, encryptedChat.g_a);
|
||||
|
||||
if (!Utilities.isGoodGaAndGb(g_a, g_b, p)) {
|
||||
if (!Utilities.isGoodGaAndGb(g_a, p)) {
|
||||
acceptingChats.remove(encryptedChat.id);
|
||||
declineSecretChat(encryptedChat.id);
|
||||
return;
|
||||
|
@ -124,14 +124,8 @@ public class Utilities {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isGoodGaAndGb(BigInteger g_a, BigInteger g_b, BigInteger p) {
|
||||
if (g_a != null && g_a.compareTo(BigInteger.valueOf(1)) != 1) {
|
||||
return false;
|
||||
}
|
||||
if (g_b != null && p != null && g_b.compareTo(p.subtract(BigInteger.valueOf(1))) != -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
public static boolean isGoodGaAndGb(BigInteger g_a, BigInteger p) {
|
||||
return !(g_a.compareTo(BigInteger.valueOf(1)) != 1 || g_a.compareTo(p.subtract(BigInteger.valueOf(1))) != -1);
|
||||
}
|
||||
|
||||
public static TPFactorizedValue getFactorizedValue(long what) {
|
||||
|
Loading…
Reference in New Issue
Block a user