From 72dcc26c7af47fff906123f1afb3510a0c22b28c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 20 Jun 2014 12:02:13 +0200 Subject: [PATCH 01/24] doc: buffer: clarify typed array construction It's possible to construct a typed array from a buffer but the buffer is treated as an array, not a byte array as one might expect. Fixes #7786. Signed-off-by: Trevor Norris --- doc/api/buffer.markdown | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/api/buffer.markdown b/doc/api/buffer.markdown index fa52ae48c3..b042300d3a 100644 --- a/doc/api/buffer.markdown +++ b/doc/api/buffer.markdown @@ -41,9 +41,14 @@ encoding method. Here are the different string encodings. * `'hex'` - Encode each byte as two hexadecimal characters. -A `Buffer` object can also be used with typed arrays. The buffer object is -cloned to an `ArrayBuffer` that is used as the backing store for the typed -array. The memory of the buffer and the `ArrayBuffer` is not shared. +Creating a typed array from a `Buffer` works with the following caveats: + +1. The buffer's memory is copied, not shared. + +2. The buffer's memory is interpreted as an array, not a byte array. That is, + `new Uint32Array(new Buffer([1,2,3,4]))` creates a 4-element `Uint32Array` + with elements `[1,2,3,4]`, not an `Uint32Array` with a single element + `[0x1020304]` or `[0x4030201]`. NOTE: Node.js v0.8 simply retained a reference to the buffer in `array.buffer` instead of cloning it. From ee95e4f5f76cc2ac637ab53056a7c514bc49e13c Mon Sep 17 00:00:00 2001 From: Nick Apperson Date: Tue, 25 Mar 2014 09:51:13 -0500 Subject: [PATCH 02/24] buffer: improve {read,write}{U}Int* methods Increase the performance and simplify the logic of Buffer#write{U}Int* and Buffer#read{U}Int* methods by placing the byte manipulation code directly inline. Also improve the speed of buffer-write benchmarks by creating a new call directly to each method by using Function() instead of calling by buff[fn]. Signed-off-by: Trevor Norris Conflicts: lib/buffer.js --- benchmark/buffers/buffer-read.js | 9 +- benchmark/buffers/buffer-write.js | 24 ++-- lib/buffer.js | 230 +++++++----------------------- 3 files changed, 71 insertions(+), 192 deletions(-) diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js index fccd99dcd2..92138bccef 100644 --- a/benchmark/buffers/buffer-read.js +++ b/benchmark/buffers/buffer-read.js @@ -20,9 +20,12 @@ function main(conf) { var fn = 'read' + conf.type; buff.writeDoubleLE(0, 0, noAssert); + var testFunction = new Function('buff', [ + "for (var i = 0; i !== " + len + "; i++) {", + " buff." + fn + "(0, " + JSON.stringify(noAssert) + ");", + "}" + ].join("\n")); bench.start(); - for (var i = 0; i < len; i++) { - buff[fn](0, noAssert); - } + testFunction(buff); bench.end(len / 1e6); } diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js index 4dbfcb6096..2a2a0e37e3 100644 --- a/benchmark/buffers/buffer-write.js +++ b/benchmark/buffers/buffer-write.js @@ -15,9 +15,9 @@ var bench = common.createBenchmark(main, { const INT8 = 0x7f; const INT16 = 0x7fff; const INT32 = 0x7fffffff; -const UINT8 = INT8 * 2; -const UINT16 = INT16 * 2; -const UINT32 = INT32 * 2; +const UINT8 = (INT8 * 2) + 1; +const UINT16 = (INT16 * 2) + 1; +const UINT32 = INT32; var mod = { writeInt8: INT8, @@ -47,17 +47,23 @@ function main(conf) { function benchInt(buff, fn, len, noAssert) { var m = mod[fn]; + var testFunction = new Function('buff', [ + "for (var i = 0; i !== " + len + "; i++) {", + " buff." + fn + "(i & " + m + ", 0, " + JSON.stringify(noAssert) + ");", + "}" + ].join("\n")); bench.start(); - for (var i = 0; i < len; i++) { - buff[fn](i % m, 0, noAssert); - } + testFunction(buff); bench.end(len / 1e6); } function benchFloat(buff, fn, len, noAssert) { + var testFunction = new Function('buff', [ + "for (var i = 0; i !== " + len + "; i++) {", + " buff." + fn + "(i, 0, " + JSON.stringify(noAssert) + ");", + "}" + ].join("\n")); bench.start(); - for (var i = 0; i < len; i++) { - buff[fn](i * 0.1, 0, noAssert); - } + testFunction(buff); bench.end(len / 1e6); } diff --git a/lib/buffer.js b/lib/buffer.js index 51406b6ed6..39facdecbb 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -590,112 +590,41 @@ Buffer.prototype.readUInt8 = function(offset, noAssert) { }; -function readUInt16(buffer, offset, isBigEndian) { - var val = 0; - if (isBigEndian) { - val = buffer[offset] << 8; - val |= buffer[offset + 1]; - } else { - val = buffer[offset]; - val |= buffer[offset + 1] << 8; - } - - return val; -} - - Buffer.prototype.readUInt16LE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); - return readUInt16(this, offset, false, noAssert); + return this[offset] | (this[offset + 1] << 8); }; Buffer.prototype.readUInt16BE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); - return readUInt16(this, offset, true, noAssert); + return (this[offset] << 8) | this[offset + 1]; }; -function readUInt32(buffer, offset, isBigEndian, noAssert) { - var val = 0; - - if (isBigEndian) { - val = buffer[offset + 1] << 16; - val |= buffer[offset + 2] << 8; - val |= buffer[offset + 3]; - val = val + (buffer[offset] << 24 >>> 0); - } else { - val = buffer[offset + 2] << 16; - val |= buffer[offset + 1] << 8; - val |= buffer[offset]; - val = val + (buffer[offset + 3] << 24 >>> 0); - } - - return val; -} - - Buffer.prototype.readUInt32LE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); - return readUInt32(this, offset, false, noAssert); + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000); }; Buffer.prototype.readUInt32BE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); - return readUInt32(this, offset, true, noAssert); -}; + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8)) | + (this[offset + 3]); +}; -/* - * Signed integer types, yay team! A reminder on how two's complement actually - * works. The first bit is the signed bit, i.e. tells us whether or not the - * number should be positive or negative. If the two's complement value is - * positive, then we're done, as it's equivalent to the unsigned representation. - * - * Now if the number is positive, you're pretty much done, you can just leverage - * the unsigned translations and return those. Unfortunately, negative numbers - * aren't quite that straightforward. - * - * At first glance, one might be inclined to use the traditional formula to - * translate binary numbers between the positive and negative values in two's - * complement. (Though it doesn't quite work for the most negative value) - * Mainly: - * - invert all the bits - * - add one to the result - * - * Of course, this doesn't quite work in Javascript. Take for example the value - * of -128. This could be represented in 16 bits (big-endian) as 0xff80. But of - * course, Javascript will do the following: - * - * > ~0xff80 - * -65409 - * - * Whoh there, Javascript, that's not quite right. But wait, according to - * Javascript that's perfectly correct. When Javascript ends up seeing the - * constant 0xff80, it has no notion that it is actually a signed number. It - * assumes that we've input the unsigned value 0xff80. Thus, when it does the - * binary negation, it casts it into a signed value, (positive 0xff80). Then - * when you perform binary negation on that, it turns it into a negative number. - * - * Instead, we're going to have to use the following general formula, that works - * in a rather Javascript friendly way. I'm glad we don't support this kind of - * weird numbering scheme in the kernel. - * - * (BIT-MAX - (unsigned)val + 1) * -1 - * - * The astute observer, may think that this doesn't make sense for 8-bit numbers - * (really it isn't necessary for them). However, when you get 16-bit numbers, - * you do. Let's go back to our prior example and see how this will look: - * - * (0xffff - 0xff80 + 1) * -1 - * (0x007f + 1) * -1 - * (0x0080) * -1 - */ Buffer.prototype.readInt8 = function(offset, noAssert) { if (!noAssert) @@ -706,49 +635,41 @@ Buffer.prototype.readInt8 = function(offset, noAssert) { }; -function readInt16(buffer, offset, isBigEndian) { - var val = readUInt16(buffer, offset, isBigEndian); - - if (!(val & 0x8000)) - return val; - return (0xffff - val + 1) * -1; -} - - Buffer.prototype.readInt16LE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); - return readInt16(this, offset, false); + var val = this[offset] | (this[offset + 1] << 8); + return (val & 0x8000) ? val | 0xFFFF0000 : val; }; Buffer.prototype.readInt16BE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); - return readInt16(this, offset, true); + var val = this[offset + 1] | (this[offset] << 8); + return (val & 0x8000) ? val | 0xFFFF0000 : val; }; -function readInt32(buffer, offset, isBigEndian) { - var val = readUInt32(buffer, offset, isBigEndian); - - if (!(val & 0x80000000)) - return (val); - return (0xffffffff - val + 1) * -1; -} - - Buffer.prototype.readInt32LE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); - return readInt32(this, offset, false); + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24); }; Buffer.prototype.readInt32BE = function(offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); - return readInt32(this, offset, true); + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]); }; Buffer.prototype.readFloatLE = function(offset, noAssert) { @@ -796,97 +717,42 @@ Buffer.prototype.writeUInt8 = function(value, offset, noAssert) { }; -function writeUInt16(buffer, value, offset, isBigEndian) { - if (isBigEndian) { - buffer[offset] = (value & 0xff00) >>> 8; - buffer[offset + 1] = value & 0x00ff; - } else { - buffer[offset + 1] = (value & 0xff00) >>> 8; - buffer[offset] = value & 0x00ff; - } -} - - Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - writeUInt16(this, value, offset, false); + this[offset] = value; + this[offset + 1] = (value >>> 8); }; Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - writeUInt16(this, value, offset, true); + this[offset] = (value >>> 8); + this[offset + 1] = value; }; -function writeUInt32(buffer, value, offset, isBigEndian) { - if (isBigEndian) { - buffer[offset] = (value >>> 24) & 0xff; - buffer[offset + 1] = (value >>> 16) & 0xff; - buffer[offset + 2] = (value >>> 8) & 0xff; - buffer[offset + 3] = value & 0xff; - } else { - buffer[offset + 3] = (value >>> 24) & 0xff; - buffer[offset + 2] = (value >>> 16) & 0xff; - buffer[offset + 1] = (value >>> 8) & 0xff; - buffer[offset] = value & 0xff; - } -} - - Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - writeUInt32(this, value, offset, false); + this[offset + 3] = (value >>> 24); + this[offset + 2] = (value >>> 16); + this[offset + 1] = (value >>> 8); + this[offset] = value; }; Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - writeUInt32(this, value, offset, true); + this[offset] = (value >>> 24); + this[offset + 1] = (value >>> 16); + this[offset + 2] = (value >>> 8); + this[offset + 3] = value; }; -/* - * We now move onto our friends in the signed number category. Unlike unsigned - * numbers, we're going to have to worry a bit more about how we put values into - * arrays. Since we are only worrying about signed 32-bit values, we're in - * slightly better shape. Unfortunately, we really can't do our favorite binary - * & in this system. It really seems to do the wrong thing. For example: - * - * > -32 & 0xff - * 224 - * - * What's happening above is really: 0xe0 & 0xff = 0xe0. However, the results of - * this aren't treated as a signed number. Ultimately a bad thing. - * - * What we're going to want to do is basically create the unsigned equivalent of - * our representation and pass that off to the wuint* functions. To do that - * we're going to do the following: - * - * - if the value is positive - * we can pass it directly off to the equivalent wuint - * - if the value is negative - * we do the following computation: - * mb + val + 1, where - * mb is the maximum unsigned value in that byte size - * val is the Javascript negative integer - * - * - * As a concrete value, take -128. In signed 16 bits this would be 0xff80. If - * you do out the computations: - * - * 0xffff - 128 + 1 - * 0xffff - 127 - * 0xff80 - * - * You can then encode this value as the signed version. This is really rather - * hacky, but it should work and get the job done which is our goal here. - */ - Buffer.prototype.writeInt8 = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); @@ -898,32 +764,36 @@ Buffer.prototype.writeInt8 = function(value, offset, noAssert) { Buffer.prototype.writeInt16LE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); - if (value < 0) value = 0xffff + value + 1; - writeUInt16(this, value, offset, false); + this[offset] = value; + this[offset + 1] = (value >>> 8); }; Buffer.prototype.writeInt16BE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); - if (value < 0) value = 0xffff + value + 1; - writeUInt16(this, value, offset, true); + this[offset] = (value >>> 8); + this[offset + 1] = value; }; Buffer.prototype.writeInt32LE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); - if (value < 0) value = 0xffffffff + value + 1; - writeUInt32(this, value, offset, false); + this[offset] = value; + this[offset + 1] = (value >>> 8); + this[offset + 2] = (value >>> 16); + this[offset + 3] = (value >>> 24); }; Buffer.prototype.writeInt32BE = function(value, offset, noAssert) { if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); - if (value < 0) value = 0xffffffff + value + 1; - writeUInt32(this, value, offset, true); + this[offset] = (value >>> 24); + this[offset + 1] = (value >>> 16); + this[offset + 2] = (value >>> 8); + this[offset + 3] = value; }; From c94afdccf32443c9dd5a351fdfe1f19906327138 Mon Sep 17 00:00:00 2001 From: Oguz Bastemur Date: Fri, 13 Jun 2014 11:36:52 +0200 Subject: [PATCH 03/24] util.h: interface compatibility Signed-off-by: Fedor Indutny --- src/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.h b/src/util.h index 0dbf7f4710..fbfaf7aac1 100644 --- a/src/util.h +++ b/src/util.h @@ -64,7 +64,7 @@ class Utf8Value { return str_; }; - size_t length() { + size_t length() const { return length_; }; From a97bdef06d1451c39df3a4a46f85f285c552a9df Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Wed, 11 Jun 2014 21:11:28 -0700 Subject: [PATCH 04/24] zlib: do not crash on write after close fix #7767 Signed-off-by: Fedor Indutny --- lib/zlib.js | 4 +++ test/simple/test-zlib-write-after-close.js | 40 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 test/simple/test-zlib-write-after-close.js diff --git a/lib/zlib.js b/lib/zlib.js index a1896baeb8..c72ab92dcd 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -320,6 +320,7 @@ function Zlib(opts, mode) { util.inherits(Zlib, Transform); Zlib.prototype.reset = function reset() { + assert(!this._closed, 'zlib binding closed'); return this._binding.reset(); }; @@ -394,6 +395,8 @@ Zlib.prototype._transform = function(chunk, encoding, cb) { var availOutBefore = this._chunkSize - this._offset; var inOff = 0; + if (this._closed) + return cb(new Error('zlib binding closed')); var req = this._binding.write(flushFlag, chunk, // in inOff, // in_off @@ -435,6 +438,7 @@ Zlib.prototype._transform = function(chunk, encoding, cb) { inOff += (availInBefore - availInAfter); availInBefore = availInAfter; + assert(!self._closed, 'zlib binding closed'); var newReq = self._binding.write(flushFlag, chunk, inOff, diff --git a/test/simple/test-zlib-write-after-close.js b/test/simple/test-zlib-write-after-close.js new file mode 100644 index 0000000000..d3f3d4e6b3 --- /dev/null +++ b/test/simple/test-zlib-write-after-close.js @@ -0,0 +1,40 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var common = require('../common.js'); +var assert = require('assert'); +var zlib = require('zlib'); + +var closed = false; + +zlib.gzip('hello', function(err, out) { + var unzip = zlib.createGunzip(); + unzip.close(function() { + closed = true; + }); + assert.throws(function() { + unzip.write(out); + }); +}); + +process.on('exit', function() { + assert(closed); +}); From 4128d4d2ba8f346cab2b062f57ae4cb4831e7bb5 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 30 Jun 2014 13:06:35 +0400 Subject: [PATCH 05/24] Revert "stream: start old-mode read in a next tick" This reverts commit 2efe4ab7616669448f873b0417e9aa81221324e2. --- lib/_stream_readable.js | 14 +------ lib/http.js | 2 +- .../test-stream-readable-data-sync-race.js | 41 ------------------- test/simple/test-stream2-compatibility.js | 4 +- 4 files changed, 4 insertions(+), 57 deletions(-) delete mode 100644 test/simple/test-stream-readable-data-sync-race.js diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index e447b7ca32..1d486cf7b7 100755 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -87,9 +87,6 @@ function ReadableState(options, stream) { // if true, a maybeReadMore has been scheduled this.readingMore = false; - // if true, stream is in old mode - this.oldMode = false; - this.decoder = null; this.encoding = null; if (options.encoding) { @@ -769,15 +766,8 @@ function emitDataEvents(stream, startPaused) { this.emit('resume'); }; - // Start reading in next tick to allow caller to set event listeners on - // the stream object (like 'error') - process.nextTick(function() { - // now make it start, just in case it hadn't already. - stream.emit('readable'); - }); - - // Let others know about our mode - state.oldMode = true; + // now make it start, just in case it hadn't already. + stream.emit('readable'); } // wrap an old-style stream as the async data source. diff --git a/lib/http.js b/lib/http.js index 5f84c4da8a..0623668c9d 100644 --- a/lib/http.js +++ b/lib/http.js @@ -2078,7 +2078,7 @@ function connectionListener(socket) { // if the user never called req.read(), and didn't pipe() or // .resume() or .on('data'), then we call req._dump() so that the // bytes will be pulled off the wire. - if (!req._consuming && !req._readableState.oldMode) + if (!req._consuming) req._dump(); res.detachSocket(socket); diff --git a/test/simple/test-stream-readable-data-sync-race.js b/test/simple/test-stream-readable-data-sync-race.js deleted file mode 100644 index 5bbfcc88ae..0000000000 --- a/test/simple/test-stream-readable-data-sync-race.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); - -var Readable = require('stream').Readable; - -var r = new Readable(); -var errors = 0; - -// Setting `data` listener should not trigger `_read()` calls before we will -// set the `error` listener below -r.on('data', function() { -}); - -r.on('error', function() { - errors++; -}); - -process.on('exit', function() { - assert.equal(errors, 1); -}); diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js index fa58b03c72..2b98c1fa8f 100644 --- a/test/simple/test-stream2-compatibility.js +++ b/test/simple/test-stream2-compatibility.js @@ -47,6 +47,4 @@ TestReader.prototype._read = function(n) { }; var reader = new TestReader(); -process.nextTick(function() { - assert.equal(ondataCalled, 1); -}); +assert.equal(ondataCalled, 1); From 47ee9a48a842126af628d41450fd38a70e5408cc Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 30 Jun 2014 12:43:28 +0400 Subject: [PATCH 06/24] Revert "src: fix _XOPEN_SOURCE redefinition warning" This reverts commit 885142a5edc2c803fa8b9d92b5d0771379237764. Signed-off-by: Trevor Norris --- src/node_constants.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/node_constants.cc b/src/node_constants.cc index adb6f28181..d364fb2df4 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -19,21 +19,11 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// O_NONBLOCK is not exported unless _XOPEN_SOURCE >= 500. -#if defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 500 -#undef _XOPEN_SOURCE -#endif - -#if !defined(_XOPEN_SOURCE) -#define _XOPEN_SOURCE 500 -#endif - #include "node_constants.h" #include "uv.h" #include -#include #if !defined(_MSC_VER) #include #endif @@ -41,6 +31,10 @@ #include #include +// O_NONBLOCK is not exported, unless _XOPEN_SOURCE is set +#define _XOPEN_SOURCE 500 +#include + #if HAVE_OPENSSL # include #endif From 7cb38309fe96e0ec913af9f13b8ebbe0555ee67a Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 30 Jun 2014 12:43:30 +0400 Subject: [PATCH 07/24] Revert "constants: export O_NONBLOCK" This reverts commit 00890e43fb935c8bc5dc150f0f2c96bc465d8a4d. Signed-off-by: Trevor Norris --- src/node_constants.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/node_constants.cc b/src/node_constants.cc index d364fb2df4..2aea278cb6 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -27,14 +27,11 @@ #if !defined(_MSC_VER) #include #endif +#include #include #include #include -// O_NONBLOCK is not exported, unless _XOPEN_SOURCE is set -#define _XOPEN_SOURCE 500 -#include - #if HAVE_OPENSSL # include #endif @@ -113,10 +110,6 @@ void DefineConstants(Handle target) { NODE_DEFINE_CONSTANT(target, O_DIRECT); #endif -#ifdef O_NONBLOCK - NODE_DEFINE_CONSTANT(target, O_NONBLOCK); -#endif - #ifdef S_IRWXU NODE_DEFINE_CONSTANT(target, S_IRWXU); #endif From 9cbfd6ef51899dd869a8ec809766cf06d14c9a36 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 30 Jun 2014 12:43:47 +0400 Subject: [PATCH 08/24] constants: add O_NONBLOCK constant It appears that it is defined unconditionally on all supported unixes. fix #7867 #7855 Signed-off-by: Trevor Norris --- src/node_constants.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node_constants.cc b/src/node_constants.cc index 2aea278cb6..863a7c6ed9 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -110,6 +110,10 @@ void DefineConstants(Handle target) { NODE_DEFINE_CONSTANT(target, O_DIRECT); #endif +#ifdef O_NONBLOCK + NODE_DEFINE_CONSTANT(target, O_NONBLOCK); +#endif + #ifdef S_IRWXU NODE_DEFINE_CONSTANT(target, S_IRWXU); #endif From c7c904b1fc84aed16eea35bf02d5bd5b52c575f7 Mon Sep 17 00:00:00 2001 From: Brian White Date: Mon, 30 Jun 2014 11:06:47 -0400 Subject: [PATCH 09/24] doc: fix createCipher description Signed-off-by: Trevor Norris --- doc/api/crypto.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown index 5323e128a6..9ca6f22cf7 100644 --- a/doc/api/crypto.markdown +++ b/doc/api/crypto.markdown @@ -162,8 +162,8 @@ which must be a `'binary'` encoded string or a [buffer](buffer.html). It is a [stream](stream.html) that is both readable and writable. The written data is used to compute the hash. Once the writable side of -the stream is ended, use the `read()` method to get the computed hash -digest. The legacy `update` and `digest` methods are also supported. +the stream is ended, use the `read()` method to get the enciphered +contents. The legacy `update` and `final` methods are also supported. ## crypto.createCipheriv(algorithm, key, iv) From 449ffecbb0608d1f222184d9f241697aede18c80 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Wed, 2 Jul 2014 13:32:11 -0700 Subject: [PATCH 10/24] configure: fix v8 overriding commands on build V8 seems to ignore the default value for want_separate_host_toolset and would override it at build time. Instead always explicitly set the value. Fixes #7833 --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 90caa7c831..ecd375a144 100755 --- a/configure +++ b/configure @@ -473,6 +473,8 @@ def configure_node(o): if target_arch != host_arch and not options.without_snapshot: o['variables']['want_separate_host_toolset'] = 1 + else: + o['variables']['want_separate_host_toolset'] = 0 if target_arch == 'arm': configure_arm(o) From 11337db35f6826c3f8f4c76eafd5ebf1c17294d7 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Wed, 2 Jul 2014 19:35:50 +0200 Subject: [PATCH 11/24] deps: cherry-pick eca441b2 from OpenSSL Original commit message: bn_exp.c: fix x86_64-specific crash with one-word modulus. PR: #3397 Signed-off-by: Fedor Indutny --- deps/openssl/openssl/crypto/bn/bn_exp.c | 2 +- test/simple/test-crypto-dh-odd-key.js | 31 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 test/simple/test-crypto-dh-odd-key.js diff --git a/deps/openssl/openssl/crypto/bn/bn_exp.c b/deps/openssl/openssl/crypto/bn/bn_exp.c index 2abf6fd678..5e7eb3373f 100644 --- a/deps/openssl/openssl/crypto/bn/bn_exp.c +++ b/deps/openssl/openssl/crypto/bn/bn_exp.c @@ -680,7 +680,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, /* Dedicated window==4 case improves 512-bit RSA sign by ~15%, but as * 512-bit RSA is hardly relevant, we omit it to spare size... */ - if (window==5) + if (window==5 && top>1) { void bn_mul_mont_gather5(BN_ULONG *rp,const BN_ULONG *ap, const void *table,const BN_ULONG *np, diff --git a/test/simple/test-crypto-dh-odd-key.js b/test/simple/test-crypto-dh-odd-key.js new file mode 100644 index 0000000000..a3d99e9b55 --- /dev/null +++ b/test/simple/test-crypto-dh-odd-key.js @@ -0,0 +1,31 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var common = require('../common'); +var assert = require('assert'); + +var crypto = require('crypto'); +var odd = new Buffer(39); +odd.fill('A'); + +var c = crypto.createDiffieHellman(32); +c.setPrivateKey(odd); +c.generateKeys(); From e2f2a202791293f2152a382852885bfd5eaf87e4 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Sat, 5 Jul 2014 14:22:45 -0700 Subject: [PATCH 12/24] doc: fix console.assert docs, message is a format Documentation for console.assert incorrectly described message as a single message, but it is a format. Signed-off-by: Fedor Indutny --- doc/api/console.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/console.markdown b/doc/api/console.markdown index e53902f7ad..e7807feeaf 100644 --- a/doc/api/console.markdown +++ b/doc/api/console.markdown @@ -66,10 +66,10 @@ Finish timer, record output. Example: Print a stack trace to stderr of the current position. -## console.assert(expression, [message]) +## console.assert(value, [message], [...]) -Same as [assert.ok()][] where if the `expression` evaluates as `false` throw an -AssertionError with `message`. +Similar to [assert.ok()][], but the error message is formatted as +`util.format(message...)`. [assert.ok()]: assert.html#assert_assert_value_message_assert_ok_value_message [util.format()]: util.html#util_util_format_format From 71fc4d9486ed13276e0f27ab755e6e233d91c714 Mon Sep 17 00:00:00 2001 From: Maurice Butler Date: Mon, 7 Jul 2014 16:29:59 +1000 Subject: [PATCH 13/24] doc: added X.json to the LOAD_AS_FILE sudo code Signed-off-by: Fedor Indutny --- doc/api/modules.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/modules.markdown b/doc/api/modules.markdown index a9c503448e..7632d30e54 100644 --- a/doc/api/modules.markdown +++ b/doc/api/modules.markdown @@ -385,7 +385,8 @@ in pseudocode of what require.resolve does: LOAD_AS_FILE(X) 1. If X is a file, load X as JavaScript text. STOP 2. If X.js is a file, load X.js as JavaScript text. STOP - 3. If X.node is a file, load X.node as binary addon. STOP + 3. If X.json is a file, parse X.json to a JavaScript Object. STOP + 4. If X.node is a file, load X.node as binary addon. STOP LOAD_AS_DIRECTORY(X) 1. If X/package.json is a file, From b87ca794e31096b61ead46911baf92ba1c020a7d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 8 Jul 2014 21:06:05 -0400 Subject: [PATCH 14/24] lib: remove and restructure calls to isNaN() Switch condition order to check for null before calling isNaN(). Also remove two unnecessary calls to isNaN() that are already covered by calls to isFinite(). This commit targets v0.10, as opposed to #7891, which targets master (suggested by @bnoordhuis). Closes #7840. Signed-off-by: Fedor Indutny --- lib/_stream_readable.js | 2 +- lib/assert.js | 2 +- lib/net.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 1d486cf7b7..bf47e5ec1c 100755 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -218,7 +218,7 @@ function howMuchToRead(n, state) { if (state.objectMode) return n === 0 ? 0 : 1; - if (isNaN(n) || n === null) { + if (n === null || isNaN(n)) { // only flow one buffer at a time if (state.flowing && state.buffer.length) return state.buffer[0].length; diff --git a/lib/assert.js b/lib/assert.js index 52b89baef6..c9b71d4499 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -54,7 +54,7 @@ function replacer(key, value) { if (value === undefined) { return '' + value; } - if (typeof value === 'number' && (isNaN(value) || !isFinite(value))) { + if (typeof value === 'number' && !isFinite(value)) { return value.toString(); } if (typeof value === 'function' || value instanceof RegExp) { diff --git a/lib/net.js b/lib/net.js index 047f8cd2f0..bc336934b1 100644 --- a/lib/net.js +++ b/lib/net.js @@ -306,7 +306,7 @@ Socket.prototype.listen = function() { Socket.prototype.setTimeout = function(msecs, callback) { - if (msecs > 0 && !isNaN(msecs) && isFinite(msecs)) { + if (msecs > 0 && isFinite(msecs)) { timers.enroll(this, msecs); timers._unrefActive(this); if (callback) { From 7f86baf5c7713b6bd541b549352795fe8a55b9de Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sat, 12 Jul 2014 12:35:26 +0300 Subject: [PATCH 15/24] child_process: handle writeUtf8String error When handling `writeUtf8String` error, return after emitting it. Otherwise a runtime failure can occur. fix #7923 --- lib/child_process.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/child_process.js b/lib/child_process.js index a07f2d1a42..e19f4ff89d 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -466,6 +466,7 @@ function setupChannel(target, channel) { 'write', 'cannot write to IPC channel.'); this.emit('error', er); + return; } else if (handle && !this._handleQueue) { this._handleQueue = []; } From a96d6603b3be28b97029d5d150e761aeb172434d Mon Sep 17 00:00:00 2001 From: Chris Dickinson Date: Wed, 9 Jul 2014 02:16:45 -0700 Subject: [PATCH 16/24] stream2: flush extant data on read of ended stream A ReadableStream with a base64 StringDecoder backed by only one or two bytes would fail to output its partial data before ending. This fix adds a check to see if the `read` was triggered by an internal `flow`, and if so, empties any remaining data. fixes #7914. Signed-off-by: Fedor Indutny --- lib/_stream_readable.js | 23 +++++++- ...est-stream2-base64-single-char-read-end.js | 58 +++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 test/simple/test-stream2-base64-single-char-read-end.js diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index bf47e5ec1c..ae04f22fe9 100755 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -253,6 +253,7 @@ Readable.prototype.read = function(n) { var state = this._readableState; state.calledRead = true; var nOrig = n; + var ret; if (typeof n !== 'number' || n > 0) state.emittedReadable = false; @@ -271,9 +272,28 @@ Readable.prototype.read = function(n) { // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { + ret = null; + + // In cases where the decoder did not receive enough data + // to produce a full chunk, then immediately received an + // EOF, state.buffer will contain [, ]. + // howMuchToRead will see this and coerce the amount to + // read to zero (because it's looking at the length of the + // first in state.buffer), and we'll end up here. + // + // This can only happen via state.decoder -- no other venue + // exists for pushing a zero-length chunk into state.buffer + // and triggering this behavior. In this case, we return our + // remaining data and end the stream, if appropriate. + if (state.length > 0 && state.decoder) { + ret = fromList(n, state); + state.length -= ret.length; + } + if (state.length === 0) endReadable(this); - return null; + + return ret; } // All the actual chunk generation logic needs to be @@ -327,7 +347,6 @@ Readable.prototype.read = function(n) { if (doRead && !state.reading) n = howMuchToRead(nOrig, state); - var ret; if (n > 0) ret = fromList(n, state); else diff --git a/test/simple/test-stream2-base64-single-char-read-end.js b/test/simple/test-stream2-base64-single-char-read-end.js new file mode 100644 index 0000000000..5a3834128c --- /dev/null +++ b/test/simple/test-stream2-base64-single-char-read-end.js @@ -0,0 +1,58 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + +var common = require('../common.js'); +var R = require('_stream_readable'); +var W = require('_stream_writable'); +var assert = require('assert'); + +var src = new R({encoding: 'base64'}); +var dst = new W(); +var hasRead = false; +var accum = []; +var timeout; + +src._read = function(n) { + if(!hasRead) { + hasRead = true; + process.nextTick(function() { + src.push(new Buffer('1')); + src.push(null); + }); + }; +}; + +dst._write = function(chunk, enc, cb) { + accum.push(chunk); + cb(); +}; + +src.on('end', function() { + assert.equal(Buffer.concat(accum) + '', 'MQ=='); + clearTimeout(timeout); +}) + +src.pipe(dst); + +timeout = setTimeout(function() { + assert.fail('timed out waiting for _write'); +}, 100); From 9d9fc3fa3063c9117119c56e69679269250c1213 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Tue, 15 Jul 2014 12:43:59 +0400 Subject: [PATCH 17/24] lib: jslint string_decoder.js --- lib/string_decoder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/string_decoder.js b/lib/string_decoder.js index 4a458334ec..fd11e51c8d 100644 --- a/lib/string_decoder.js +++ b/lib/string_decoder.js @@ -82,8 +82,8 @@ StringDecoder.prototype.write = function(buffer) { while (this.charLength) { // determine how many remaining bytes this buffer has to offer for this char var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; + this.charLength - this.charReceived : + buffer.length; // add the new bytes to the char buffer buffer.copy(this.charBuffer, this.charReceived, 0, available); From 1d3d8c0e5545b1f253dbe4c3525eeb2f1312b689 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Thu, 17 Jul 2014 09:55:07 +0400 Subject: [PATCH 18/24] gyp: do not let `v8dbg_` slip away on osx Pass `-force_load` to linker when linking to `libv8_base` to preserve `v8dbg_` symbols, which are useful for debugging. --- common.gypi | 2 +- node.gyp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index c05b793e95..542214218a 100644 --- a/common.gypi +++ b/common.gypi @@ -21,7 +21,7 @@ ['OS != "win"', { 'v8_postmortem_support': 'true' }], - ['GENERATOR == "ninja"', { + ['GENERATOR == "ninja" or OS== "mac"', { 'OBJ_DIR': '<(PRODUCT_DIR)/obj', 'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a', }, { diff --git a/node.gyp b/node.gyp index f6586c4d44..38311a1cc4 100644 --- a/node.gyp +++ b/node.gyp @@ -271,6 +271,14 @@ 'PLATFORM="darwin"', ], }], + [ 'OS=="mac" and v8_postmortem_support=="true"', { + # Do not let `v8dbg_` symbols slip away + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-Wl,-force_load,<(V8_BASE)', + ], + }, + }], [ 'OS=="freebsd"', { 'libraries': [ '-lutil', From 3530fa9cd09f8db8101c4649cab03bcdf760c434 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Fri, 21 Dec 2012 17:52:00 +0000 Subject: [PATCH 19/24] deps: backport 4ed5fde4f from v8 upstream Original commit message: Fix x64 MathMinMax for negative untagged int32 arguments. An untagged int32 has zeros in the upper half even if it is negative. Using cmpq to compare such numbers will incorrectly ignore the sign. BUG=164442 R=mvstanton@chromium.org Review URL: https://chromiumcodereview.appspot.com/11665007 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@13273 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 Signed-off-by: Fedor Indutny --- deps/v8/src/x64/lithium-codegen-x64.cc | 6 +-- .../v8/test/mjsunit/regress/regress-164442.js | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-164442.js diff --git a/deps/v8/src/x64/lithium-codegen-x64.cc b/deps/v8/src/x64/lithium-codegen-x64.cc index b461e62903..ff01f44a56 100644 --- a/deps/v8/src/x64/lithium-codegen-x64.cc +++ b/deps/v8/src/x64/lithium-codegen-x64.cc @@ -1457,17 +1457,17 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) { if (right->IsConstantOperand()) { Immediate right_imm = Immediate(ToInteger32(LConstantOperand::cast(right))); - __ cmpq(left_reg, right_imm); + __ cmpl(left_reg, right_imm); __ j(condition, &return_left, Label::kNear); __ movq(left_reg, right_imm); } else if (right->IsRegister()) { Register right_reg = ToRegister(right); - __ cmpq(left_reg, right_reg); + __ cmpl(left_reg, right_reg); __ j(condition, &return_left, Label::kNear); __ movq(left_reg, right_reg); } else { Operand right_op = ToOperand(right); - __ cmpq(left_reg, right_op); + __ cmpl(left_reg, right_op); __ j(condition, &return_left, Label::kNear); __ movq(left_reg, right_op); } diff --git a/deps/v8/test/mjsunit/regress/regress-164442.js b/deps/v8/test/mjsunit/regress/regress-164442.js new file mode 100644 index 0000000000..1160d874f5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-164442.js @@ -0,0 +1,45 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --allow-natives-syntax + +// Should not take a very long time (n^2 algorithms are bad) + + +function ensureNotNegative(x) { + return Math.max(0, x | 0); +} + + +ensureNotNegative(1); +ensureNotNegative(2); + +%OptimizeFunctionOnNextCall(ensureNotNegative); + +var r = ensureNotNegative(-1); + +assertEquals(0, r); From eba7aae107cb3b482e13b0e88908436fe69a3109 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 21 Jul 2014 22:12:11 +0400 Subject: [PATCH 20/24] gyp: fix post-mortem in v0.11 Expose missing constants and keep symbols on OSX. --- deps/v8/tools/gen-postmortem-metadata.py | 36 ++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/deps/v8/tools/gen-postmortem-metadata.py b/deps/v8/tools/gen-postmortem-metadata.py index 7bee763bc9..17285c0ba9 100644 --- a/deps/v8/tools/gen-postmortem-metadata.py +++ b/deps/v8/tools/gen-postmortem-metadata.py @@ -79,6 +79,14 @@ consts_misc = [ { 'name': 'SmiShiftSize', 'value': 'kSmiShiftSize' }, { 'name': 'PointerSizeLog2', 'value': 'kPointerSizeLog2' }, + { 'name': 'OddballFalse', 'value': 'Oddball::kFalse' }, + { 'name': 'OddballTrue', 'value': 'Oddball::kTrue' }, + { 'name': 'OddballTheHole', 'value': 'Oddball::kTheHole' }, + { 'name': 'OddballNull', 'value': 'Oddball::kNull' }, + { 'name': 'OddballArgumentMarker', 'value': 'Oddball::kArgumentMarker' }, + { 'name': 'OddballUndefined', 'value': 'Oddball::kUndefined' }, + { 'name': 'OddballOther', 'value': 'Oddball::kOther' }, + { 'name': 'prop_desc_key', 'value': 'DescriptorArray::kDescriptorKey' }, { 'name': 'prop_desc_details', @@ -96,6 +104,20 @@ consts_misc = [ { 'name': 'prop_type_mask', 'value': 'PropertyDetails::TypeField::kMask' }, + { 'name': 'bit_field2_elements_kind_mask', + 'value': 'Map::kElementsKindMask' }, + { 'name': 'bit_field2_elements_kind_shift', + 'value': 'Map::kElementsKindShift' }, + { 'name': 'bit_field3_dictionary_map_shift', + 'value': 'Map::DictionaryMap::kShift' }, + + { 'name': 'elements_fast_holey_elements', + 'value': 'FAST_HOLEY_ELEMENTS' }, + { 'name': 'elements_fast_elements', + 'value': 'FAST_ELEMENTS' }, + { 'name': 'elements_dictionary_elements', + 'value': 'DICTIONARY_ELEMENTS' }, + { 'name': 'off_fp_context', 'value': 'StandardFrameConstants::kContextOffset' }, { 'name': 'off_fp_marker', @@ -117,6 +139,15 @@ extras_accessors = [ 'Map, transitions, uintptr_t, kTransitionsOrBackPointerOffset', 'Map, inobject_properties, int, kInObjectPropertiesOffset', 'Map, instance_size, int, kInstanceSizeOffset', + 'Map, bit_field, char, kBitFieldOffset', + 'Map, bit_field2, char, kBitField2Offset', + 'Map, prototype, Object, kPrototypeOffset', + 'StringDictionaryShape, prefix_size, int, kPrefixSize', + 'StringDictionaryShape, entry_size, int, kEntrySize', + 'SeededNumberDictionaryShape, prefix_size, int, kPrefixSize', + 'UnseededNumberDictionaryShape, prefix_size, int, kPrefixSize', + 'NumberDictionaryShape, entry_size, int, kEntrySize', + 'Oddball, kind_offset, int, kKindOffset', 'HeapNumber, value, double, kValueOffset', 'ConsString, first, String, kFirstOffset', 'ConsString, second, String, kSecondOffset', @@ -356,7 +387,7 @@ def parse_field(call): 'value': '%s::%s' % (klass, offset) }); - assert(kind == 'SMI_ACCESSORS'); + assert(kind == 'SMI_ACCESSORS' or kind == 'ACCESSORS_TO_SMI'); klass = args[0]; field = args[1]; offset = args[2]; @@ -380,7 +411,8 @@ def load_fields(): # may span multiple lines and may contain nested parentheses. We also # call parse_field() to pick apart the invocation. # - prefixes = [ 'ACCESSORS', 'ACCESSORS_GCSAFE', 'SMI_ACCESSORS' ]; + prefixes = [ 'ACCESSORS', 'ACCESSORS_GCSAFE', + 'SMI_ACCESSORS', 'ACCESSORS_TO_SMI' ]; current = ''; opens = 0; From 96b166f291ed2323a079146c484adef055008257 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Sat, 19 Jul 2014 14:34:41 -0700 Subject: [PATCH 21/24] doc: console.trace takes a message format Documentation claimed it accepted a single label argument, as time and timeEnd do, which was incorrect. Signed-off-by: Fedor Indutny --- doc/api/console.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/console.markdown b/doc/api/console.markdown index e7807feeaf..76860e5597 100644 --- a/doc/api/console.markdown +++ b/doc/api/console.markdown @@ -62,9 +62,10 @@ Finish timer, record output. Example: } console.timeEnd('100-elements'); -## console.trace(label) +## console.trace(message, [...]) -Print a stack trace to stderr of the current position. +Print to stderr `'Trace :'`, followed by the formatted message and stack trace +to the current position. ## console.assert(value, [message], [...]) From 93390ffc209b49d136d92581f55ce65a2f156b0b Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Wed, 23 Jul 2014 23:51:14 +0400 Subject: [PATCH 22/24] test: fix test-tls-server-verify fix #7963 --- deps/openssl/openssl.gyp | 189 ++++++++++++++++++++++---- node.gyp | 7 +- test/common.js | 5 + test/fixtures/keys/agent1-cert.pem | 18 +-- test/fixtures/keys/agent1-csr.pem | 17 ++- test/fixtures/keys/agent1-key.pem | 20 ++- test/fixtures/keys/agent2-cert.pem | 17 ++- test/fixtures/keys/agent2-csr.pem | 17 ++- test/fixtures/keys/agent2-key.pem | 20 ++- test/fixtures/keys/agent3-cert.pem | 18 +-- test/fixtures/keys/agent3-csr.pem | 17 ++- test/fixtures/keys/agent3-key.pem | 20 ++- test/fixtures/keys/agent4-cert.pem | 21 +-- test/fixtures/keys/agent4-csr.pem | 17 ++- test/fixtures/keys/agent4-key.pem | 20 ++- test/fixtures/keys/ca1-cert.pem | 16 +-- test/fixtures/keys/ca1-cert.srl | 2 +- test/fixtures/keys/ca1-key.pem | 35 ++--- test/fixtures/keys/ca2-cert.pem | 16 +-- test/fixtures/keys/ca2-cert.srl | 2 +- test/fixtures/keys/ca2-crl.pem | 12 +- test/fixtures/keys/ca2-database.txt | 1 + test/fixtures/keys/ca2-key.pem | 35 ++--- test/simple/test-tls-server-verify.js | 10 +- 24 files changed, 369 insertions(+), 183 deletions(-) diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp index 3dc9106152..b3ae004103 100644 --- a/deps/openssl/openssl.gyp +++ b/deps/openssl/openssl.gyp @@ -12,18 +12,6 @@ { 'target_name': 'openssl', 'type': '<(library)', - 'defines': [ - # No clue what these are for. - 'L_ENDIAN', - 'PURIFY', - '_REENTRANT', - - # Heartbeat is a TLS extension, that couldn't be turned off or - # asked to be not advertised. Unfortunately this is unacceptable for - # Microsoft's IIS, which seems to be ignoring whole ClientHello after - # seeing this extension. - 'OPENSSL_NO_HEARTBEATS', - ], 'sources': [ 'openssl/ssl/bio_ssl.c', 'openssl/ssl/d1_both.c', @@ -935,32 +923,20 @@ ] }], ['OS=="win"', { - 'defines': [ - 'MK1MF_BUILD', - 'WIN32_LEAN_AND_MEAN' - ], 'link_settings': { 'libraries': [ '-lgdi32.lib', '-luser32.lib', ] - } + }, + 'defines': [ + 'DSO_WIN32', + ], }, { 'defines': [ - # ENGINESDIR must be defined if OPENSSLDIR is. - 'ENGINESDIR="/dev/null"', - # Set to ubuntu default path for convenience. If necessary, override - # this at runtime with the SSL_CERT_DIR environment variable. - 'OPENSSLDIR="/etc/ssl"', - 'TERMIOS', + 'DSO_DLFCN', + 'HAVE_DLFCN_H' ], - 'cflags': ['-Wno-missing-field-initializers'], - }], - ['is_clang==1 or gcc_version>=43', { - 'cflags': ['-Wno-old-style-declaration'], - }], - ['OS=="solaris"', { - 'defines': ['__EXTENSIONS__'], }], ['target_arch=="arm"', { 'sources': ['openssl/crypto/armcap.c'], @@ -981,7 +957,160 @@ 'include_dirs': ['openssl/include'], }, }, + { + 'target_name': 'openssl-cli', + 'type': 'executable', + 'dependencies': [ + 'openssl', + ], + 'defines': [ + 'MONOLITH', + ], + 'sources': [ + 'openssl/apps/app_rand.c', + 'openssl/apps/apps.c', + 'openssl/apps/asn1pars.c', + 'openssl/apps/ca.c', + 'openssl/apps/ciphers.c', + 'openssl/apps/cms.c', + 'openssl/apps/crl.c', + 'openssl/apps/crl2p7.c', + 'openssl/apps/dgst.c', + 'openssl/apps/dh.c', + 'openssl/apps/dhparam.c', + 'openssl/apps/dsa.c', + 'openssl/apps/dsaparam.c', + 'openssl/apps/ec.c', + 'openssl/apps/ecparam.c', + 'openssl/apps/enc.c', + 'openssl/apps/engine.c', + 'openssl/apps/errstr.c', + 'openssl/apps/gendh.c', + 'openssl/apps/gendsa.c', + 'openssl/apps/genpkey.c', + 'openssl/apps/genrsa.c', + 'openssl/apps/nseq.c', + 'openssl/apps/ocsp.c', + 'openssl/apps/openssl.c', + 'openssl/apps/passwd.c', + 'openssl/apps/pkcs12.c', + 'openssl/apps/pkcs7.c', + 'openssl/apps/pkcs8.c', + 'openssl/apps/pkey.c', + 'openssl/apps/pkeyparam.c', + 'openssl/apps/pkeyutl.c', + 'openssl/apps/prime.c', + 'openssl/apps/rand.c', + 'openssl/apps/req.c', + 'openssl/apps/rsa.c', + 'openssl/apps/rsautl.c', + 'openssl/apps/s_cb.c', + 'openssl/apps/s_client.c', + 'openssl/apps/s_server.c', + 'openssl/apps/s_socket.c', + 'openssl/apps/s_time.c', + 'openssl/apps/sess_id.c', + 'openssl/apps/smime.c', + 'openssl/apps/speed.c', + 'openssl/apps/spkac.c', + 'openssl/apps/srp.c', + 'openssl/apps/ts.c', + 'openssl/apps/verify.c', + 'openssl/apps/version.c', + 'openssl/apps/x509.c', + ], + 'conditions': [ + ['OS=="solaris"', { + 'libraries': [ + '-lsocket', + '-lnsl', + ] + }], + ['OS=="win"', { + 'link_settings': { + 'libraries': [ + '-lws2_32.lib', + '-lgdi32.lib', + '-ladvapi32.lib', + '-lcrypt32.lib', + '-luser32.lib', + ], + }, + }], + [ 'OS in "linux android"', { + 'link_settings': { + 'libraries': [ + '-ldl', + ], + }, + }], + ] + } ], + 'target_defaults': { + 'include_dirs': [ + '.', + 'openssl', + 'openssl/crypto', + 'openssl/crypto/asn1', + 'openssl/crypto/evp', + 'openssl/crypto/md2', + 'openssl/crypto/modes', + 'openssl/crypto/store', + 'openssl/include', + ], + 'defines': [ + # No clue what these are for. + 'L_ENDIAN', + 'PURIFY', + '_REENTRANT', + + # Heartbeat is a TLS extension, that couldn't be turned off or + # asked to be not advertised. Unfortunately this is unacceptable for + # Microsoft's IIS, which seems to be ignoring whole ClientHello after + # seeing this extension. + 'OPENSSL_NO_HEARTBEATS', + ], + 'conditions': [ + ['OS=="win"', { + 'defines': [ + 'MK1MF_BUILD', + 'WIN32_LEAN_AND_MEAN', + 'OPENSSL_SYSNAME_WIN32', + ], + }, { + 'defines': [ + # ENGINESDIR must be defined if OPENSSLDIR is. + 'ENGINESDIR="/dev/null"', + 'TERMIOS', + ], + 'cflags': ['-Wno-missing-field-initializers'], + 'conditions': [ + ['OS=="mac"', { + 'defines': [ + # Set to ubuntu default path for convenience. If necessary, + # override this at runtime with the SSL_CERT_DIR environment + # variable. + 'OPENSSLDIR="/System/Library/OpenSSL/"', + ], + }, { + 'defines': [ + # Set to ubuntu default path for convenience. If necessary, + # override this at runtime with the SSL_CERT_DIR environment + # variable. + 'OPENSSLDIR="/etc/ssl"', + ], + }], + ] + }], + ['is_clang==1 or gcc_version>=43', { + 'cflags': ['-Wno-old-style-declaration'], + }], + ['OS=="solaris"', { + 'defines': ['__EXTENSIONS__'], + }], + ], + }, } # Local Variables: diff --git a/node.gyp b/node.gyp index 38311a1cc4..348040e03d 100644 --- a/node.gyp +++ b/node.gyp @@ -149,7 +149,12 @@ 'sources': [ 'src/node_crypto.cc' ], 'conditions': [ [ 'node_shared_openssl=="false"', { - 'dependencies': [ './deps/openssl/openssl.gyp:openssl' ], + 'dependencies': [ + './deps/openssl/openssl.gyp:openssl', + + # For tests + './deps/openssl/openssl.gyp:openssl-cli', + ], }]] }, { 'defines': [ 'HAVE_OPENSSL=0' ] diff --git a/test/common.js b/test/common.js index 28faaf9788..a475921970 100644 --- a/test/common.js +++ b/test/common.js @@ -20,6 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. var path = require('path'); +var fs = require('fs'); var assert = require('assert'); exports.testDir = path.dirname(__filename); @@ -30,9 +31,13 @@ exports.PORT = +process.env.NODE_COMMON_PORT || 12346; if (process.platform === 'win32') { exports.PIPE = '\\\\.\\pipe\\libuv-test'; + exports.opensslCli = path.join(process.execPath, '..', 'openssl-cli.exe'); } else { exports.PIPE = exports.tmpDir + '/test.sock'; + exports.opensslCli = path.join(process.execPath, '..', 'openssl-cli'); } +if (!fs.existsSync(exports.opensslCli)) + exports.opensslCli = false; var util = require('util'); for (var i in util) exports[i] = util[i]; diff --git a/test/fixtures/keys/agent1-cert.pem b/test/fixtures/keys/agent1-cert.pem index 816f6fbf17..48df0f90c0 100644 --- a/test/fixtures/keys/agent1-cert.pem +++ b/test/fixtures/keys/agent1-cert.pem @@ -1,14 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICKjCCAZMCCQDQ8o4kHKdCPDANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +MIICbjCCAdcCCQDQ8o4kHKdCPTANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV UzELMAkGA1UECBMCQ0ExCzAJBgNVBA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OkZE3sOa/sK+6OpnzZHRW3slEbQT1nyo4Gn+2d0GH5pmDPZ5S1iebxdM +snm5pQHmKbeqHCw1aPsShLX2+rVrfE5ywVOOPIC4IvP8H8vm1Eoj7LecA2FmxMH6 +juc= -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent1-csr.pem b/test/fixtures/keys/agent1-csr.pem index 748fd00036..4148c3a4c2 100644 --- a/test/fixtures/keys/agent1-csr.pem +++ b/test/fixtures/keys/agent1-csr.pem @@ -1,10 +1,13 @@ -----BEGIN CERTIFICATE REQUEST----- -MIIBXTCCAQcCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH +MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD -EwZhZ2VudDExIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMFwwDQYJ -KoZIhvcNAQEBBQADSwAwSAJBAJ86QKnKF2cVic/1hSuwV8A9t45URMhtdce4JMnb -Xh75+j61QWwecn7unG5PMN/wK+tPAHMjEPbx45C0Ch+3IxECAwEAAaAlMCMGCSqG -SIb3DQEJBzEWExRBIGNoYWxsZW5nZSBwYXNzd29yZDANBgkqhkiG9w0BAQUFAANB -AF+AfG64hNyYHum46m6i7RgnUBrJSOynGjs23TekV4he3QdMSAAPPqbll8W14+y3 -vOo7/yQ2v2uTqxCjakUNPPs= +EwZhZ2VudDExIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDxQzMzlIffD/fZisJrUfFMc0x7bKV5QLKd +6R0jVk0ZpB1WXzudXYcbORV44V8MMXyd7nBvQRbuNKoTrB7J5AFKwvxfo1jJpm3k +G6b911yznN6zb6kCTBl9KioXjbILRiwzAco++uuHCKWu020IpvBqN1ry8QlZSQKN +neo/ilvljQIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBBQUAA4GBAHMP0MU6e7QlbsaJ6g/KNOC5FJn6+M4E5ZaP +tkFHlITUF8SBKWZz6UUYTTdT0/C3KAPT7STHkWCfh0yYgidckdWYB/esF12y0/S7 +c4qr4iD548Jx/g0Mn/5B4+9gwFTrsd5uktOrgF7VVsQ1nGr5QKMRbrtGDjCrXA8Q +rjIWhd12 -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent1-key.pem b/test/fixtures/keys/agent1-key.pem index 5dae7eb99d..5d8e050296 100644 --- a/test/fixtures/keys/agent1-key.pem +++ b/test/fixtures/keys/agent1-key.pem @@ -1,9 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAJ86QKnKF2cVic/1hSuwV8A9t45URMhtdce4JMnbXh75+j61QWwe -cn7unG5PMN/wK+tPAHMjEPbx45C0Ch+3IxECAwEAAQJBAI2cU1IuR+4IO87WPyAB -76kruoo87AeNQkjjvuQ/00+b/6IS45mcEP5Kw0NukbqBhIw2di9uQ9J51DJ/ZfQr -+YECIQDUHaN3ZjIdJ7/w8Yq9Zzz+3kY2F/xEz6e4ftOFW8bY2QIhAMAref+WYckC -oECgOLAvAxB1lI4j7oCbAaawfxKdnPj5AiEAi95rXx09aGpAsBGmSdScrPdG1v6j -83/2ebrvoZ1uFqkCIB0AssnrRVjUB6GZTNTyU3ERfdkx/RX1zvr8WkFR/lXpAiB7 -cUZ1i8ZkZrPrdVgw2cb28UJM7qZHQnXcMHTXFFvxeQ== +MIICXwIBAAKBgQDxQzMzlIffD/fZisJrUfFMc0x7bKV5QLKd6R0jVk0ZpB1WXzud +XYcbORV44V8MMXyd7nBvQRbuNKoTrB7J5AFKwvxfo1jJpm3kG6b911yznN6zb6kC +TBl9KioXjbILRiwzAco++uuHCKWu020IpvBqN1ry8QlZSQKNneo/ilvljQIDAQAB +AoGBAOS++zfHdv+WSz92IZnRaoA6vWQ0gbuyDOhNkrPjalyKTsqKpqIwgB3ehK5E +uHJ+JRI0dWP2icA2LJ9UTSjMRi99yq+8vXi2aUeWD09e1EBBc1JkSA2ZF/nxL4pT +dmJJbhIz4wrbuKUjQBmyxIPs775D5QOnc9d/bVkSq7iB11WhAkEA/eFKyBR2qjUe +SWEAp3RHi4ZqYna6WZ8dsPvoJ/hhyXNAuHZly8aRonjXJsT6kIuzXlMURVypFcrD +EbJeNzonKQJBAPNG75kmQD1z34UlBx6lnwt74/M8Iuu4Dm344zyBrWj+qDoNz4Ye +PEZRo0T9bOKaaI/4jLYATWx1+r4ZXxIlC8UCQQCSOtXL8J145CeRtGGgEgWzg7R7 +Ck/DlzaO3kmV3CbW1Z+NoAR6HuF7Z4blOcfowc6KoeenG/v4JVW+N7K0tLYhAkEA +75dNIWeqnNshp99vw58ZpBW/yi3PtpbunyAfq9eLEXy78XDokQ32DssYITn1orav +hBsleZmSpt8Ks24JU7VogQJBAOxe8AiqFi6rxY5V8vBUxf7YX5rc0E8AJ+vT8yey +2Mi7sgzKuEV3SE8xdaLwJLaJ1L28zFbGM3TXuTXHHzp9Wh0= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent2-cert.pem b/test/fixtures/keys/agent2-cert.pem index 8e4354db4e..29c151604f 100644 --- a/test/fixtures/keys/agent2-cert.pem +++ b/test/fixtures/keys/agent2-cert.pem @@ -1,13 +1,16 @@ -----BEGIN CERTIFICATE----- -MIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV +MIICcTCCAdoCCQCalREW1v1r6zANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50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/keys/agent2-csr.pem b/test/fixtures/keys/agent2-csr.pem index a670c4c632..182ca1ccce 100644 --- a/test/fixtures/keys/agent2-csr.pem +++ b/test/fixtures/keys/agent2-csr.pem @@ -1,10 +1,13 @@ -----BEGIN CERTIFICATE REQUEST----- -MIIBXTCCAQcCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH +MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD -EwZhZ2VudDIxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMFwwDQYJ -KoZIhvcNAQEBBQADSwAwSAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf -+6fVgdpVhYg5QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAaAlMCMGCSqG -SIb3DQEJBzEWExRBIGNoYWxsZW5nZSBwYXNzd29yZDANBgkqhkiG9w0BAQUFAANB -AJnll2pt5l0pzskQSpjjLVTlFDFmJr/AZ3UK8v0WxBjYjCe5Jx4YehkChpxIyDUm -U3J9q9MDUf0+Y2+EGkssFfk= +EwZhZ2VudDIxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDWOToEWvmKUoZumYCan4WwR9b2ACIG285W +tRbAr/ClJoNXh+h5gLUVcBPyOpGCGvYS3ePCCJHValJj1w/CmVq6uxAzC1/x1KD2 +B3YeHGsS5Cks5IfirRabp7Ldn8KqIOXX3oGUAr4hd4NlFjemYdp1An2ol9CFhoqZ +68lw9CL0bwIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBBQUAA4GBALkokJAd9fZM0tF3qluKGqZVT3rWvoEjm64I +13niqtvGIUirIPhcNm6oCYOeBMt1N0Yvgr/UYhfuicQFAcxP5u4I2QaV0AYB7fbR +hvaL8BoZ9KlsbqrwyizNnxNqEkM1lcTBevKRad3zuPHcfOWArHt6JtVNJOmgChTp +VsO5mtJV -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent2-key.pem b/test/fixtures/keys/agent2-key.pem index 522903c635..459f2550de 100644 --- a/test/fixtures/keys/agent2-key.pem +++ b/test/fixtures/keys/agent2-key.pem @@ -1,9 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5 -QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAQJBAMT6Bf34+UHKY1ObpsbH -9u2jsVblFq1rWvs8GPMY6oertzvwm3DpuSUp7PTgOB1nLTLYtCERbQ4ovtN8tn3p -OHUCIQDzIEGsoCr5vlxXvy2zJwu+fxYuhTZWMVuo1397L0VyhwIhANQh+yzqUgaf -WRtSB4T2W7ADtJI35ET61jKBty3CqJY3AiAIwju7dVW3A5WeD6Qc1SZGKZvp9yCb -AFI2BfVwwaY11wIgXF3PeGcvACMyMWsuSv7aPXHfliswAbkWuzcwA4TW01ECIGWa -cgsDvVFxmfM5NPSuT/UDTa6R5BFISB5ea0N0AR3I +MIICXgIBAAKBgQDWOToEWvmKUoZumYCan4WwR9b2ACIG285WtRbAr/ClJoNXh+h5 +gLUVcBPyOpGCGvYS3ePCCJHValJj1w/CmVq6uxAzC1/x1KD2B3YeHGsS5Cks5Ifi +rRabp7Ldn8KqIOXX3oGUAr4hd4NlFjemYdp1An2ol9CFhoqZ68lw9CL0bwIDAQAB +AoGBAMDw1dIqZeoxHabrVirtVilI6tCxmfP3cMYjX5S4YdM89rqVS8pzI6VlRnG6 +UmeOBOdFNecCdOZ0VjRZ9HXeTRmPkEhUc9QY5MJXjDp48WK+1LIey33IsfEE35mp +ETrP+3VVRnSioG0X3COX73I0gOM+DhYl5uQF/2Cas2Fryy9hAkEA7g6hlBzhTGPj +wQE8pUBGdVyke6FoDrT/EJhlzG6UOveBVwm20jBeaMSsufqu2fm86UgmW6C2JZzH +1KrbEXoVyQJBAOZeuGaiCQ+ETFAFjEn782wRq5pcqWOLt5tOwx06cf62PJKtFsXJ +rOuBWlu4zGLD3IIpD3nqh67XvgtFSftGNHcCQDKkni8aLbvIjE0k7Dfjgpm5Cazb +W321d4WaRh3FcHdS7AsOH/x7GbqEDJLMB6KLhGrEVJStjdJWlhRh/JStOjECQQDd +kIxaac29Fskuzac4IRLmBbi+JhDkpSRaQ051dhjdmfh4OfGFGYsulqKJRRuOgkI7 +DbLM1zzYdLdbr7CP893RAkEAnyXAB0NQ2EImlFhbQRDirHgq8URu+/cVW3qBrOcL +GIXr1KwvrIN//ZjpFwotKjQViM86nw6PpVywmOiP7Lrvag== -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent3-cert.pem b/test/fixtures/keys/agent3-cert.pem index e4a235079f..70ce79a528 100644 --- a/test/fixtures/keys/agent3-cert.pem +++ b/test/fixtures/keys/agent3-cert.pem @@ -1,14 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICKjCCAZMCCQCDBr594bsJmTANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +MIICbjCCAdcCCQCDBr594bsJmzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlA -dGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEyWjB9 +dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB9 MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MzEgMB4G -CSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwXDANBgkqhkiG9w0BAQEFAANL -ADBIAkEAtlNDZ+bHeBI0B2gD/IWqA7Aq1hwsnS4+XpnLesjTQcL2JwFFpkR0oWrw -yjrYhCogi7c5gjKrLZF1d2JD5JgHgQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAJoK -bXwsImk7vJz9649yrmsXwnuGbEKVYMvqcGyjaZNP9lYEG41y5CeRzxhWy2rlYdhE -f2nqE2lg75oJP7LQqfQY7aCqwahM3q/GQbsfKVCGjF7TVyq9TQzd8iW+FEJIQzSE -3aN85hR67+3VAXeSzmkGSVBO2m1SJIug4qftIkc2 +CSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD +gY0AMIGJAoGBAM69c5za1Aj3bO1Nzl/qt/p3MaadCn7OxP3KKqeu7DiFIKOYq+k5 +MVjzfVZqZoy+H5z/Tuan6+7LawGWmJHaIT7POvmsOQhy86AJE07s9Z+5tDk6SPku +tzJohyPlWPlSJ+q/v7pwWU+En55z8ihLtA5On77OZK8JL+qYjOFlhYx5AgMBAAEw +DQYJKoZIhvcNAQEFBQADgYEAX6z18J8/wzKJJb+hFngaIrUt052AsBXOvF83XOg0 +dEiQK+X3pZSPCF3a0g1iJQMIHuJvnLUuqUfIDQLqkBEtlrXbT/1UqaDu12neImJ6 +XI6O3TkSoyxkH461qMu/Q3Um2RW1o2oVlYdjzZgBeKE2ilhDTsJcdNGZTXP4ZW/j +VHc= -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent3-csr.pem b/test/fixtures/keys/agent3-csr.pem index e6c0c74b3a..b8bb2c95f8 100644 --- a/test/fixtures/keys/agent3-csr.pem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XCwkqhkBLDWFhVCsoG8 +Z3YpDz2fu2xOw2Ogjnx5zTNauoxl/oYI9AoWcs6FaOiVFgw7IsejGjReeV4zaeLe +j0XujlKJ -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent3-key.pem b/test/fixtures/keys/agent3-key.pem index d72f071e4c..f9ba7b6d67 100644 --- a/test/fixtures/keys/agent3-key.pem +++ b/test/fixtures/keys/agent3-key.pem @@ -1,9 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBALZTQ2fmx3gSNAdoA/yFqgOwKtYcLJ0uPl6Zy3rI00HC9icBRaZE -dKFq8Mo62IQqIIu3OYIyqy2RdXdiQ+SYB4ECAwEAAQJAIk+G9s2SKgFa8y3a2jGZ -LfqABSzmJGooaIsOpLuYLd6eCC31XUDlT4rPVGRhysKQCQ4+NMjgdnj9ZqNnvXY/ -RQIhAOgbdltr3Ey2hy7RuDW5rmOeJTuVqCrZ7QI8ifyCEbYTAiEAyRfvWSvvASeP -kZTMUhATRUpuyDQW+058NE0oJSinTpsCIQCR/FPhBGI3TcaQyA9Ym0T4GwvIAkUX -TqInefRAAX8qSQIgZVJPAdIWGbHSL9sWW97HpukLCorcbYEtKbkamiZyrjMCIQCX -lX76ttkeId5OsJGQcF67eFMMr2UGZ1WMf6M39lCYHQ== +MIICXgIBAAKBgQDOvXOc2tQI92ztTc5f6rf6dzGmnQp+zsT9yiqnruw4hSCjmKvp +OTFY831WamaMvh+c/07mp+vuy2sBlpiR2iE+zzr5rDkIcvOgCRNO7PWfubQ5Okj5 +LrcyaIcj5Vj5Uifqv7+6cFlPhJ+ec/IoS7QOTp++zmSvCS/qmIzhZYWMeQIDAQAB +AoGBAM4ONbUYxk1Jjt/WtOMU5tpVAr+1tkg9fkoVvf3zcq3Cwo1MFcwWnQCzbzE6 +S4vr00Z/kPyEUbtoM/cZSmfUqVxOEc10QGyAm8c88zHiuKmoFFElrYR6kVNUvWZS +TsLb1vznvuxkajdkOzVEyLj7Q+lYbd0dpc18fbMeV8VEFL6BAkEA7SI046SI44Zc +sJ/vIDvl1vbnGo/5kTb3egzVpH52UkmjadeBZG/iN6UxyMKlP9Wpazod332Bnr7p +UYD0S6g1xQJBAN8wNQk9LSDXrUkb/z1WMYbx5UHfJaWBLdVcYfHCsbyzwrdGjH77 +6Rb6QwgP4piAKMRUNLAPPBSFUs/Ma+kCGyUCQQCklhxdcAKu4MAOu0LufYReOkpX +DlzqpFsKNERIgpm/LWsleDVPr7Q0aQzvyeGGN9b6HIFFcEf6FYm9TyLALET9AkA7 +dCoMpgFJiGqe2RhrDHTxD6sUmw76Qakl9xAYSNbz/6bVD7QJd62l81C76w9ftHQn +qI7If6ZviPyAYmI0ld0JAkEArE8YZSpszCwaEIrx9XLHPTNPgBkVgsv+LI0cekry +LFXL05GkfJ9GLRoRtrcuLAq/Bk99NJ+F+Rwp9sr7o910Gw== -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent4-cert.pem b/test/fixtures/keys/agent4-cert.pem index 07157b919b..8a23443dd9 100644 --- a/test/fixtures/keys/agent4-cert.pem +++ b/test/fixtures/keys/agent4-cert.pem @@ -1,15 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICSDCCAbGgAwIBAgIJAIMGvn3huwmaMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIICjDCCAfWgAwIBAgIJAIMGvn3huwmcMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIEwJDQTELMAkGA1UEBxMCU0YxDzANBgNVBAoTBkpveWVu dDEQMA4GA1UECxMHTm9kZS5qczEMMAoGA1UEAxMDY2EyMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAeFw0xMTAzMTQxODI5MTJaFw0zODA3MjkxODI5 -MTJaMH0xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTELMAkGA1UEBxMCU0YxDzAN +FhFyeUB0aW55Y2xvdWRzLm9yZ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G/86as0Ts4drM15cg= -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent4-csr.pem b/test/fixtures/keys/agent4-csr.pem index 97e115d030..9064b75778 100644 --- a/test/fixtures/keys/agent4-csr.pem +++ b/test/fixtures/keys/agent4-csr.pem @@ -1,10 +1,13 @@ -----BEGIN CERTIFICATE REQUEST----- -MIIBXTCCAQcCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH +MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD -EwZhZ2VudDQxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMFwwDQYJ -KoZIhvcNAQEBBQADSwAwSAJBAM3/Ix+ZDzN2+aOUaTtvcyfrBjYWNoxvhzkQ0lfX -m/JiEpLXOHHqfSRAifa9/rKobu07k6TPYgmIP1JrTqYroasCAwEAAaAlMCMGCSqG -SIb3DQEJBzEWExRBIGNoYWxsZW5nZSBwYXNzd29yZDANBgkqhkiG9w0BAQUFAANB -AMzo7GUOBtGm5MSck1rrEE2C1bU3qoVvXVuiN3A/57zXeNeq24FZMLnkDeL9U+/b -Kj646XFou04gla982Xp74p0= +EwZhZ2VudDQxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLHtVnCMjV7d3jajtcocCJG+ZHYHHWi0GN +7jtRkRwgzM3z9rePZsk4KDEaIPTcmTdeo/LCGMVs9BF/yaRvHbkkVIvIJslfA+/h +PDvu79pk75ajuhLd/qBLugYHx5a+mto1ev8rkWeIO6j1tZ8PHNL3HVs/mTU6JS9a +m9ua0z13vwIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBBQUAA4GBADL43hM8ZGMd0ev7r5iqFQYrLrNXvisWo5vI +PDBzA7QBkZ4WyDqiUpK75mabmT7cIbnpc05FJV8R35BwafeSReJ7YKd5ru1d1gCn +yupUNKZ+5+n1mxVxWv+Frgw/Rli1tNua2KcspZLOs99RcrND3YCbcB7TSIotfxmg +3JtGRloX -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent4-key.pem b/test/fixtures/keys/agent4-key.pem index b770b015db..9cdb89067d 100644 --- a/test/fixtures/keys/agent4-key.pem +++ b/test/fixtures/keys/agent4-key.pem @@ -1,9 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOQIBAAJBAM3/Ix+ZDzN2+aOUaTtvcyfrBjYWNoxvhzkQ0lfXm/JiEpLXOHHq -fSRAifa9/rKobu07k6TPYgmIP1JrTqYroasCAwEAAQJAN8RQb+dx1A7rejtdWbfM -Rww7PD07Oz2eL/a72wgFsdIabRuVypIoHunqV0sAegYtNJt9yu+VhREw0R5tx/qz -EQIhAPY+nmzp0b4iFRk7mtGUmCTr9iwwzoqzITwphE7FpQnFAiEA1ihUHFT9YPHO -f85skM6qZv77NEgXHO8NJmQZ5GX1ZK8CICzle+Mluo0tD6W7HV4q9pZ8wzSJbY8S -W/PpKetm09F1AiAWTw8sAGKAtc/IGo3Oq+iuYAN1F8lolzJsfGMCGujsOwIgAJKP -t3eXilwX3ZlsDWSklWNZ7iYcfYrvAc3JqU6gFCE= +MIICXQIBAAKBgQDLHtVnCMjV7d3jajtcocCJG+ZHYHHWi0GN7jtRkRwgzM3z9reP +Zsk4KDEaIPTcmTdeo/LCGMVs9BF/yaRvHbkkVIvIJslfA+/hPDvu79pk75ajuhLd +/qBLugYHx5a+mto1ev8rkWeIO6j1tZ8PHNL3HVs/mTU6JS9am9ua0z13vwIDAQAB +AoGBAMerv8xRblweQIlV3JTqzQH7UxvHSyDEM+T504YTR7tWmP7CASAOwq9ZkytE +SnCwjSWTtQfooerA4pLj/ajdZyj3JzaTXPahuN/KCZaLPSYLOKHvF7u9larsgnC8 +2Q6jkLJ2TTVqe0w8pc73Ak9A5o2fyjug+BH0KTmr3hcObSXBAkEA6NDv/ofNinJn +77ELv8k2eVA9psVDWPPapAn2CcEigqBc88L+LM+O1NKDkYgc+ux1QhJa9EWefGJJ +gPiCdZBOvQJBAN9Y4OOb15txc5C5rduWiGyuCyCFWfdmBrW8oOx+fjG5Q/r7R8eE ++CFepik8BOg+QHjtzY1tzOJkCxObt2PsFisCQQDWzigQTNY8vc/d3Bk+C3VCOuGX +JHw970g0f6hNWa/wm+sHUUrYp2xeOhkARniOn2qU2oCmzjErDDhLUX503/91AkBg +3wLDlc9hK0btiatfp53KTX6j/1KzHDxizMqbaI3BcVKL5DsQzZp1lsDI97BFLuL1 +0GasJeiMdMndGlfjbf17AkA2wpV2ui5/3pc6GVFf4DNZvTFxON75b3LRRXQK9TJ+ +JYwP5YSh+/EPI7KCAvpcX37xU7ezGCc7jDxkApiB7H55 -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/ca1-cert.pem b/test/fixtures/keys/ca1-cert.pem index 1951de77a2..a688a76d77 100644 --- a/test/fixtures/keys/ca1-cert.pem +++ b/test/fixtures/keys/ca1-cert.pem @@ -1,15 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICazCCAdQCCQDTlFdg2h0DBjANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +MIICazCCAdQCCQDyB/1ZCqtNHjANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA -dGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEyWjB6 +dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB6 MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqG SIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A -MIGJAoGBAKxbsLdJbi53pcP1pzg8lgJhLEvcNlV2ogr97WURp+gPjK+HFXj2xl9w -qDQrxpmvTya+urBG7OagTjV1E7dRE7PTr4TkEqehmxF026Opb0PZewuIBOKX4UgG -PSfk0fksrje6YJb+OkiBfA/q7eznZF8cmq7MRrs7LWe9A6Bic/apAgMBAAEwDQYJ -KoZIhvcNAQEFBQADgYEAk6hlYgjCBihG4dM+3324W1WsvjU8QscsTXu8SGL0y9b6 -82zZikj0W9FU6u98WHtXwuFt3mKlGCcou2pluZvj02T2iVKSMs2oYL8JOlvM8hVf -GEeg2EriLlzmdxNz4/I86DlBiyoTijZh8/qrItsK7+a56P0exH8ouXzlhL1Bhjw= +MIGJAoGBALlUDB8Via9GfSvlfcIRGS1dr5HMfZz4ZBnHB4HJQbD8TXmNPL5Q5Flc +AptUsjMPR6WxX4SOcl5NetXYZVNQ9jt7fPaLsWmSNbeICQva0bmgAazqIE3EZonm +xNVVJ2luqet4D7oOKqS49lGEdpxC6TqayL3t5Zf+/mrSg9AMJTqhAgMBAAEwDQYJ +KoZIhvcNAQEFBQADgYEAV2DqO9K9IPMD+f5CjWX1ZyklxXwezNacjArETjtMj885 +70+bBGfX2+qnKAIWYh56DwPm3G+3kOqq6lP5njPWkEEOLZnx7R+sSaTVgpkKp4Sh +E9p8/7eIw7AP5SZgqqVJ9ynyFeMkoY3FG2mwyQHAXHP546zReEHmFxYbFyBCN8I= -----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca1-cert.srl b/test/fixtures/keys/ca1-cert.srl index 046be14b82..7280b1bcaf 100644 --- a/test/fixtures/keys/ca1-cert.srl +++ b/test/fixtures/keys/ca1-cert.srl @@ -1 +1 @@ -D0F28E241CA7423C +D0F28E241CA7423D diff --git a/test/fixtures/keys/ca1-key.pem b/test/fixtures/keys/ca1-key.pem index a4e4516c62..6f1537b9d8 100644 --- a/test/fixtures/keys/ca1-key.pem +++ b/test/fixtures/keys/ca1-key.pem @@ -1,17 +1,18 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIrulhMUmafvECAggA -MBQGCCqGSIb3DQMHBAjsjahmkf3zGwSCAoANt0xX8ZZT2CxeyUadbOuku6NrHoFy -YBvnEFvuq3TGm3NB72BxprvfMUNR5Xi6e6rJgtRQttPRX6oN2qfB8+W11vFBeFWG -gxarEotklca4bujPMwxRowyMT20n+yXvRc+Fd5tYrMcaBeweQZD69J242HJMJJmq -Lzvo2qYGaOxjpc8aUDzeDsv8cnlh5Xk1ZcRucRPM9j26KOPSt0wOd4RdN83AE8cW -Xu+k5TSMlPQLWihjS+KzEQ8Rs9CuubxrdmecF6DM70u0kYCLZ1Ex7+kBZu06CUpJ -PODaLca4W92XkBq4X25WgAAaCAj4nZZmgn0X0Fwl1lBqjOK5nEnYpjxuwjjJ2KVz -3j+kBK5tW6RBE4BM37r7NiM1FAzi8sgNYSVS9oa4m1qGfadEEQdhaMsAfM0SZ/8M -6NUPKlQmoDda9aCO7rqRuQ7pYQ9mpNxcWEBQi0cG6/3VXtqi/TewAKT1T5DToAzg -pL4eOTqeDp4VKif5r2u7Nj0EiM4j2TT88onGsdgRtjgUpNmJCRWYaCzs3QZggdYE -nLZt7ZRXpJ11tERKG3b28qrIw9jHULRAjjWEkEGbxYTpAlrgXklV/04XXnxxAVOP -0YjDzbfx5QCRCq5UHV4Gl3ELoBaOuxcIIN8YrE2oC1CY9uV/HSk4CSlxHNtWyxbA -WbCU2SoEHnwBVlTPbZyfErM33c3u4LJyN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//DKeJ9JSlrJeglWmXpo3/lNKA== +-----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/ca2-cert.pem b/test/fixtures/keys/ca2-cert.pem index 95e30411f7..106758f41f 100644 --- a/test/fixtures/keys/ca2-cert.pem +++ b/test/fixtures/keys/ca2-cert.pem @@ -1,15 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICazCCAdQCCQDVGbMO4Y2VUTANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +MIICazCCAdQCCQCjhnGuhSJstTANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlA -dGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEyWjB6 +dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB6 MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMjEgMB4GCSqG SIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A -MIGJAoGBAMOOtRmmjoBZmyYreB1D1fjftMW6sEGBzfSKZRcn+kiEpqXELq21O/TV -jLJGbo+0PDqxECQyDbOgoQZXcCevFnFhdsSQOYb+0O2kAiMVYGxDtqoKM5g8wj0D -BiE6fnyZoQTDv5lEuvfG0+youCtXlxiK/9cfhikI+hVXuTgwQXt9AgMBAAEwDQYJ -KoZIhvcNAQEFBQADgYEAbMrLydFajwfZXDH3PfpKtDPCm+yV3qvEMGWLfjBdN50g -PwsZE/OIp+KJttdS+MjMG1TfwfWIqa5zGG2ctxx+fHsKH+t3NsO76Eol1p+dKqZp -PdFp2UhViMgURkrpP593AsTTO9BGaz+awSaESDHm8pO+cLaeGKQp93W0sgC0lHQ= +MIGJAoGBAOnywgPgUUTRrhZmcIV15zLXdozaMZLD3FNwleJMUF6j1BqsfvfSFv6A +LGEJ/boM5pqXC89eIYDkIUUSNp5OJBl1ZrHvjjkoiFNUPpGHxezP2d5Tl7xU01V9 +MsUHZWDeeHxR/BdS9f0EpBe9dCBCC9SeqPOma8YXjdb8B1OM9JBrAgMBAAEwDQYJ +KoZIhvcNAQEFBQADgYEAVmx9jU0qPT/R/bkWhs4LKDOGCiVDhA+fk+0Jl2l1ixH7 +XUaRwO7O9L9FomraM9De7K7+/gwThY/Hc9cMu6kwdipSM9FQVvfNWL/d4jQ4EoVQ +mIyC455QW0+xVU4adALRV6xBrn/DpF8lBTIyyt5fHKfve8Cmxm1MeVK0fNnTuT8= -----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca2-cert.srl b/test/fixtures/keys/ca2-cert.srl index 00dca7dcd0..dfa171924f 100644 --- a/test/fixtures/keys/ca2-cert.srl +++ b/test/fixtures/keys/ca2-cert.srl @@ -1 +1 @@ -8306BE7DE1BB099A +8306BE7DE1BB099C diff --git a/test/fixtures/keys/ca2-crl.pem b/test/fixtures/keys/ca2-crl.pem index 166df74583..e9a5fb33b1 100644 --- a/test/fixtures/keys/ca2-crl.pem +++ b/test/fixtures/keys/ca2-crl.pem @@ -1,10 +1,10 @@ -----BEGIN X509 CRL----- -MIIBXTCBxzANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJVUzELMAkGA1UECBMC +MIIBeTCB4zANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJVUzELMAkGA1UECBMC Q0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUu anMxDDAKBgNVBAMTA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5v -cmcXDTExMDMxNDE4MjkxNloXDTEzMTIwNzE4MjkxNlowHDAaAgkAgwa+feG7CZoX -DTExMDMxNDE4MjkxNFowDQYJKoZIhvcNAQEEBQADgYEArRKuEkOla61fm4zlZtHe -LTXFV0Hgo21PScHAp6JqPol4rN5R9+EmUkv7gPCVVBJ9VjIgxSosHiLsDiz3zR+u -txHemhzbdIVANAIiChnFct8sEqH2eL4N6XNUIlMIR06NjNl7NbN8w8haqiearnuT -wmnaL4TThPmpbpKAF7N7JqQ= +cmcXDTE0MDcyMzE5NTEwMFoXDTE3MDQxNzE5NTEwMFowODAaAgkAgwa+feG7CZoX +DTExMDMxNDE4MjkxNFowGgIJAIMGvn3huwmcFw0xNDA3MjMxOTUxMDBaMA0GCSqG +SIb3DQEBBAUAA4GBANjskxPFHIYOxYD6q42o6wJqHZx5mvslAOhWxkMqwQGu5Z6i +zcKsdbD/l4F+SWB1iXMeQGxxKU4zqcjzo8N2YM9aNzGERqaGueIYu7ghN2n+80Sq +ce5xwjRHxTTq6I1PQArDyuoG4yRAeZBr9uKYtyXsYeZq1EdLooFbUAkPRB+Z -----END X509 CRL----- diff --git a/test/fixtures/keys/ca2-database.txt b/test/fixtures/keys/ca2-database.txt index a0966d2697..ed2c19f652 100644 --- a/test/fixtures/keys/ca2-database.txt +++ b/test/fixtures/keys/ca2-database.txt @@ -1 +1,2 @@ R 380729182912Z 110314182914Z 8306BE7DE1BB099A unknown /C=US/ST=CA/L=SF/O=Joyent/OU=Node.js/CN=agent4/emailAddress=ry@tinyclouds.org +R 411207195100Z 140723195100Z 8306BE7DE1BB099C unknown /C=US/ST=CA/L=SF/O=Joyent/OU=Node.js/CN=agent4/emailAddress=ry@tinyclouds.org diff --git a/test/fixtures/keys/ca2-key.pem b/test/fixtures/keys/ca2-key.pem index 49f678a351..aea047eed9 100644 --- a/test/fixtures/keys/ca2-key.pem +++ b/test/fixtures/keys/ca2-key.pem @@ -1,17 +1,18 @@ ------BEGIN ENCRYPT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E51F4BF188048BF + +r/NJ5tr2nsCWRuDEuElhG238GeC+EO2rLw0HEacCToZmfGmExSLLB7xxFIMzy7Bd +ccu8S39AtnHfFEs87Zi5cy6WKk7PZt5ll5gE7kfzDjEl/zx6aQbXsNkOE1d4HDr9 +fWfAbm1AwnXU0A93kIJco5P8fUZ4RoHbEndI/gnFv7coAZi4ivZBvAkFEdtEx4Ok +WVTz3wSB0gg6/wkfdbVv435e1YByJz79jZKpLHarc0k0W6l+/2KcR22mCQ+3USBz +xytbNhFwEiBnmp/zfP9ggFZt0ZYXb7r2Ddpc7hUIolA3wTlyjKHjYLcPzOl1PTQU +dAHzKXN5QuXx++Mm6S3G/xo/f5PQOs1WKEWoCi3VPf/JrpuRaHimqXp5oEEugCCz +J3YfIUu05cRBP22jT9n6IsXxtQIbZGcYzhVIenzw6K4O3Cn73iWjJVtfKVePLsF5 +cozx4ozrY2uIc9F2nvP9gA28YizArK4Dv5Q0Jt77YZR2aB6A7z0qhtQl/Omzs9/S +ddvbysa98S9xb3okWo6/5bmG3cIIhbr/60L0P6+HwKJROZ4zAQh3LLmiGe7gKpJM +ozqgxAYFUD56lkuUJnhdFoPonkVPZ1hBdBMQymECdfVL+WwWjZ8ZFghclhu932T4 +7Nmp30fQORUld7/PIdAc/wKk4x2IoTcRW/HY73QUwO/BCw/g3YUVqB7G8keh8Mcv +XOdWaQSebtxJ41SnFZfDUTBvGHrmr22YZJeU0gtiJdQR5m86ZG8h9tNK8wXWzNkn +VKMf4M1tTrdr4Uhhoeh3A38zCs0Pa+JopsoWuFjDNteBdYAeopYY2A== +-----END RSA PRIVATE KEY----- diff --git a/test/simple/test-tls-server-verify.js b/test/simple/test-tls-server-verify.js index 2b09d82163..377f95b6ba 100644 --- a/test/simple/test-tls-server-verify.js +++ b/test/simple/test-tls-server-verify.js @@ -19,11 +19,10 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +var common = require('../common'); - - -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); +if (!common.opensslCli) { + console.error('Skipping because node compiled without OpenSSL CLI.'); process.exit(0); } @@ -179,7 +178,8 @@ function runClient(options, cb) { } // To test use: openssl s_client -connect localhost:8000 - var client = spawn('openssl', args); + console.log(common.opensslCli, args); + var client = spawn(common.opensslCli, args); var out = ''; From 338ba2bc806ca1de7da7e55e164e460c1aa3cf88 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Wed, 23 Jul 2014 23:55:24 +0400 Subject: [PATCH 23/24] test: fix test-https-foafssl --- test/simple/test-https-foafssl.js | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/test/simple/test-https-foafssl.js b/test/simple/test-https-foafssl.js index 2336e5cd41..d896d19cc7 100644 --- a/test/simple/test-https-foafssl.js +++ b/test/simple/test-https-foafssl.js @@ -19,17 +19,18 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); +var common = require('../common'); + +if (!common.opensslCli) { + console.error('Skipping because node compiled without OpenSSL CLI.'); process.exit(0); } -var common = require('../common'); var assert = require('assert'); var join = require('path').join; var fs = require('fs'); -var exec = require('child_process').exec; +var spawn = require('child_process').spawn; var https = require('https'); @@ -40,6 +41,7 @@ var options = { }; var reqCount = 0; +var CRLF = '\r\n'; var body = 'hello world\n'; var cert; var subjectaltname; @@ -62,17 +64,26 @@ var server = https.createServer(options, function(req, res) { server.listen(common.PORT, function() { - var cmd = 'curl --insecure https://127.0.0.1:' + common.PORT + '/'; - cmd += ' --cert ' + join(common.fixturesDir, 'foafssl.crt'); - cmd += ' --key ' + join(common.fixturesDir, 'foafssl.key'); - console.error('executing %j', cmd); - exec(cmd, function(err, stdout, stderr) { - if (err) throw err; - common.error(common.inspect(stdout)); - assert.equal(body, stdout); + var args = ['s_client', + '-quiet', + '-connect', '127.0.0.1:' + common.PORT, + '-cert', join(common.fixturesDir, 'foafssl.crt'), + '-key', join(common.fixturesDir, 'foafssl.key')]; + + var client = spawn(common.opensslCli, args); + + client.stdout.on('data', function(data) { + var message = data.toString(); + var contents = message.split(CRLF + CRLF).pop(); + assert.equal(body, contents); server.close(); }); + client.stdin.write('GET /\n\n'); + + client.on('error', function(error) { + throw error; + }); }); process.on('exit', function() { From 38f6fcd822103f7e896532239c60c47b8fcc7d22 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Tue, 29 Jul 2014 12:34:49 +0400 Subject: [PATCH 24/24] buffer: fix sign overflow in `readUIn32BE` `|` operation takes precendence on `+`, which will result in `new Buffer('ffffffff', 16).readUInt32BE(0)` returning `-1` instead of `ffffffff`. --- lib/buffer.js | 4 ++-- test/simple/test-buffer.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 39facdecbb..e089aceb91 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -621,8 +621,8 @@ Buffer.prototype.readUInt32BE = function(offset, noAssert) { return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | - (this[offset + 2] << 8)) | - (this[offset + 3]); + (this[offset + 2] << 8) | + this[offset + 3]); }; diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js index f8b2798676..8ba024157a 100644 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@ -964,6 +964,22 @@ assert.throws(function() { buf.readInt8(0); }, /beyond buffer length/); ); }); +[16, 32].forEach(function(bits) { + var buf = new Buffer([0xFF, 0xFF, 0xFF, 0xFF]); + + assert.equal(buf['readUInt' + bits + 'BE'](0), + (0xFFFFFFFF >>> (32 - bits))); + + assert.equal(buf['readUInt' + bits + 'LE'](0), + (0xFFFFFFFF >>> (32 - bits))); + + assert.equal(buf['readInt' + bits + 'BE'](0), + (0xFFFFFFFF >> (32 - bits))); + + assert.equal(buf['readInt' + bits + 'LE'](0), + (0xFFFFFFFF >> (32 - bits))); +}); + // SlowBuffer sanity checks. assert.throws(function() { var len = 0xfffff;