aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/algo_factory/algo_factory.h4
-rw-r--r--src/benchmark/benchmark.cpp7
-rw-r--r--src/benchmark/benchmark.h28
-rw-r--r--src/filters/data_snk.h2
-rw-r--r--src/utils/dyn_load/dyn_load.cpp9
5 files changed, 42 insertions, 8 deletions
diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h
index fe046eac1..33a778b01 100644
--- a/src/algo_factory/algo_factory.h
+++ b/src/algo_factory/algo_factory.h
@@ -183,6 +183,10 @@ class BOTAN_DLL Algorithm_Factory
friend class Engine_Iterator;
private:
+ Algorithm_Factory(const Algorithm_Factory&) {}
+ Algorithm_Factory& operator=(const Algorithm_Factory&)
+ { return (*this); }
+
Engine* get_engine_n(u32bit) const;
std::vector<Engine*> engines;
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp
index 887c64e70..fc4a8ba37 100644
--- a/src/benchmark/benchmark.cpp
+++ b/src/benchmark/benchmark.cpp
@@ -120,9 +120,10 @@ bench_mac(MessageAuthenticationCode* mac,
std::map<std::string, double>
algorithm_benchmark(const std::string& name,
- u32bit milliseconds,
+ Algorithm_Factory& af,
RandomNumberGenerator& rng,
- Algorithm_Factory& af)
+ u32bit milliseconds,
+ u32bit buf_size)
{
std::vector<std::string> providers = af.providers_of(name);
std::map<std::string, double> all_results;
@@ -133,7 +134,7 @@ algorithm_benchmark(const std::string& name,
const u64bit ns_per_provider =
(static_cast<u64bit>(milliseconds) * 1000 * 1000) / providers.size();
- std::vector<byte> buf(16 * 1024);
+ std::vector<byte> buf(buf_size * 1024);
rng.randomize(&buf[0], buf.size());
for(u32bit i = 0; i != providers.size(); ++i)
diff --git a/src/benchmark/benchmark.h b/src/benchmark/benchmark.h
index 4f1d91b79..304fae2fc 100644
--- a/src/benchmark/benchmark.h
+++ b/src/benchmark/benchmark.h
@@ -18,16 +18,36 @@ namespace Botan {
/**
* Algorithm benchmark
* @param name the name of the algorithm to test (cipher, hash, or MAC)
-* @param milliseconds total time for the benchmark to run
-* @param rng the rng to use to generate random inputs
* @param af the algorithm factory used to create objects
+* @param rng the rng to use to generate random inputs
+* @param milliseconds total time for the benchmark to run
+* @param buf_size size of buffer to benchmark against, in KiB
* @return results a map from provider to speed in mebibytes per second
*/
std::map<std::string, double>
BOTAN_DLL algorithm_benchmark(const std::string& name,
- u32bit milliseconds,
+ Algorithm_Factory& af,
RandomNumberGenerator& rng,
- Algorithm_Factory& af);
+ u32bit milliseconds,
+ u32bit buf_size);
+
+/**
+* Algorithm benchmark (1.8 compatability version)
+* @deprecated Use variant taking buf_size defined above
+* @param name the name of the algorithm to test (cipher, hash, or MAC)
+* @param milliseconds total time for the benchmark to run
+* @param rng the rng to use to generate random inputs
+* @param af the algorithm factory used to create objects
+* @return results a map from provider to speed in mebibytes per second
+*/
+std::map<std::string, double>
+inline algorithm_benchmark(const std::string& name,
+ u32bit milliseconds,
+ RandomNumberGenerator& rng,
+ Algorithm_Factory& af)
+ {
+ return algorithm_benchmark(name, af, rng, milliseconds, 16);
+ }
}
diff --git a/src/filters/data_snk.h b/src/filters/data_snk.h
index db0bfc858..509fdae20 100644
--- a/src/filters/data_snk.h
+++ b/src/filters/data_snk.h
@@ -33,6 +33,8 @@ class BOTAN_DLL DataSink : public Filter
class BOTAN_DLL DataSink_Stream : public DataSink
{
public:
+ std::string name() const { return identifier; }
+
void write(const byte[], u32bit);
/**
diff --git a/src/utils/dyn_load/dyn_load.cpp b/src/utils/dyn_load/dyn_load.cpp
index 621737d0c..6d359bc01 100644
--- a/src/utils/dyn_load/dyn_load.cpp
+++ b/src/utils/dyn_load/dyn_load.cpp
@@ -23,7 +23,14 @@ Dynamically_Loaded_Library::Dynamically_Loaded_Library(
lib = ::dlopen(lib_name.c_str(), RTLD_LAZY);
if(!lib)
- throw std::runtime_error("Failed to load engine " + lib_name);
+ {
+ const char* dl_err = dlerror();
+ if(!dl_err)
+ dl_err = "Unknown error";
+
+ throw std::runtime_error("Failed to load engine " + lib_name + ": " +
+ dl_err);
+ }
#endif
}