diff options
author | Howard Chu <hyc@symas.com> | 2016-03-11 12:25:28 +0000 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2016-03-11 15:09:50 +0000 |
commit | b937a2c915861900d047d4d4a24af31c454e3540 (patch) | |
tree | ceedf9b256b9769f72cb34319e4144ae127543dc /src/crypto | |
parent | Merge pull request #705 (diff) | |
download | monero-b937a2c915861900d047d4d4a24af31c454e3540.tar.xz |
Use boost::thread instead of std::thread
and all other associated IPC
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/crypto.cpp | 13 | ||||
-rw-r--r-- | src/crypto/crypto.h | 7 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp index fa7b1b580..e47aab0f7 100644 --- a/src/crypto/crypto.cpp +++ b/src/crypto/crypto.cpp @@ -34,7 +34,8 @@ #include <cstdlib> #include <cstring> #include <memory> -#include <mutex> +#include <boost/thread/mutex.hpp> +#include <boost/thread/lock_guard.hpp> #include "common/varint.h" #include "warnings.h" @@ -52,8 +53,6 @@ namespace crypto { using std::abort; using std::int32_t; using std::int64_t; - using std::lock_guard; - using std::mutex; using std::size_t; using std::uint32_t; using std::uint64_t; @@ -63,7 +62,7 @@ namespace crypto { #include "random.h" } - mutex random_lock; + boost::mutex random_lock; static inline unsigned char *operator &(ec_point &point) { return &reinterpret_cast<unsigned char &>(point); @@ -100,7 +99,7 @@ namespace crypto { * */ secret_key crypto_ops::generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover) { - lock_guard<mutex> lock(random_lock); + boost::lock_guard<boost::mutex> lock(random_lock); ge_p3 point; secret_key rng; @@ -199,7 +198,7 @@ namespace crypto { }; void crypto_ops::generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig) { - lock_guard<mutex> lock(random_lock); + boost::lock_guard<boost::mutex> lock(random_lock); ge_p3 tmp3; ec_scalar k; s_comm buf; @@ -280,7 +279,7 @@ POP_WARNINGS const public_key *const *pubs, size_t pubs_count, const secret_key &sec, size_t sec_index, signature *sig) { - lock_guard<mutex> lock(random_lock); + boost::lock_guard<boost::mutex> lock(random_lock); size_t i; ge_p3 image_unp; ge_dsmp image_pre; diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h index 360b571f3..883aa521a 100644 --- a/src/crypto/crypto.h +++ b/src/crypto/crypto.h @@ -31,7 +31,8 @@ #pragma once #include <cstddef> -#include <mutex> +#include <boost/thread/mutex.hpp> +#include <boost/thread/lock_guard.hpp> #include <vector> #include "common/pod-class.h" @@ -44,7 +45,7 @@ namespace crypto { #include "random.h" } - extern std::mutex random_lock; + extern boost::mutex random_lock; #pragma pack(push, 1) POD_CLASS ec_point { @@ -121,7 +122,7 @@ namespace crypto { template<typename T> typename std::enable_if<std::is_pod<T>::value, T>::type rand() { typename std::remove_cv<T>::type res; - std::lock_guard<std::mutex> lock(random_lock); + boost::lock_guard<boost::mutex> lock(random_lock); generate_random_bytes(sizeof(T), &res); return res; } |