mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 898431: Update NSS to NSS 3.15.4 beta 5 (NSS_3_15_4_BETA5), r=me
This commit is contained in:
parent
e9a38e26b2
commit
4a26265906
@ -1 +1 @@
|
||||
NSS_3_15_4_BETA4
|
||||
NSS_3_15_4_BETA5
|
||||
|
@ -10,4 +10,3 @@
|
||||
*/
|
||||
|
||||
#error "Do not include this header file."
|
||||
|
||||
|
@ -959,7 +959,8 @@ void RNG_SystemInfoForRNG(void)
|
||||
size_t RNG_FileUpdate(const char *fileName, size_t limit)
|
||||
{
|
||||
FILE * file;
|
||||
size_t bytes;
|
||||
int fd;
|
||||
int bytes;
|
||||
size_t fileBytes = 0;
|
||||
struct stat stat_buf;
|
||||
unsigned char buffer[BUFSIZ];
|
||||
@ -974,10 +975,18 @@ size_t RNG_FileUpdate(const char *fileName, size_t limit)
|
||||
|
||||
file = fopen(fileName, "r");
|
||||
if (file != NULL) {
|
||||
/* Read from the underlying file descriptor directly to bypass stdio
|
||||
* buffering and avoid reading more bytes than we need from
|
||||
* /dev/urandom. NOTE: we can't use fread with unbuffered I/O because
|
||||
* fread may return EOF in unbuffered I/O mode on Android.
|
||||
*
|
||||
* Moreover, we read into a buffer of size BUFSIZ, so buffered I/O
|
||||
* has no performance advantage. */
|
||||
fd = fileno(file);
|
||||
while (limit > fileBytes) {
|
||||
bytes = PR_MIN(sizeof buffer, limit - fileBytes);
|
||||
bytes = fread(buffer, 1, bytes, file);
|
||||
if (bytes == 0)
|
||||
bytes = read(fd, buffer, bytes);
|
||||
if (bytes <= 0)
|
||||
break;
|
||||
RNG_RandomUpdate(buffer, bytes);
|
||||
fileBytes += bytes;
|
||||
@ -1126,7 +1135,8 @@ static void rng_systemJitter(void)
|
||||
size_t RNG_SystemRNG(void *dest, size_t maxLen)
|
||||
{
|
||||
FILE *file;
|
||||
size_t bytes;
|
||||
int fd;
|
||||
int bytes;
|
||||
size_t fileBytes = 0;
|
||||
unsigned char *buffer = dest;
|
||||
|
||||
@ -1134,10 +1144,16 @@ size_t RNG_SystemRNG(void *dest, size_t maxLen)
|
||||
if (file == NULL) {
|
||||
return rng_systemFromNoise(dest, maxLen);
|
||||
}
|
||||
/* Read from the underlying file descriptor directly to bypass stdio
|
||||
* buffering and avoid reading more bytes than we need from /dev/urandom.
|
||||
* NOTE: we can't use fread with unbuffered I/O because fread may return
|
||||
* EOF in unbuffered I/O mode on Android.
|
||||
*/
|
||||
fd = fileno(file);
|
||||
while (maxLen > fileBytes) {
|
||||
bytes = maxLen - fileBytes;
|
||||
bytes = fread(buffer, 1, bytes, file);
|
||||
if (bytes == 0)
|
||||
bytes = read(fd, buffer, bytes);
|
||||
if (bytes <= 0)
|
||||
break;
|
||||
fileBytes += bytes;
|
||||
buffer += bytes;
|
||||
|
@ -325,6 +325,12 @@ ssl3_GatherCompleteHandshake(sslSocket *ss, int flags)
|
||||
rv = ssl3_HandleRecord(ss, NULL, &ss->gs.buf);
|
||||
} else {
|
||||
/* bring in the next sslv3 record. */
|
||||
if (ss->recvdCloseNotify) {
|
||||
/* RFC 5246 Section 7.2.1:
|
||||
* Any data received after a closure alert is ignored.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
if (!IS_DTLS(ss)) {
|
||||
rv = ssl3_GatherData(ss, &ss->gs, flags);
|
||||
} else {
|
||||
@ -370,20 +376,19 @@ ssl3_GatherCompleteHandshake(sslSocket *ss, int flags)
|
||||
|
||||
cText.buf = &ss->gs.inbuf;
|
||||
rv = ssl3_HandleRecord(ss, &cText, &ss->gs.buf);
|
||||
|
||||
if (rv == (int) SECSuccess && ss->gs.buf.len > 0) {
|
||||
/* We have application data to return to the application. This
|
||||
* prioritizes returning application data to the application over
|
||||
* completing any renegotiation handshake we may be doing.
|
||||
*/
|
||||
PORT_Assert(ss->firstHsDone);
|
||||
PORT_Assert(cText.type == content_application_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rv < 0) {
|
||||
return ss->recvdCloseNotify ? 0 : rv;
|
||||
}
|
||||
if (ss->gs.buf.len > 0) {
|
||||
/* We have application data to return to the application. This
|
||||
* prioritizes returning application data to the application over
|
||||
* completing any renegotiation handshake we may be doing.
|
||||
*/
|
||||
PORT_Assert(ss->firstHsDone);
|
||||
PORT_Assert(cText.type == content_application_data);
|
||||
break;
|
||||
}
|
||||
|
||||
PORT_Assert(keepGoing);
|
||||
ssl_GetSSL3HandshakeLock(ss);
|
||||
|
@ -277,7 +277,7 @@ SSL_ReHandshake(PRFileDesc *fd, PRBool flushCache)
|
||||
|
||||
/* SSL v2 protocol does not support subsequent handshakes. */
|
||||
if (ss->version < SSL_LIBRARY_VERSION_3_0) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
PORT_SetError(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_SSL2);
|
||||
rv = SECFailure;
|
||||
} else {
|
||||
ssl_GetSSL3HandshakeLock(ss);
|
||||
@ -1237,7 +1237,6 @@ int
|
||||
ssl_SecureSend(sslSocket *ss, const unsigned char *buf, int len, int flags)
|
||||
{
|
||||
int rv = 0;
|
||||
PRBool falseStart = PR_FALSE;
|
||||
|
||||
SSL_TRC(2, ("%d: SSL[%d]: SecureSend: sending %d bytes",
|
||||
SSL_GETPID(), ss->fd, len));
|
||||
@ -1272,6 +1271,7 @@ ssl_SecureSend(sslSocket *ss, const unsigned char *buf, int len, int flags)
|
||||
ss->writerThread = PR_GetCurrentThread();
|
||||
/* If any of these is non-zero, the initial handshake is not done. */
|
||||
if (!ss->firstHsDone) {
|
||||
PRBool falseStart = PR_FALSE;
|
||||
ssl_Get1stHandshakeLock(ss);
|
||||
if (ss->opt.enableFalseStart &&
|
||||
ss->version >= SSL_LIBRARY_VERSION_3_0) {
|
||||
|
@ -1,4 +1,2 @@
|
||||
This directory contains patches that were added locally
|
||||
on top of the NSS release.
|
||||
|
||||
bug-935831.patch Backout the fix for bug 927230.
|
||||
|
@ -1,50 +0,0 @@
|
||||
# HG changeset patch
|
||||
# Parent cb500491e8a524edb44213d1a787adb98c385ecd
|
||||
# User Richard Newman <rnewman@mozilla.com>
|
||||
|
||||
Back out Bug 927230 for Android 2.3 startup crash. r=briansmith
|
||||
|
||||
diff --git a/security/nss/lib/freebl/unix_rand.c b/security/nss/lib/freebl/unix_rand.c
|
||||
--- a/security/nss/lib/freebl/unix_rand.c
|
||||
+++ b/security/nss/lib/freebl/unix_rand.c
|
||||
@@ -969,20 +969,16 @@ size_t RNG_FileUpdate(const char *fileNa
|
||||
memset(&stat_buf, 0, sizeof(stat_buf));
|
||||
|
||||
if (stat((char *)fileName, &stat_buf) < 0)
|
||||
return fileBytes;
|
||||
RNG_RandomUpdate(&stat_buf, sizeof(stat_buf));
|
||||
|
||||
file = fopen(fileName, "r");
|
||||
if (file != NULL) {
|
||||
- /* Set buffering mode to unbuffered I/O to avoid reading more bytes
|
||||
- * than we need from /dev/urandom. Moreover, we read into a buffer
|
||||
- * of size BUFSIZ, so buffered I/O has no performance advantage. */
|
||||
- setvbuf(file, NULL, _IONBF, 0);
|
||||
while (limit > fileBytes) {
|
||||
bytes = PR_MIN(sizeof buffer, limit - fileBytes);
|
||||
bytes = fread(buffer, 1, bytes, file);
|
||||
if (bytes == 0)
|
||||
break;
|
||||
RNG_RandomUpdate(buffer, bytes);
|
||||
fileBytes += bytes;
|
||||
totalFileBytes += bytes;
|
||||
@@ -1133,19 +1129,16 @@ size_t RNG_SystemRNG(void *dest, size_t
|
||||
size_t bytes;
|
||||
size_t fileBytes = 0;
|
||||
unsigned char *buffer = dest;
|
||||
|
||||
file = fopen("/dev/urandom", "r");
|
||||
if (file == NULL) {
|
||||
return rng_systemFromNoise(dest, maxLen);
|
||||
}
|
||||
- /* Set buffering mode to unbuffered I/O to avoid reading more bytes
|
||||
- * than we need from /dev/urandom. */
|
||||
- setvbuf(file, NULL, _IONBF, 0);
|
||||
while (maxLen > fileBytes) {
|
||||
bytes = maxLen - fileBytes;
|
||||
bytes = fread(buffer, 1, bytes, file);
|
||||
if (bytes == 0)
|
||||
break;
|
||||
fileBytes += bytes;
|
||||
buffer += bytes;
|
||||
}
|
Loading…
Reference in New Issue
Block a user