diff -up ./mozilla/security/nss/lib/freebl/Makefile.gcm_comp ./mozilla/security/nss/lib/freebl/Makefile --- ./mozilla/security/nss/lib/freebl/Makefile.gcm_comp 2013-07-26 12:19:14.000000000 -0700 +++ ./mozilla/security/nss/lib/freebl/Makefile 2013-07-26 12:21:28.000000000 -0700 @@ -186,7 +186,12 @@ ifeq ($(CPU_ARCH),x86_64) DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN # DEFINES += -DMPI_AMD64_ADD # comment the next two lines to turn off intel HW accelleration + ifndef DISABLE_HW_AES DEFINES += -DUSE_HW_AES + ifndef NSS_DISABLE_HW_GCM + DEFINES += -DUSE_HW_GCM + endif + endif ASFILES += intel-aes.s intel-gcm.s EXTRA_SRCS += intel-gcm-wrap.c INTEL_GCM = 1 @@ -443,7 +448,7 @@ else DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY DEFINES += -DNSS_USE_COMBA -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN # comment the next two lines to turn off intel HW accelleration - DEFINES += -DUSE_HW_AES + DEFINES += -DUSE_HW_AES -DUSE_HW_GCM ASFILES += intel-aes.s intel-gcm.s EXTRA_SRCS += intel-gcm-wrap.c INTEL_GCM = 1 diff -up ./mozilla/security/nss/lib/freebl/rijndael.c.gcm_comp ./mozilla/security/nss/lib/freebl/rijndael.c --- ./mozilla/security/nss/lib/freebl/rijndael.c.gcm_comp 2013-07-26 12:14:03.000000000 -0700 +++ ./mozilla/security/nss/lib/freebl/rijndael.c 2013-07-26 12:18:46.000000000 -0700 @@ -1009,16 +1009,22 @@ aes_InitContext(AESContext *cx, const un if (has_intel_aes == 0) { unsigned long eax, ebx, ecx, edx; char *disable_hw_aes = getenv("NSS_DISABLE_HW_AES"); + char *disable_hw_gcm = NULL; + has_intel_clmul = -1; + has_intel_avx = -1; if (disable_hw_aes == NULL) { freebl_cpuid(1, &eax, &ebx, &ecx, &edx); has_intel_aes = (ecx & (1 << 25)) != 0 ? 1 : -1; - has_intel_clmul = (ecx & (1 << 1)) != 0 ? 1 : -1; - has_intel_avx = (ecx & (1 << 28)) != 0 ? 1 : -1; +#ifdef USE_HW_GCM + disable_hw_gcm = getenv("NSS_DISABLE_HW_GCM"); + if (disable_hw_gcm == NULL) { + has_intel_clmul = (ecx & (1 << 1)) != 0 ? 1 : -1; + has_intel_avx = (ecx & (1 << 28)) != 0 ? 1 : -1; + } +#endif } else { has_intel_aes = -1; - has_intel_avx = -1; - has_intel_clmul = -1; } } use_hw_aes = (PRBool)