1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows:solve compilation error under VC++ 2008 by using extern "C" only when needed.

This commit is contained in:
Mounir IDRASSI
2016-06-20 02:15:52 +02:00
parent 00eb49443a
commit c5b766969a

View File

@@ -4,10 +4,6 @@
#include "Common/Tcdefs.h" #include "Common/Tcdefs.h"
#include "config.h" #include "config.h"
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef CRYPTOPP_GENERATE_X64_MASM #ifdef CRYPTOPP_GENERATE_X64_MASM
#define CRYPTOPP_X86_ASM_AVAILABLE #define CRYPTOPP_X86_ASM_AVAILABLE
@@ -18,6 +14,9 @@ extern "C" {
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#if defined(TC_WINDOWS_DRIVER) #if defined(TC_WINDOWS_DRIVER)
#if defined(__cplusplus)
extern "C" {
#endif
typedef union __declspec(intrin_type) CRYPTOPP_ALIGN_DATA(8) __m64 typedef union __declspec(intrin_type) CRYPTOPP_ALIGN_DATA(8) __m64
{ {
unsigned __int64 m64_u64; unsigned __int64 m64_u64;
@@ -72,6 +71,9 @@ extern __m128i _mm_set_epi64(__m64 _Q1, __m64 _Q0);
extern __m128i _mm_setr_epi32(int _I0, int _I1, int _I2, int _I3); extern __m128i _mm_setr_epi32(int _I0, int _I1, int _I2, int _I3);
#define _mm_xor_si64 _m_pxor #define _mm_xor_si64 _m_pxor
#define _mm_empty _m_empty #define _mm_empty _m_empty
#if defined(__cplusplus)
}
#endif
#else #else
#include <mmintrin.h> #include <mmintrin.h>
#include <emmintrin.h> #include <emmintrin.h>
@@ -81,7 +83,13 @@ extern __m128i _mm_setr_epi32(int _I0, int _I1, int _I2, int _I3);
#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE #if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
#if defined(__SSSE3__) || defined(__INTEL_COMPILER) #if defined(__SSSE3__) || defined(__INTEL_COMPILER)
#if defined(TC_WINDOWS_DRIVER) #if defined(TC_WINDOWS_DRIVER)
#if defined(__cplusplus)
extern "C" {
#endif
extern __m128i _mm_shuffle_epi8 (__m128i a, __m128i b); extern __m128i _mm_shuffle_epi8 (__m128i a, __m128i b);
#if defined(__cplusplus)
}
#endif
#else #else
#include <tmmintrin.h> #include <tmmintrin.h>
#endif #endif
@@ -89,11 +97,17 @@ extern __m128i _mm_shuffle_epi8 (__m128i a, __m128i b);
#if defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER) #if defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER)
#if defined(TC_WINDOWS_DRIVER) #if defined(TC_WINDOWS_DRIVER)
#if defined(__cplusplus)
extern "C" {
#endif
extern int _mm_extract_epi32(__m128i src, const int ndx); extern int _mm_extract_epi32(__m128i src, const int ndx);
extern __m128i _mm_insert_epi32(__m128i dst, int s, const int ndx); extern __m128i _mm_insert_epi32(__m128i dst, int s, const int ndx);
#if defined(_M_X64) #if defined(_M_X64)
extern __m128i _mm_insert_epi64(__m128i dst, __int64 s, const int ndx); extern __m128i _mm_insert_epi64(__m128i dst, __int64 s, const int ndx);
#endif #endif
#if defined(__cplusplus)
}
#endif
#else #else
#include <smmintrin.h> #include <smmintrin.h>
#endif #endif
@@ -101,6 +115,9 @@ extern __m128i _mm_insert_epi64(__m128i dst, __int64 s, const int ndx);
#if (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER) || CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE #if (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER) || CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
#if defined(TC_WINDOWS_DRIVER) #if defined(TC_WINDOWS_DRIVER)
#if defined(__cplusplus)
extern "C" {
#endif
extern __m128i _mm_clmulepi64_si128(__m128i v1, __m128i v2, extern __m128i _mm_clmulepi64_si128(__m128i v1, __m128i v2,
const int imm8); const int imm8);
extern __m128i _mm_aeskeygenassist_si128(__m128i ckey, const int rcon); extern __m128i _mm_aeskeygenassist_si128(__m128i ckey, const int rcon);
@@ -109,6 +126,9 @@ extern __m128i _mm_aesenc_si128(__m128i v, __m128i rkey);
extern __m128i _mm_aesenclast_si128(__m128i v, __m128i rkey); extern __m128i _mm_aesenclast_si128(__m128i v, __m128i rkey);
extern __m128i _mm_aesdec_si128(__m128i v, __m128i rkey); extern __m128i _mm_aesdec_si128(__m128i v, __m128i rkey);
extern __m128i _mm_aesdeclast_si128(__m128i v, __m128i rkey); extern __m128i _mm_aesdeclast_si128(__m128i v, __m128i rkey);
#if defined(__cplusplus)
}
#endif
#else #else
#include <wmmintrin.h> #include <wmmintrin.h>
#endif #endif
@@ -117,6 +137,10 @@ extern __m128i _mm_aesdeclast_si128(__m128i v, __m128i rkey);
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
#if defined(__cplusplus)
extern "C" {
#endif
#define CRYPTOPP_CPUID_AVAILABLE #define CRYPTOPP_CPUID_AVAILABLE
// these should not be used directly // these should not be used directly
@@ -157,6 +181,10 @@ extern int g_hasMMX;
#define IsP4() g_isP4 #define IsP4() g_isP4
#define GetCacheLineSize() g_cacheLineSize #define GetCacheLineSize() g_cacheLineSize
#if defined(__cplusplus)
}
#endif
#else #else
#define GetCacheLineSize() CRYPTOPP_L1_CACHE_LINE_SIZE #define GetCacheLineSize() CRYPTOPP_L1_CACHE_LINE_SIZE
@@ -368,8 +396,4 @@ extern int g_hasMMX;
AS2( add outputPtr, increment*16) AS2( add outputPtr, increment*16)
#if defined(__cplusplus)
}
#endif
#endif #endif