mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Add AES/OFB RNG benchmark
This commit is contained in:
parent
76377f8219
commit
c2efbae80a
11
bench1.cpp
11
bench1.cpp
@ -200,6 +200,16 @@ void BenchMark(const char *name, RandomNumberGenerator &rng, double timeTotal)
|
||||
Test::GlobalRNG().GenerateBlock(buf, BUF_SIZE);
|
||||
buf.SetMark(16);
|
||||
|
||||
SymmetricCipher * cipher = dynamic_cast<SymmetricCipher*>(&rng);
|
||||
if (cipher != NULLPTR)
|
||||
{
|
||||
const size_t size = cipher->DefaultKeyLength();
|
||||
if (cipher->IsResynchronizable())
|
||||
cipher->SetKeyWithIV(buf, size, buf+size);
|
||||
else
|
||||
cipher->SetKey(buf, size);
|
||||
}
|
||||
|
||||
unsigned long long blocks = 1;
|
||||
double timeTaken;
|
||||
|
||||
@ -406,6 +416,7 @@ void Benchmark1(double t, double hertz)
|
||||
if (HasRDSEED())
|
||||
BenchMarkByNameKeyLess<RandomNumberGenerator>("RDSEED");
|
||||
#endif
|
||||
BenchMarkByNameKeyLess<RandomNumberGenerator>("AES/OFB RNG");
|
||||
BenchMarkByNameKeyLess<NIST_DRBG>("Hash_DRBG(SHA1)");
|
||||
BenchMarkByNameKeyLess<NIST_DRBG>("Hash_DRBG(SHA256)");
|
||||
BenchMarkByNameKeyLess<NIST_DRBG>("HMAC_DRBG(SHA1)");
|
||||
|
@ -210,6 +210,7 @@ void RegisterFactories()
|
||||
if (HasRDSEED())
|
||||
RegisterDefaultFactoryFor<RandomNumberGenerator, RDSEED>();
|
||||
#endif
|
||||
RegisterDefaultFactoryFor<RandomNumberGenerator, OFB_Mode<AES>::Encryption >("AES/OFB RNG");
|
||||
RegisterDefaultFactoryFor<NIST_DRBG, Hash_DRBG<SHA1> >("Hash_DRBG(SHA1)");
|
||||
RegisterDefaultFactoryFor<NIST_DRBG, Hash_DRBG<SHA256> >("Hash_DRBG(SHA256)");
|
||||
RegisterDefaultFactoryFor<NIST_DRBG, HMAC_DRBG<SHA1> >("HMAC_DRBG(SHA1)");
|
||||
|
Loading…
Reference in New Issue
Block a user