summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/freebl/gcm.h
diff options
context:
space:
mode:
Diffstat (limited to 'security/nss/lib/freebl/gcm.h')
-rw-r--r--security/nss/lib/freebl/gcm.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/security/nss/lib/freebl/gcm.h b/security/nss/lib/freebl/gcm.h
index 42ef0f717..571b9ec55 100644
--- a/security/nss/lib/freebl/gcm.h
+++ b/security/nss/lib/freebl/gcm.h
@@ -26,6 +26,32 @@
#endif /* NSS_DISABLE_SSE2 */
#endif
+#ifdef __aarch64__
+#include <arm_neon.h>
+#endif
+
+#ifdef __powerpc64__
+#include "altivec-types.h"
+
+/* The ghash freebl test tries to use this in C++, and gcc defines conflict. */
+#ifdef __cplusplus
+#undef pixel
+#undef vector
+#undef bool
+#endif
+
+/*
+ * PPC CRYPTO requires at least gcc 5 or clang. The LE check is purely
+ * because it's only been tested on LE. If you're interested in BE,
+ * please send a patch.
+ */
+#if (defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5)) && \
+ defined(IS_LITTLE_ENDIAN)
+#define USE_PPC_CRYPTO
+#endif
+
+#endif
+
SEC_BEGIN_PROTOS
#ifdef HAVE_INT128_SUPPORT
@@ -61,6 +87,10 @@ typedef SECStatus (*ghash_t)(gcmHashContext *, const unsigned char *,
pre_align struct gcmHashContextStr {
#ifdef NSS_X86_OR_X64
__m128i x, h;
+#elif defined(__aarch64__)
+ uint64x2_t x, h;
+#elif defined(USE_PPC_CRYPTO)
+ vec_u64 x, h;
#endif
uint64_t x_low, x_high, h_high, h_low;
unsigned char buffer[MAX_BLOCK_SIZE];