aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/base
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-10-17 03:11:14 -0400
committerJack Lloyd <[email protected]>2016-10-17 03:11:14 -0400
commit0b353965a56dabf7528eecf672cc627304dbb8e1 (patch)
treededfd4db3cc140f4a4c2fbba8a566742bc735fd2 /src/lib/base
parenta816a52612cd8e9cf12bfdccaacc5ce7960b2700 (diff)
parent8b3bda479efecef760f052cc055d3d6d98bf0637 (diff)
Merge GH #665 Add IncludeOS target, make filesystem/threads optional
Diffstat (limited to 'src/lib/base')
-rw-r--r--src/lib/base/algo_registry.h16
-rw-r--r--src/lib/base/scan_name.cpp6
-rw-r--r--src/lib/base/scan_name.h4
3 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/base/algo_registry.h b/src/lib/base/algo_registry.h
index f7e66b3e2..bca3715b6 100644
--- a/src/lib/base/algo_registry.h
+++ b/src/lib/base/algo_registry.h
@@ -13,7 +13,7 @@
#include <botan/exceptn.h>
#include <botan/scan_name.h>
#include <functional>
-#include <mutex>
+#include <botan/mutex.h>
#include <vector>
#include <map>
#include <string>
@@ -77,14 +77,14 @@ class Algo_Registry
void add(const std::string& name, const std::string& provider, maker_fn fn, byte pref)
{
- std::lock_guard<mutex> lock(m_mutex);
+ lock_guard_type<af_mutex_type> lock(m_mutex);
if(!m_algo_info[name].add_provider(provider, fn, pref))
throw Exception("Duplicated registration of " + name + "/" + provider);
}
std::vector<std::string> providers_of(const Spec& spec)
{
- std::lock_guard<mutex> lock(m_mutex);
+ lock_guard_type<af_mutex_type> lock(m_mutex);
auto i = m_algo_info.find(spec.algo_name());
if(i != m_algo_info.end())
return i->second.providers();
@@ -93,7 +93,7 @@ class Algo_Registry
void set_provider_preference(const Spec& spec, const std::string& provider, byte pref)
{
- std::lock_guard<mutex> lock(m_mutex);
+ lock_guard_type<af_mutex_type> lock(m_mutex);
auto i = m_algo_info.find(spec.algo_name());
if(i != m_algo_info.end())
i->second.set_pref(provider, pref);
@@ -137,16 +137,16 @@ class Algo_Registry
private:
#if defined(BOTAN_WORKAROUND_GH_321)
- using mutex = WinCS_Mutex;
+ using af_mutex_type = WinCS_Mutex;
#else
- using mutex = std::mutex;
+ using af_mutex_type = mutex_type;
#endif
Algo_Registry() { }
std::vector<maker_fn> get_makers(const Spec& spec, const std::string& provider)
{
- std::lock_guard<mutex> lock(m_mutex);
+ lock_guard_type<af_mutex_type> lock(m_mutex);
return m_algo_info[spec.algo_name()].get_makers(provider);
}
@@ -208,7 +208,7 @@ class Algo_Registry
std::unordered_map<std::string, maker_fn> m_maker_fns;
};
- mutex m_mutex;
+ af_mutex_type m_mutex;
std::unordered_map<std::string, Algo_Info> m_algo_info;
};
diff --git a/src/lib/base/scan_name.cpp b/src/lib/base/scan_name.cpp
index 08f5e8702..76d9b1a17 100644
--- a/src/lib/base/scan_name.cpp
+++ b/src/lib/base/scan_name.cpp
@@ -172,7 +172,7 @@ size_t SCAN_Name::arg_as_integer(size_t i, size_t def_value) const
return to_u32bit(m_args[i]);
}
-std::mutex SCAN_Name::g_alias_map_mutex;
+mutex_type SCAN_Name::g_alias_map_mutex;
std::map<std::string, std::string> SCAN_Name::g_alias_map = {
{ "3DES", "TripleDES" },
{ "ARC4", "RC4" },
@@ -197,7 +197,7 @@ std::map<std::string, std::string> SCAN_Name::g_alias_map = {
void SCAN_Name::add_alias(const std::string& alias, const std::string& basename)
{
- std::lock_guard<std::mutex> lock(g_alias_map_mutex);
+ lock_guard_type<mutex_type> lock(g_alias_map_mutex);
if(g_alias_map.find(alias) == g_alias_map.end())
g_alias_map[alias] = basename;
@@ -205,7 +205,7 @@ void SCAN_Name::add_alias(const std::string& alias, const std::string& basename)
std::string SCAN_Name::deref_alias(const std::string& alias)
{
- std::lock_guard<std::mutex> lock(g_alias_map_mutex);
+ lock_guard_type<mutex_type> lock(g_alias_map_mutex);
std::string name = alias;
diff --git a/src/lib/base/scan_name.h b/src/lib/base/scan_name.h
index c19bbf50f..75f7d1089 100644
--- a/src/lib/base/scan_name.h
+++ b/src/lib/base/scan_name.h
@@ -11,7 +11,7 @@
#include <botan/types.h>
#include <string>
#include <vector>
-#include <mutex>
+#include <botan/mutex.h>
#include <map>
namespace Botan {
@@ -117,7 +117,7 @@ class BOTAN_DLL SCAN_Name
*/
static std::string deref_alias(const std::string& alias);
private:
- static std::mutex g_alias_map_mutex;
+ static mutex_type g_alias_map_mutex;
static std::map<std::string, std::string> g_alias_map;
std::string m_orig_algo_spec;