summaryrefslogtreecommitdiff
path: root/bench2.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-07-06 09:23:37 -0400
committerGitHub <noreply@github.com>2018-07-06 09:23:37 -0400
commitb74a6f444568e59a7766d1e286f82d2ce3086dcd (patch)
tree97937fe23f742f6c352f39e206b7ce7d774ba358 /bench2.cpp
parent6d9047b444731175e6ea9a447a3f0002685804be (diff)
downloadcryptopp-git-b74a6f444568e59a7766d1e286f82d2ce3086dcd.tar.gz
Add algorithm provider member function to Algorithm class
Diffstat (limited to 'bench2.cpp')
-rw-r--r--bench2.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/bench2.cpp b/bench2.cpp
index d38391ea..b6ca0b68 100644
--- a/bench2.cpp
+++ b/bench2.cpp
@@ -40,7 +40,7 @@
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_BEGIN(Test)
-void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false)
+void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc = false)
{
unsigned int len = 16;
SecByteBlock plaintext(len), ciphertext(key.CiphertextLength(len));
@@ -59,7 +59,8 @@ void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal,
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Encryption", pc, i, timeTaken);
+ std::string provider = key.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Encryption", pc, i, timeTaken);
if (!pc && key.GetMaterial().SupportsPrecomputation())
{
@@ -89,7 +90,8 @@ void BenchMarkDecryption(const char *name, PK_Decryptor &priv, PK_Encryptor &pub
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Decryption", false, i, timeTaken);
+ std::string provider = priv.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Decryption", false, i, timeTaken);
}
void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool pc=false)
@@ -111,7 +113,8 @@ void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool p
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Signature", pc, i, timeTaken);
+ std::string provider = key.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Signature", pc, i, timeTaken);
if (!pc && key.GetMaterial().SupportsPrecomputation())
{
@@ -140,7 +143,8 @@ void BenchMarkVerification(const char *name, const PK_Signer &priv, PK_Verifier
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Verification", pc, i, timeTaken);
+ std::string provider = pub.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Verification", pc, i, timeTaken);
if (!pc && pub.GetMaterial().SupportsPrecomputation())
{
@@ -166,7 +170,8 @@ void BenchMarkKeyGen(const char *name, SimpleKeyAgreementDomain &d, double timeT
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken);
+ std::string provider = d.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Key-Pair Generation", pc, i, timeTaken);
if (!pc && d.GetMaterial().SupportsPrecomputation())
{
@@ -192,7 +197,8 @@ void BenchMarkKeyGen(const char *name, AuthenticatedKeyAgreementDomain &d, doubl
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken);
+ std::string provider = d.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Key-Pair Generation", pc, i, timeTaken);
if (!pc && d.GetMaterial().SupportsPrecomputation())
{
@@ -223,7 +229,8 @@ void BenchMarkAgreement(const char *name, SimpleKeyAgreementDomain &d, double ti
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Key Agreement", pc, i, timeTaken);
+ std::string provider = d.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Key Agreement", pc, i, timeTaken);
}
void BenchMarkAgreement(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false)
@@ -252,7 +259,8 @@ void BenchMarkAgreement(const char *name, AuthenticatedKeyAgreementDomain &d, do
}
while (timeTaken < timeTotal);
- OutputResultOperations(name, "Key Agreement", pc, i, timeTaken);
+ std::string provider = d.AlgorithmProvider();
+ OutputResultOperations(name, provider.c_str(), "Key Agreement", pc, i, timeTaken);
}
template <class SCHEME>
@@ -299,7 +307,7 @@ void Benchmark3(double t, double hertz)
std::cout << "\n<COLGROUP><COL style=\"text-align: left;\"><COL style=";
std::cout << "\"text-align: right;\"><COL style=\"text-align: right;\">";
std::cout << "\n<THEAD style=\"background: #F0F0F0\">";
- std::cout << "\n<TR><TH>Operation<TH>Milliseconds/Operation" << mco;
+ std::cout << "\n<TR><TH>Operation<TH>Provider<TH>Milliseconds/Operation" << mco;
std::cout << "\n<TBODY style=\"background: white;\">";
{