diff --git a/src/misc/digest.cpp b/src/misc/digest.cpp index 331f9db..82721e3 100644 --- a/src/misc/digest.cpp +++ b/src/misc/digest.cpp @@ -2,7 +2,7 @@ #ifdef NO_OPEN_SSL #include - #define DECLARE_DIGEST(name, _unused_, digestLength) \ + #define DECLARE_DIGEST(name, digestLength) \ void digest::tomcrypt::name(const char* input, size_t length, uint8_t* result) { \ hash_state hash{}; \ \ @@ -11,7 +11,7 @@ name ##_done(&hash, result); \ } - DECLARE_DIGEST(sha1, SHA1, SHA_DIGEST_LENGTH) - DECLARE_DIGEST(sha256, SHA256, SHA256_DIGEST_LENGTH) - DECLARE_DIGEST(sha512, SHA512, SHA512_DIGEST_LENGTH) + DECLARE_DIGEST(sha1, SHA_DIGEST_LENGTH) + DECLARE_DIGEST(sha256, SHA256_DIGEST_LENGTH) + DECLARE_DIGEST(sha512, SHA512_DIGEST_LENGTH) #endif diff --git a/src/misc/spin_lock.h b/src/misc/spin_lock.h index 03fb00a..ea7be59 100644 --- a/src/misc/spin_lock.h +++ b/src/misc/spin_lock.h @@ -9,17 +9,21 @@ class spin_lock { inline void lock() { uint8_t round = 0; while (locked.test_and_set(std::memory_order_acquire)) { +#if false /* waiting 'till its zero so we can try an exchanged again; Atomic exchanges have a huge bug overhead to deal with! */ #ifdef WIN32 while(locked._My_flag > 0) { #else while(locked._M_i) { +#endif #endif //Yield when we're using this lock for a longer time, which we usually not doing if(round++ % 8 == 0) std::this_thread::yield(); +#if false } - } +#endif + } } inline bool try_lock() {