diff --git a/gcm.cpp b/gcm.cpp
index 9e46766f..dd28c25f 100644
--- a/gcm.cpp
+++ b/gcm.cpp
@@ -12,6 +12,17 @@
#ifndef CRYPTOPP_IMPORTS
#ifndef CRYPTOPP_GENERATE_X64_MASM
+// Clang 3.3 integrated assembler crash on Linux
+#if defined(CRYPTOPP_CLANG_VERSION) && (CRYPTOPP_CLANG_VERSION < 30400)
+# undef CRYPTOPP_X86_ASM_AVAILABLE
+# undef CRYPTOPP_X32_ASM_AVAILABLE
+# undef CRYPTOPP_X64_ASM_AVAILABLE
+# undef CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
+# undef CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE
+# define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
+# define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
+#endif
+
#include "gcm.h"
#include "cpu.h"
@@ -807,10 +818,10 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
SSE2_MUL_32BITS(2)
SSE2_MUL_32BITS(3)
- AS2( add WORD_REG(cx), 16 )
- AS2( sub WORD_REG(dx), 1 )
- ASJ( jnz, 1, b )
- AS2( movdqa [WORD_REG(si)], xmm0 )
+ AS2( add WORD_REG(cx), 16 )
+ AS2( sub WORD_REG(dx), 1 )
+ ASJ( jnz, 1, b )
+ AS2( movdqa [WORD_REG(si)], xmm0 )
#ifdef __GNUC__
ATT_PREFIX
diff --git a/panama.h b/panama.h
index 97531928..f3b86501 100644
--- a/panama.h
+++ b/panama.h
@@ -10,7 +10,8 @@
#include "iterhash.h"
#include "secblock.h"
-#if CRYPTOPP_BOOL_X32
+// Clang 3.3 integrated assembler crash on Linux
+#if CRYPTOPP_BOOL_X32 || (defined(CRYPTOPP_CLANG_VERSION) && (CRYPTOPP_CLANG_VERSION < 30400))
# define CRYPTOPP_DISABLE_PANAMA_ASM
#endif
diff --git a/rijndael.h b/rijndael.h
index 417df76b..ed856d94 100644
--- a/rijndael.h
+++ b/rijndael.h
@@ -11,7 +11,8 @@
#include "seckey.h"
#include "secblock.h"
-#if CRYPTOPP_BOOL_X32
+// Clang 3.3 integrated assembler crash on Linux
+#if CRYPTOPP_BOOL_X32 || (defined(CRYPTOPP_CLANG_VERSION) && (CRYPTOPP_CLANG_VERSION < 30400))
# define CRYPTOPP_DISABLE_RIJNDAEL_ASM
#endif
diff --git a/sha.cpp b/sha.cpp
index 8ac6368a..78ba88f5 100644
--- a/sha.cpp
+++ b/sha.cpp
@@ -102,7 +102,7 @@ void SHA256::InitState(HashWordType *state)
memcpy(state, s, sizeof(s));
}
-#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
+#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && !defined(CRYPTOPP_DISABLE_SHA_ASM)
CRYPTOPP_ALIGN_DATA(16) extern const word32 SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = {
#else
extern const word32 SHA256_K[64] = {
@@ -127,7 +127,7 @@ extern const word32 SHA256_K[64] = {
#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM
-#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)
+#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len
#if defined(_MSC_VER) && (_MSC_VER == 1200)
@@ -461,7 +461,7 @@ void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data,
}
#endif
-#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
+#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length)
{
@@ -503,7 +503,7 @@ size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length)
void SHA256::Transform(word32 *state, const word32 *data)
{
word32 W[16];
-#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
+#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
// this byte reverse is a waste of time, but this function is only called by MDC
ByteReverse(W, data, BLOCKSIZE);
X86_SHA256_HashBlocks(state, W, BLOCKSIZE - !HasSSE2());
diff --git a/sha.h b/sha.h
index 90ff1ab0..544e8056 100644
--- a/sha.h
+++ b/sha.h
@@ -10,6 +10,11 @@
#include "config.h"
#include "iterhash.h"
+// Clang 3.3 integrated assembler crash on Linux
+#if defined(CRYPTOPP_CLANG_VERSION) && (CRYPTOPP_CLANG_VERSION < 30400)
+# define CRYPTOPP_DISABLE_SHA_ASM
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
/// SHA-1
@@ -27,7 +32,7 @@ typedef SHA1 SHA; // for backwards compatibility
class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform
{
public:
-#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
+#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
size_t HashMultipleBlocks(const word32 *input, size_t length);
#endif
static void CRYPTOPP_API InitState(HashWordType *state);
@@ -39,7 +44,7 @@ public:
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform
{
public:
-#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
+#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
size_t HashMultipleBlocks(const word32 *input, size_t length);
#endif
static void CRYPTOPP_API InitState(HashWordType *state);