diff options
author | Oran Juice <oranjuices@hotmail.com> | 2014-09-28 15:52:05 +0530 |
---|---|---|
committer | Oran Juice <oranjuices@hotmail.com> | 2014-09-28 15:52:05 +0530 |
commit | 4f693d715c036346b642298cc94bd4d87c5f35e2 (patch) | |
tree | c7f764d9f9d90de3947eff7910901ee3a56212b1 /src/crypto | |
parent | Minor comment changes and code clean-up (diff) | |
parent | Revert "low risk, potentially varint overflow bug patched thanks to BBR" (diff) | |
download | monero-4f693d715c036346b642298cc94bd4d87c5f35e2.tar.xz |
Merge with origin/master
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/slow-hash.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index 3aff7bd5d..d4f27e1e1 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -41,12 +41,20 @@ #if defined(_MSC_VER) #include <intrin.h> -#include <Windows.h> +#include <windows.h> #define STATIC #define INLINE __inline #if !defined(RDATA_ALIGN16) #define RDATA_ALIGN16 __declspec(align(16)) #endif +#elif defined(__MINGW32__) +#include <intrin.h> +#include <windows.h> +#define STATIC static +#define INLINE inline +#if !defined(RDATA_ALIGN16) +#define RDATA_ALIGN16 __attribute__ ((aligned(16))) +#endif #else #include <wmmintrin.h> #include <sys/mman.h> @@ -287,7 +295,7 @@ STATIC INLINE void aes_pseudo_round_xor(const uint8_t *in, uint8_t *out, } } -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) BOOL SetLockPagesPrivilege(HANDLE hProcess, BOOL bEnable) { struct @@ -325,7 +333,7 @@ void slow_hash_allocate_state(void) if(hp_state != NULL) return; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) SetLockPagesPrivilege(GetCurrentProcess(), TRUE); hp_state = (uint8_t *) VirtualAlloc(hp_state, MEMORY, MEM_LARGE_PAGES | MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); @@ -357,7 +365,7 @@ void slow_hash_free_state(void) free(hp_state); else { -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) VirtualFree(hp_state, MEMORY, MEM_RELEASE); #else munmap(hp_state, MEMORY); |