summaryrefslogtreecommitdiff
path: root/lib/freebl/rijndael.h
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-09-22 11:27:34 +0200
committerDaiki Ueno <dueno@redhat.com>2017-09-22 11:27:34 +0200
commit267435d56c5d1508c9cde641dc1db13ad7122f10 (patch)
tree8a00ec09274c20a28e1a92772fd5e16f8c9f10f9 /lib/freebl/rijndael.h
parent0a198a7b2534bd5482dbd5327ce2c313a634954f (diff)
downloadnss-hg-267435d56c5d1508c9cde641dc1db13ad7122f10.tar.gz
Bug 1400603 - freebl: Reorganize AES-GCM source code based on hw/sw implementation, r=franziskus
Reviewers: franziskus Reviewed By: franziskus Bug #: 1400603 Differential Revision: https://phabricator.services.mozilla.com/D65
Diffstat (limited to 'lib/freebl/rijndael.h')
-rw-r--r--lib/freebl/rijndael.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/freebl/rijndael.h b/lib/freebl/rijndael.h
index 1f4a8a9f7..1b63a323d 100644
--- a/lib/freebl/rijndael.h
+++ b/lib/freebl/rijndael.h
@@ -8,8 +8,22 @@
#include "blapii.h"
#include <stdint.h>
-#ifdef NSS_X86_OR_X64
-#include <wmmintrin.h> /* aes-ni */
+#if defined(NSS_X86_OR_X64)
+/* GCC <= 4.8 doesn't support including emmintrin.h without enabling SSE2 */
+#if !defined(__clang__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
+ (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8))
+#pragma GCC push_options
+#pragma GCC target("sse2")
+#undef NSS_DISABLE_SSE2
+#define NSS_DISABLE_SSE2 1
+#endif /* GCC <= 4.8 */
+
+#include <emmintrin.h> /* __m128i */
+
+#ifdef NSS_DISABLE_SSE2
+#undef NSS_DISABLE_SSE2
+#pragma GCC pop_options
+#endif /* NSS_DISABLE_SSE2 */
#endif
typedef void AESBlockFunc(AESContext *cx,