Bug 979703: Update NSS to NSS_3_16_2_BETA1.
Fix bugs in intel-gcm-x86-masm.asm and re-enable the
Intel AES assembly code. (The fix is by Shay Gueron of Intel.)
Remove an unnecessary loop in intel-gcm-x64-masm.asm r=agl.
--- a/security/nss/TAG-INFO
+++ b/security/nss/TAG-INFO
@@ -1,1 +1,1 @@
-NSS_3_16_1_RTM
+NSS_3_16_2_BETA1
--- a/security/nss/coreconf/WIN32.mk
+++ b/security/nss/coreconf/WIN32.mk
@@ -36,16 +36,19 @@ else
# Change the dots to spaces.
_CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION))
_CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS))
_CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS))
_CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS))
_CC_BUILD := $(word 4,$(_CC_VERSION_WORDS))
_MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR)
_MSC_VER_6 = 1200
+ # VC10 (2010) is 16.00.30319.01, VC10SP1 is 16.00.40219.01.
+ _MSC_VER_GE_10SP1 := $(shell expr $(_MSC_VER) \> 1600 \| \
+ $(_MSC_VER) = 1600 \& $(_CC_RELEASE) \>= 40219)
# VC12 (2013).
_MSC_VER_GE_12 := $(shell expr $(_MSC_VER) \>= 1800)
ifeq ($(_CC_VMAJOR),14)
# -DYNAMICBASE is only supported on VC8SP1 or newer,
# so be very specific here!
# VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42)
USE_DYNAMICBASE =
--- a/security/nss/coreconf/coreconf.dep
+++ b/security/nss/coreconf/coreconf.dep
@@ -5,9 +5,8 @@
/*
* A dummy header file that is a dependency for all the object files.
* Used to force a full recompilation of NSS in Mozilla's Tinderbox
* depend builds. See comments in rules.mk.
*/
#error "Do not include this header file."
-
--- a/security/nss/lib/freebl/Makefile
+++ b/security/nss/lib/freebl/Makefile
@@ -130,31 +130,45 @@ ifdef NS_USE_GCC
else
# MSVC
MPI_SRCS += mpi_x86_asm.c
DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE
DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
ifdef BUILD_OPT
OPTIMIZER += -Ox # maximum optimization for freebl
endif
+ # The Intel AES assembly code requires Visual C++ 2010.
+ # if $(_MSC_VER) >= 1600 (Visual C++ 2010)
+ ifeq ($(firstword $(sort $(_MSC_VER) 1600)),1600)
+ DEFINES += -DUSE_HW_AES -DINTEL_GCM
+ ASFILES += intel-aes-x86-masm.asm intel-gcm-x86-masm.asm
+ EXTRA_SRCS += intel-gcm-wrap.c
+ endif
endif
else
# -DMP_NO_MP_WORD
DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN
ifdef NS_USE_GCC
# Ideally, we should use amd64 assembly code, but it's not yet mingw-w64
# compatible.
else
# MSVC
ifdef BUILD_OPT
OPTIMIZER += -Ox # maximum optimization for freebl
endif
ASFILES = arcfour-amd64-masm.asm mpi_amd64_masm.asm mp_comba_amd64_masm.asm
DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY
DEFINES += -DNSS_USE_COMBA
+ # The Intel AES assembly code requires Visual C++ 2010 (10.0). The _xgetbv
+ # compiler intrinsic function requires Visual C++ 2010 (10.0) SP1.
+ ifeq ($(_MSC_VER_GE_10SP1),1)
+ DEFINES += -DUSE_HW_AES -DINTEL_GCM
+ ASFILES += intel-aes-x64-masm.asm intel-gcm-x64-masm.asm
+ EXTRA_SRCS += intel-gcm-wrap.c
+ endif
MPI_SRCS += mpi_amd64.c
endif
endif
endif
ifeq ($(OS_TARGET),IRIX)
ifeq ($(USE_N32),1)
ASFILES = mpi_mips.s
--- a/security/nss/lib/freebl/intel-gcm-x64-masm.asm
+++ b/security/nss/lib/freebl/intel-gcm-x64-masm.asm
@@ -1254,22 +1254,16 @@ LDecDataTail:
@@:
cmp len, KS
je @f
mov al, [rsp + KS]
mov [PT + KS], al
inc KS
jmp @b
@@:
- cmp KS, 16
- je @f
- mov BYTE PTR[rsp + KS], 0
- inc KS
- jmp @b
-@@:
LDecDataEnd:
vmovdqu XMMWORD PTR[16*16 + 1*16 + Gctx], T
bswap aluCTR
mov [16*16 + 2*16 + 3*4 + Gctx], aluCTR
mov rsp, rbp
--- a/security/nss/lib/freebl/intel-gcm-x86-masm.asm
+++ b/security/nss/lib/freebl/intel-gcm-x86-masm.asm
@@ -835,43 +835,44 @@ LEncDataTail:
vmovdqu TMP2, XMMWORD PTR[14*16 + KS]
@@:
vaesenclast TMP1, TMP1, TMP2
; zero a temp location
vpxor TMP2, TMP2, TMP2
vmovdqa XMMWORD PTR[esp], TMP2
; copy as many bytes as needed
xor KS, KS
+ mov aluTMP, edx
@@:
cmp len, KS
je @f
- mov di, [PT + KS]
- mov [esp + KS], di
+ mov dl, BYTE PTR[PT + KS]
+ mov BYTE PTR[esp + KS], dl
inc KS
jmp @b
@@:
vpxor TMP1, TMP1, XMMWORD PTR[esp]
vmovdqa XMMWORD PTR[esp], TMP1
xor KS, KS
@@:
cmp len, KS
je @f
- mov di, [esp + KS]
- mov [CT + KS], di
+ mov dl, BYTE PTR[esp + KS]
+ mov BYTE PTR[CT + KS], dl
inc KS
jmp @b
@@:
cmp KS, 16
je @f
mov BYTE PTR[esp + KS], 0
inc KS
jmp @b
@@:
+ mov edx, aluTMP
vmovdqa TMP1, XMMWORD PTR[esp]
-
vpshufb TMP1, TMP1, XMMWORD PTR[Lbswap_mask]
vpxor TMP1, TMP1, T
vmovdqu TMP0, XMMWORD PTR[Htbl]
GFMUL TMP1, TMP1, TMP0, TMP5, TMP2, TMP3, TMP4
vmovdqu T, TMP1
LEncDataEnd:
@@ -1145,57 +1146,53 @@ LDecDataTail:
vaesenc TMP1, TMP1, XMMWORD PTR[12*16 + KS]
vaesenc TMP1, TMP1, XMMWORD PTR[13*16 + KS]
vmovdqu TMP2, XMMWORD PTR[14*16 + KS]
@@:
vaesenclast xmm7, TMP1, TMP2
; copy as many bytes as needed
xor KS, KS
+ mov aluTMP, edx
@@:
cmp len, KS
je @f
- mov di, [CT + KS]
- mov [esp + KS], di
+ mov dl, BYTE PTR[CT + KS]
+ mov BYTE PTR[esp + KS], dl
inc KS
jmp @b
@@:
cmp KS, 16
je @f
mov BYTE PTR[esp + KS], 0
inc KS
jmp @b
@@:
-
+ mov edx, aluTMP
vmovdqa TMP1, XMMWORD PTR[esp]
vpshufb TMP1, TMP1, XMMWORD PTR[Lbswap_mask]
vpxor TMP1, TMP1, T
vmovdqu TMP0, XMMWORD PTR[Htbl]
GFMUL TMP1, TMP1, TMP0, TMP5, TMP2, TMP3, TMP4
vmovdqu T, TMP1
-
vpxor xmm7, xmm7, XMMWORD PTR[esp]
vmovdqa XMMWORD PTR[esp], xmm7
xor KS, KS
+ mov aluTMP, edx
@@:
cmp len, KS
je @f
- mov di, [esp + KS]
- mov [PT + KS], di
+ mov dl, BYTE PTR[esp + KS]
+ mov BYTE PTR[PT + KS], dl
inc KS
jmp @b
@@:
- cmp KS, 16
- je @f
- mov BYTE PTR[PT + KS], 0
- inc KS
- jmp @b
-@@:
+ mov edx, aluTMP
LDecDataEnd:
bswap aluCTR
mov [16*16 + 2*16 + 3*4 + Gctx], aluCTR
mov esp, ebp
pop edi
--- a/security/nss/lib/nss/nss.h
+++ b/security/nss/lib/nss/nss.h
@@ -28,22 +28,22 @@
/*
* NSS's major version, minor version, patch level, build number, and whether
* this is a beta release.
*
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
-#define NSS_VERSION "3.16.1" _NSS_ECC_STRING _NSS_CUSTOMIZED
+#define NSS_VERSION "3.16.2" _NSS_ECC_STRING _NSS_CUSTOMIZED " Beta"
#define NSS_VMAJOR 3
#define NSS_VMINOR 16
-#define NSS_VPATCH 1
+#define NSS_VPATCH 2
#define NSS_VBUILD 0
-#define NSS_BETA PR_FALSE
+#define NSS_BETA PR_TRUE
#ifndef RC_INVOKED
#include "seccomon.h"
typedef struct NSSInitParametersStr NSSInitParameters;
/*
--- a/security/nss/lib/softoken/softkver.h
+++ b/security/nss/lib/softoken/softkver.h
@@ -20,16 +20,16 @@
/*
* Softoken's major version, minor version, patch level, build number,
* and whether this is a beta release.
*
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
-#define SOFTOKEN_VERSION "3.16.1" SOFTOKEN_ECC_STRING
+#define SOFTOKEN_VERSION "3.16.2" SOFTOKEN_ECC_STRING " Beta"
#define SOFTOKEN_VMAJOR 3
#define SOFTOKEN_VMINOR 16
-#define SOFTOKEN_VPATCH 1
+#define SOFTOKEN_VPATCH 2
#define SOFTOKEN_VBUILD 0
-#define SOFTOKEN_BETA PR_FALSE
+#define SOFTOKEN_BETA PR_TRUE
#endif /* _SOFTKVER_H_ */
--- a/security/nss/lib/util/nssutil.h
+++ b/security/nss/lib/util/nssutil.h
@@ -14,22 +14,22 @@
/*
* NSS utilities's major version, minor version, patch level, build number,
* and whether this is a beta release.
*
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <Beta>]"
*/
-#define NSSUTIL_VERSION "3.16.1"
+#define NSSUTIL_VERSION "3.16.2 Beta"
#define NSSUTIL_VMAJOR 3
#define NSSUTIL_VMINOR 16
-#define NSSUTIL_VPATCH 1
+#define NSSUTIL_VPATCH 2
#define NSSUTIL_VBUILD 0
-#define NSSUTIL_BETA PR_FALSE
+#define NSSUTIL_BETA PR_TRUE
SEC_BEGIN_PROTOS
/*
* Returns a const string of the UTIL library version.
*/
extern const char *NSSUTIL_GetVersion(void);