Update in-tree NSS to 3.19.5-PM

This commit is contained in:
Pale Moon
2016-11-17 00:28:50 +01:00
parent d222570d37
commit fe697f807c
7 changed files with 71 additions and 27 deletions
+1 -1
View File
@@ -3560,7 +3560,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
if test -n "$_USE_SYSTEM_NSS"; then
dnl NSS capabilities are out of sync with upstream (Camellia-GCM). Don't allow.
AC_MSG_ERROR([Using a system-provided NSS library is currently not supported.])
AM_PATH_NSS(3.19.4.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
AM_PATH_NSS(3.19.5, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi
if test -n "$MOZ_NATIVE_NSS"; then
+1 -1
View File
@@ -1 +1 @@
NSS_3_19_4_2
NSS_3_19_5
+1
View File
@@ -10,3 +10,4 @@
*/
#error "Do not include this header file."
+3 -3
View File
@@ -33,11 +33,11 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
#define NSS_VERSION "3.19.4.2" _NSS_ECC_STRING _NSS_CUSTOMIZED
#define NSS_VERSION "3.19.5.0" _NSS_ECC_STRING _NSS_CUSTOMIZED
#define NSS_VMAJOR 3
#define NSS_VMINOR 19
#define NSS_VPATCH 4
#define NSS_VBUILD 2
#define NSS_VPATCH 5
#define NSS_VBUILD 0
#define NSS_BETA PR_FALSE
#ifndef RC_INVOKED
+3 -3
View File
@@ -25,11 +25,11 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
#define SOFTOKEN_VERSION "3.19.4.2" SOFTOKEN_ECC_STRING
#define SOFTOKEN_VERSION "3.19.5.0" SOFTOKEN_ECC_STRING
#define SOFTOKEN_VMAJOR 3
#define SOFTOKEN_VMINOR 19
#define SOFTOKEN_VPATCH 4
#define SOFTOKEN_VBUILD 2
#define SOFTOKEN_VPATCH 5
#define SOFTOKEN_VBUILD 0
#define SOFTOKEN_BETA PR_FALSE
#endif /* _SOFTKVER_H_ */
+59 -16
View File
@@ -11162,6 +11162,13 @@ ssl_ConstantTimeEQ8(unsigned char a, unsigned char b)
return DUPLICATE_MSB_TO_ALL_8(c);
}
/* ssl_constantTimeSelect return a if mask is 0xFF and b if mask is 0x00 */
static unsigned char
ssl_constantTimeSelect(unsigned char mask, unsigned char a, unsigned char b)
{
return (mask & a) | (~mask & b);
}
static SECStatus
ssl_RemoveSSLv3CBCPadding(sslBuffer *plaintext,
unsigned int blockSize,
@@ -11265,22 +11272,54 @@ ssl_CBCExtractMAC(sslBuffer *plaintext,
/* scanStart contains the number of bytes that we can ignore because
* the MAC's position can only vary by 255 bytes. */
unsigned scanStart = 0;
unsigned i, j, divSpoiler;
unsigned i, j;
unsigned char rotateOffset;
if (originalLength > macSize + 255 + 1)
if (originalLength > macSize + 255 + 1) {
scanStart = originalLength - (macSize + 255 + 1);
}
/* divSpoiler contains a multiple of macSize that is used to cause the
* modulo operation to be constant time. Without this, the time varies
* based on the amount of padding when running on Intel chips at least.
*
* The aim of right-shifting macSize is so that the compiler doesn't
* figure out that it can remove divSpoiler as that would require it
* to prove that macSize is always even, which I hope is beyond it. */
divSpoiler = macSize >> 1;
divSpoiler <<= (sizeof(divSpoiler)-1)*8;
rotateOffset = (divSpoiler + macStart - scanStart) % macSize;
/* We want to compute
* rotateOffset = (macStart - scanStart) % macSize
* But the time to compute this varies based on the amount of padding. Thus
* we explicitely handle all mac sizes with (hopefully) constant time modulo
* using Barrett reduction:
* q := (rotateOffset * m) >> k
* rotateOffset -= q * n
* if (n <= rotateOffset) rotateOffset -= n
*/
rotateOffset = macStart - scanStart;
/* rotateOffset < 255 + 1 + 48 = 304 */
if (macSize == 16) {
rotateOffset &= 15;
} else if (macSize == 20) {
/*
* Correctness: rotateOffset * ( 1/20 - 25/2^9 ) < 1
* with rotateOffset <= 853
*/
unsigned q = (rotateOffset * 25) >> 9; /* m = 25, k = 9 */
rotateOffset -= q * 20;
rotateOffset -= ssl_constantTimeSelect(ssl_ConstantTimeGE(rotateOffset, 20),
20, 0);
} else if (macSize == 32) {
rotateOffset &= 31;
} else if (macSize == 48) {
/*
* Correctness: rotateOffset * ( 1/48 - 10/2^9 ) < 1
* with rotateOffset < 768
*/
unsigned q = (rotateOffset * 10) >> 9; /* m = 25, k = 9 */
rotateOffset -= q * 48;
rotateOffset -= ssl_constantTimeSelect(ssl_ConstantTimeGE(rotateOffset, 48),
48, 0);
} else {
/*
* SHA384 (macSize == 48) is the largest we support. We should never
* get here.
*/
PORT_Assert(0);
rotateOffset = rotateOffset % macSize;
}
memset(rotatedMac, 0, macSize);
for (i = scanStart; i < originalLength;) {
@@ -11296,12 +11335,16 @@ ssl_CBCExtractMAC(sslBuffer *plaintext,
/* Now rotate the MAC. If we knew that the MAC fit into a CPU cache line
* we could line-align |rotatedMac| and rotate in place. */
memset(out, 0, macSize);
rotateOffset = macSize - rotateOffset;
rotateOffset = ssl_constantTimeSelect(ssl_ConstantTimeGE(rotateOffset, macSize),
0, rotateOffset);
for (i = 0; i < macSize; i++) {
unsigned char offset =
(divSpoiler + macSize - rotateOffset + i) % macSize;
for (j = 0; j < macSize; j++) {
out[j] |= rotatedMac[i] & ssl_ConstantTimeEQ8(j, offset);
}
out[j] |= rotatedMac[i] & ssl_ConstantTimeEQ8(j, rotateOffset);
}
rotateOffset++;
rotateOffset = ssl_constantTimeSelect(ssl_ConstantTimeGE(rotateOffset, macSize),
0, rotateOffset);
}
}
+3 -3
View File
@@ -19,11 +19,11 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <Beta>]"
*/
#define NSSUTIL_VERSION "3.19.4.2"
#define NSSUTIL_VERSION "3.19.5.0"
#define NSSUTIL_VMAJOR 3
#define NSSUTIL_VMINOR 19
#define NSSUTIL_VPATCH 4
#define NSSUTIL_VBUILD 2
#define NSSUTIL_VPATCH 5
#define NSSUTIL_VBUILD 0
#define NSSUTIL_BETA PR_FALSE
SEC_BEGIN_PROTOS