mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-24 02:19:41 +00:00
Switch to static local/accessor pattern to avoid initialization order issues amoung translation units
This commit is contained in:
parent
b27ca38ad7
commit
3caada0a9e
10
test.cpp
10
test.cpp
@ -149,9 +149,9 @@ static const DebugTrapHandler g_dummyHandler;
|
||||
#endif // __GNUC__
|
||||
#endif // CRYPTOPP_UNIX_AVAILABLE and not NDEBUG
|
||||
|
||||
static OFB_Mode<AES>::Encryption s_globalRNG;
|
||||
RandomNumberGenerator & GlobalRNG()
|
||||
{
|
||||
static OFB_Mode<AES>::Encryption s_globalRNG;
|
||||
return s_globalRNG;
|
||||
}
|
||||
|
||||
@ -178,7 +178,9 @@ int CRYPTOPP_API main(int argc, char *argv[])
|
||||
|
||||
std::string seed = IntToString(time(NULL));
|
||||
seed.resize(16);
|
||||
s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data());
|
||||
|
||||
OFB_Mode<AES>::Encryption& prng = static_cast<OFB_Mode<AES>::Encryption&>(GlobalRNG());
|
||||
prng.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data());
|
||||
|
||||
std::string command, executableName, macFilename;
|
||||
|
||||
@ -828,7 +830,9 @@ bool Validate(int alg, bool thorough, const char *seedInput)
|
||||
seed.resize(16);
|
||||
|
||||
std::cout << "Using seed: " << seed << std::endl;
|
||||
s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data());
|
||||
|
||||
OFB_Mode<AES>::Encryption& prng = static_cast<OFB_Mode<AES>::Encryption&>(GlobalRNG());
|
||||
prng.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data());
|
||||
|
||||
#ifdef _OPENMP
|
||||
int tc = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user