diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index ef4d4f7f5..d056f34bc 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2534,6 +2534,12 @@ int main(int argc, const char **argv) // ignore_convention } } + if(secure_random_init() != 0) + { + dbg_msg("secure", "could not initialize secure RNG"); + return -1; + } + CClient *pClient = CreateClient(); IKernel *pKernel = IKernel::Create(); pKernel->RegisterInterface(pClient); diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 0ac0ee996..de65f083e 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1778,11 +1778,10 @@ int main(int argc, const char **argv) // ignore_convention } } - bool SkipPWGen = false; if(secure_random_init() != 0) { dbg_msg("secure", "could not initialize secure RNG"); - SkipPWGen = true; // skip automatic password generation + return -1; } CServer *pServer = CreateServer(); @@ -1841,8 +1840,7 @@ int main(int argc, const char **argv) // ignore_convention pEngine->InitLogfile(); - if(!SkipPWGen) - pServer->InitRconPasswordIfUnset(); + pServer->InitRconPasswordIfUnset(); // run the server dbg_msg("server", "starting..."); diff --git a/src/engine/shared/network_token.cpp b/src/engine/shared/network_token.cpp index bbed8a1ac..e68417b2b 100644 --- a/src/engine/shared/network_token.cpp +++ b/src/engine/shared/network_token.cpp @@ -77,11 +77,7 @@ void CNetTokenManager::GenerateSeed() static const NETADDR NullAddr = { 0 }; m_PrevSeed = m_Seed; - for(int i = 0; i < 2; i++) - { - m_Seed <<= 32; - m_Seed ^= random_int(); - } + secure_random_fill(&m_Seed, sizeof(m_Seed)); m_PrevGlobalToken = m_GlobalToken; m_GlobalToken = GenerateToken(&NullAddr);