aboutsummaryrefslogtreecommitdiffstats
path: root/src/algo_factory
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-12 21:18:12 +0000
committerlloyd <[email protected]>2008-11-12 21:18:12 +0000
commit36b82adcae6e0f6b2b9e5f588f6c81477847eaaf (patch)
tree14e0fd65f4fa43963fae3e00d415c97afe31307d /src/algo_factory
parent6fae566aaa725f3a58413ff7adbcb55a04ac571b (diff)
Add missing prov_weight.cpp
Diffstat (limited to 'src/algo_factory')
-rw-r--r--src/algo_factory/prov_weight.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/algo_factory/prov_weight.cpp b/src/algo_factory/prov_weight.cpp
new file mode 100644
index 000000000..7ee99b894
--- /dev/null
+++ b/src/algo_factory/prov_weight.cpp
@@ -0,0 +1,31 @@
+/**
+* Default provider weights for Algorithm_Cache
+* (C) 2008 Jack Lloyd
+*/
+
+#include <botan/algo_cache.h>
+
+namespace Botan {
+
+/**
+* Return a static provider weighing
+*/
+u32bit static_provider_weight(const std::string& prov_name)
+ {
+ /*
+ * Prefer asm over C++, but prefer anything over OpenSSL or GNU MP; to use
+ * them, set the provider explicitly for the algorithms you want
+ */
+
+ if(prov_name == "core") return 5;
+ if(prov_name == "ia32") return 6;
+ if(prov_name == "amd64") return 7;
+ if(prov_name == "sse2") return 8;
+
+ if(prov_name == "openssl") return 2;
+ if(prov_name == "gmp") return 1;
+
+ return 0; // other
+ }
+
+}