From 210176fd915cf4ba16f428d3c1a249a71f4aa7a7 Mon Sep 17 00:00:00 2001 From: Treeston Date: Sun, 26 Jul 2020 01:53:34 +0200 Subject: 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 --- src/server/scripts/Commands/cs_account.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 9b87179aa7d..aec025e0301 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "Base32.h" #include "Chat.h" #include "CryptoGenerics.h" +#include "CryptoRandom.h" #include "DatabaseEnv.h" #include "IpAddress.h" #include "IPLocation.h" @@ -39,7 +40,6 @@ EndScriptData */ #include "World.h" #include "WorldSession.h" #include -#include using namespace Trinity::ChatCommands; @@ -131,7 +131,7 @@ public: static std::unordered_map suggestions; auto pair = suggestions.emplace(std::piecewise_construct, std::make_tuple(accountId), std::make_tuple(Trinity::Crypto::TOTP::RECOMMENDED_SECRET_LENGTH)); // std::vector 1-argument size_t constructor invokes resize if (pair.second) // no suggestion yet, generate random secret - RAND_bytes(pair.first->second.data(), pair.first->second.size()); + Trinity::Crypto::GetRandomBytes(pair.first->second); if (!pair.second && token) // suggestion already existed and token specified - validate { -- cgit v1.2.3