Core/Authserver: Authserver cleanup (PR#25093)

- Fix a handful of 1/256 bugs with most significant byte zero in BigNumber
- Get rid of (most of) the C-style arrays in authserver
- CryptoRandom as a unified source for cryptographic randomness
- Bring our other crypto APIs into 2020
- BigNumber usability improvements
- Authserver is now actually readable as a result of all of the above

(cherry picked from commit 210176fd91)
This commit is contained in:
Treeston
2020-07-26 01:53:34 +02:00
committed by Shauren
parent caa1e1171a
commit e9392ad287
49 changed files with 903 additions and 694 deletions

View File

@@ -18,6 +18,7 @@
#include "Session.h"
#include "BattlenetRpcErrorCodes.h"
#include "ByteConverter.h"
#include "CryptoRandom.h"
#include "DatabaseEnv.h"
#include "Errors.h"
#include "IPLocation.h"
@@ -386,9 +387,8 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential
if (!_ipCountry.empty())
logonResult.set_geoip_country(_ipCountry);
BigNumber k;
k.SetRand(8 * 64);
logonResult.set_session_key(k.AsByteArray(64).get(), 64);
std::array<uint8, 64> k = Trinity::Crypto::GetRandomBytes<64>();
logonResult.set_session_key(k.data(), 64);
_authed = true;