summaryrefslogtreecommitdiff
path: root/rijndael.cpp
diff options
context:
space:
mode:
authorMarcel Raad <raad@teamviewer.com>2016-05-10 11:58:55 +0200
committerMarcel Raad <raad@teamviewer.com>2016-05-10 12:43:49 +0200
commitf43b7c95cd719285c8b9fef5872239400e53e2ed (patch)
tree15a234ca966c34b6e5dc5507589d044356ef130f /rijndael.cpp
parent69f7802b53dfbc7ac9aacbaff02b45d6582aad3d (diff)
downloadcryptopp-git-f43b7c95cd719285c8b9fef5872239400e53e2ed.tar.gz
Check for SSE4 support before using SSE4.1 instruction
In a 32-bit Windows program compiled with Visual C++ 2013 Update 5, we sometimes get crashes because of an exception "0xC000001D: Illegal Instruction" on the pextrd (_mm_extract_epi32) instruction. Explicitly check for SSE4 support instead of only AES-NI before using this SSE4.1 instruction.
Diffstat (limited to 'rijndael.cpp')
-rw-r--r--rijndael.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/rijndael.cpp b/rijndael.cpp
index 71fa1b85..46396205 100644
--- a/rijndael.cpp
+++ b/rijndael.cpp
@@ -217,9 +217,9 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, c
word32 *rk = m_key;
-#if (CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE && (!defined(_MSC_VER) || _MSC_VER >= 1600 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32))
+#if (CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE && CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE && (!defined(_MSC_VER) || _MSC_VER >= 1600 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32))
// MSVC 2008 SP1 generates bad code for _mm_extract_epi32() when compiling for X64
- if (HasAESNI())
+ if (HasAESNI() && HasSSE4())
{
static const word32 rcLE[] = {
0x01, 0x02, 0x04, 0x08,