aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-05 12:46:18 +0000
committerlloyd <[email protected]>2008-09-05 12:46:18 +0000
commite292d9c1263fc74c26b26b9bd6f879ab25cc19ee (patch)
tree73953a1061223fc65e9236d232caf04bbc5a1aa4 /checks/pk.cpp
parenta8973ceb0c0f70e67e30b1c36e4ed833bc158445 (diff)
Use the Timer class for all benchmarking
Diffstat (limited to 'checks/pk.cpp')
-rw-r--r--checks/pk.cpp76
1 files changed, 42 insertions, 34 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index 263f8e090..7a8f821fa 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -612,40 +612,48 @@ u32bit do_pk_validation_tests(const std::string& filename,
u32bit new_errors = 0;
- if(algorithm.find("DSA/") != std::string::npos)
- new_errors = validate_dsa_sig(algorithm, substr, rng);
- else if(algorithm.find("DSA_VA/") != std::string::npos)
- new_errors = validate_dsa_ver(algorithm, substr);
-
- else if(algorithm.find("RSAES_PKCS8/") != std::string::npos)
- new_errors = validate_rsa_enc_pkcs8(algorithm, substr, rng);
- else if(algorithm.find("RSAVA_X509/") != std::string::npos)
- new_errors = validate_rsa_ver_x509(algorithm, substr);
-
- else if(algorithm.find("RSAES/") != std::string::npos)
- new_errors = validate_rsa_enc(algorithm, substr, rng);
- else if(algorithm.find("RSASSA/") != std::string::npos)
- new_errors = validate_rsa_sig(algorithm, substr, rng);
- else if(algorithm.find("RSAVA/") != std::string::npos)
- new_errors = validate_rsa_ver(algorithm, substr);
- else if(algorithm.find("RWVA/") != std::string::npos)
- new_errors = validate_rw_ver(algorithm, substr);
- else if(algorithm.find("RW/") != std::string::npos)
- new_errors = validate_rw_sig(algorithm, substr, rng);
- else if(algorithm.find("NR/") != std::string::npos)
- new_errors = validate_nr_sig(algorithm, substr, rng);
- else if(algorithm.find("ElGamal/") != std::string::npos)
- new_errors = validate_elg_enc(algorithm, substr, rng);
- else if(algorithm.find("DH/") != std::string::npos)
- new_errors = validate_dh(algorithm, substr, rng);
- else if(algorithm.find("DLIES/") != std::string::npos)
- new_errors = validate_dlies(algorithm, substr, rng);
- else
- std::cout << "WARNING: Unknown PK algorithm "
- << algorithm << std::endl;
-
- alg_count++;
- errors += new_errors;
+ try
+ {
+
+ if(algorithm.find("DSA/") != std::string::npos)
+ new_errors = validate_dsa_sig(algorithm, substr, rng);
+ else if(algorithm.find("DSA_VA/") != std::string::npos)
+ new_errors = validate_dsa_ver(algorithm, substr);
+
+ else if(algorithm.find("RSAES_PKCS8/") != std::string::npos)
+ new_errors = validate_rsa_enc_pkcs8(algorithm, substr, rng);
+ else if(algorithm.find("RSAVA_X509/") != std::string::npos)
+ new_errors = validate_rsa_ver_x509(algorithm, substr);
+
+ else if(algorithm.find("RSAES/") != std::string::npos)
+ new_errors = validate_rsa_enc(algorithm, substr, rng);
+ else if(algorithm.find("RSASSA/") != std::string::npos)
+ new_errors = validate_rsa_sig(algorithm, substr, rng);
+ else if(algorithm.find("RSAVA/") != std::string::npos)
+ new_errors = validate_rsa_ver(algorithm, substr);
+ else if(algorithm.find("RWVA/") != std::string::npos)
+ new_errors = validate_rw_ver(algorithm, substr);
+ else if(algorithm.find("RW/") != std::string::npos)
+ new_errors = validate_rw_sig(algorithm, substr, rng);
+ else if(algorithm.find("NR/") != std::string::npos)
+ new_errors = validate_nr_sig(algorithm, substr, rng);
+ else if(algorithm.find("ElGamal/") != std::string::npos)
+ new_errors = validate_elg_enc(algorithm, substr, rng);
+ else if(algorithm.find("DH/") != std::string::npos)
+ new_errors = validate_dh(algorithm, substr, rng);
+ else if(algorithm.find("DLIES/") != std::string::npos)
+ new_errors = validate_dlies(algorithm, substr, rng);
+ else
+ std::cout << "WARNING: Unknown PK algorithm "
+ << algorithm << std::endl;
+
+ alg_count++;
+ errors += new_errors;
+ }
+ catch(std::exception& e)
+ {
+ std::cout << "Exception: " << e.what() << "\n";
+ }
if(new_errors)
std::cout << "ERROR: \"" << algorithm << "\" failed test #"