Do not assume that _MSC_VER being defined implied x86 or x64

This commit is contained in:
Frank Denis 2015-05-29 12:07:05 +02:00
parent c7179cea2d
commit 7821009bff
3 changed files with 8 additions and 4 deletions

View File

@ -153,7 +153,8 @@ escrypt_r(escrypt_local_t * local, const uint8_t * passwd, size_t passwdlen,
if (need > buflen || need < saltlen) {
return NULL;
}
#if defined(HAVE_EMMINTRIN_H) || defined(_MSC_VER)
#if defined(HAVE_EMMINTRIN_H) || \
(defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86)))
escrypt_kdf =
sodium_runtime_has_sse2() ? escrypt_kdf_sse : escrypt_kdf_nosse;
#else
@ -234,7 +235,8 @@ crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
if (escrypt_init_local(&local)) {
return -1; /* LCOV_EXCL_LINE */
}
#if defined(HAVE_EMMINTRIN_H) || defined(_MSC_VER)
#if defined(HAVE_EMMINTRIN_H) || \
(defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86)))
escrypt_kdf =
sodium_runtime_has_sse2() ? escrypt_kdf_sse : escrypt_kdf_nosse;
#else

View File

@ -28,7 +28,8 @@
* online backup system.
*/
#if defined(HAVE_EMMINTRIN_H) || defined(_MSC_VER)
#if defined(HAVE_EMMINTRIN_H) || \
(defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86)))
#if __GNUC__
# pragma GCC target("sse2")
#endif

View File

@ -43,7 +43,8 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
static void
_cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && \
(defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86))
__cpuid((int *) cpu_info, cpu_info_type);
#elif defined(HAVE_CPUID)
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;