aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc/benchmark/benchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/misc/benchmark/benchmark.cpp')
-rw-r--r--src/lib/misc/benchmark/benchmark.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/lib/misc/benchmark/benchmark.cpp b/src/lib/misc/benchmark/benchmark.cpp
index 152b45d37..d5e3694b5 100644
--- a/src/lib/misc/benchmark/benchmark.cpp
+++ b/src/lib/misc/benchmark/benchmark.cpp
@@ -7,7 +7,6 @@
#include <botan/benchmark.h>
#include <botan/exceptn.h>
-#include <botan/lookup.h>
#include <botan/buf_comp.h>
#include <botan/cipher_mode.h>
#include <botan/block_cipher.h>
@@ -56,10 +55,8 @@ time_algorithm_ops(const std::string& name,
const double mb_mult = buffer.size() / static_cast<double>(Mebibyte);
- if(BlockCipher* p = get_block_cipher(name, provider))
+ if(auto bc = BlockCipher::create(name, provider))
{
- std::unique_ptr<BlockCipher> bc(p);
-
const SymmetricKey key(rng, bc->maximum_keylength());
return std::map<std::string, double>({
@@ -68,10 +65,8 @@ time_algorithm_ops(const std::string& name,
{ "decrypt", mb_mult * time_op(runtime / 2, [&]() { bc->decrypt(buffer); }) },
});
}
- else if(StreamCipher* p = get_stream_cipher(name, provider))
+ else if(auto sc = StreamCipher::create(name, provider))
{
- std::unique_ptr<StreamCipher> sc(p);
-
const SymmetricKey key(rng, sc->maximum_keylength());
return std::map<std::string, double>({
@@ -79,18 +74,14 @@ time_algorithm_ops(const std::string& name,
{ "", mb_mult * time_op(runtime, [&]() { sc->encipher(buffer); }) },
});
}
- else if(HashFunction* p = get_hash_function(name, provider))
+ else if(auto h = HashFunction::create(name, provider))
{
- std::unique_ptr<HashFunction> h(p);
-
return std::map<std::string, double>({
{ "", mb_mult * time_op(runtime, [&]() { h->update(buffer); }) },
});
}
- else if(MessageAuthenticationCode* p = get_mac(name, provider))
+ else if(auto mac = MessageAuthenticationCode::create(name, provider))
{
- std::unique_ptr<MessageAuthenticationCode> mac(p);
-
const SymmetricKey key(rng, mac->maximum_keylength());
return std::map<std::string, double>({
@@ -137,10 +128,10 @@ std::set<std::string> get_all_providers_of(const std::string& algo)
auto add_to_set = [&provs](const std::vector<std::string>& str) { for(auto&& s : str) { provs.insert(s); } };
- add_to_set(get_block_cipher_providers(algo));
- add_to_set(get_stream_cipher_providers(algo));
- add_to_set(get_hash_function_providers(algo));
- add_to_set(get_mac_providers(algo));
+ add_to_set(BlockCipher::providers(algo));
+ add_to_set(StreamCipher::providers(algo));
+ add_to_set(HashFunction::providers(algo));
+ add_to_set(MessageAuthenticationCode::providers(algo));
return provs;
}