diff options
author | lloyd <[email protected]> | 2015-02-05 04:44:06 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-02-05 04:44:06 +0000 |
commit | 9d8f4cf1e81322ca7290b6551b82d4943dfa62a0 (patch) | |
tree | 89bb62a0e4dbc58dea425ea634bedf1d6eab7a65 /src/cmd/speed.cpp | |
parent | fde85db0ec7b31d3d8a2cb1c13b2ef1e3a3205a4 (diff) |
Enable OpenSSL for providing ciphers and hashes again.
Diffstat (limited to 'src/cmd/speed.cpp')
-rw-r--r-- | src/cmd/speed.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/cmd/speed.cpp b/src/cmd/speed.cpp index 7e8dbd412..185105ee2 100644 --- a/src/cmd/speed.cpp +++ b/src/cmd/speed.cpp @@ -120,9 +120,6 @@ void report_results(const std::string& algo, void time_transform(std::unique_ptr<Transform> tf, RandomNumberGenerator& rng) { - if(!tf) - return; - const std::chrono::seconds runtime(2); for(size_t buf_size : { 16, 64, 256, 1024, 8192 }) @@ -156,15 +153,18 @@ void time_transform(std::unique_ptr<Transform> tf, } } -void time_transform(const std::string& algo, RandomNumberGenerator& rng) +bool time_transform(const std::string& algo, RandomNumberGenerator& rng) { std::unique_ptr<Transform> tf; tf.reset(get_cipher_mode(algo, ENCRYPTION)); + if(!tf) + return false; if(Keyed_Transform* keyed = dynamic_cast<Keyed_Transform*>(tf.get())) keyed->set_key(rng.random_vec(keyed->key_spec().maximum_keylength())); time_transform(std::move(tf), rng); + return true; } void bench_algo(const std::string& algo, @@ -175,15 +175,18 @@ void bench_algo(const std::string& algo, std::chrono::milliseconds ms( static_cast<std::chrono::milliseconds::rep>(seconds * 1000)); - std::map<std::string, double> speeds = algorithm_benchmark(algo, rng, ms, buf_size); + if(time_transform(algo, rng)) + return; - report_results(algo, speeds); + std::map<std::string, double> speeds = algorithm_benchmark(algo, rng, ms, buf_size); - if(speeds.empty()) - time_transform(algo, rng); + if(!speeds.empty()) + { + report_results(algo, speeds); + return; + } - if(speeds.empty()) - bench_pk(rng, algo, seconds); + bench_pk(rng, algo, seconds); } int speed(int argc, char* argv[]) |