2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix crash in RSA public key wrapper.

This commit is contained in:
John Preston
2017-12-07 09:34:11 +04:00
parent f813bb704f
commit 007ab3b7b8
3 changed files with 40 additions and 14 deletions

View File

@@ -154,7 +154,10 @@ bool IsPrimeAndGood(base::const_byte_span primeBytes, int g) {
return IsPrimeAndGoodCheck(openssl::BigNum(primeBytes), g);
}
std::vector<gsl::byte> CreateAuthKey(base::const_byte_span firstBytes, base::const_byte_span randomBytes, base::const_byte_span primeBytes) {
std::vector<gsl::byte> CreateAuthKey(
base::const_byte_span firstBytes,
base::const_byte_span randomBytes,
base::const_byte_span primeBytes) {
using openssl::BigNum;
BigNum first(firstBytes);
BigNum prime(primeBytes);
@@ -165,7 +168,10 @@ std::vector<gsl::byte> CreateAuthKey(base::const_byte_span firstBytes, base::con
return BigNum::ModExp(first, BigNum(randomBytes), prime).getBytes();
}
ModExpFirst CreateModExp(int g, base::const_byte_span primeBytes, base::const_byte_span randomSeed) {
ModExpFirst CreateModExp(
int g,
base::const_byte_span primeBytes,
base::const_byte_span randomSeed) {
Expects(randomSeed.size() == ModExpFirst::kRandomPowerSize);
using namespace openssl;