Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 47a3e46

Browse files
chakrabotjackhorton
authored andcommitted
meta: merge node/master into node-chakracore/master
Merge c5a49e1 as of 2017-11-12 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Jack Horton <jahorto@microsoft.com>
2 parents 92aaf56 + c5a49e1 commit 47a3e46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+814
-307
lines changed

BUILDING.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ in production.
4141
|--------------|--------------|----------------------------------|----------------------|------------------|
4242
| GNU/Linux | Tier 1 | kernel >= 2.6.32, glibc >= 2.12 | x86, x64, arm, arm64 | |
4343
| macOS | Tier 1 | >= 10.10 | x64 | |
44-
| Windows | Tier 1 | >= Windows 7 / 2008 R2 | x86, x64 | vs2015 or vs2017 |
44+
| Windows | Tier 1 | >= Windows 7 / 2008 R2 | x86, x64 | vs2017 |
4545
| SmartOS | Tier 2 | >= 15 < 16.4 | x86, x64 | see note1 |
4646
| FreeBSD | Tier 2 | >= 10 | x64 | |
4747
| GNU/Linux | Tier 2 | kernel >= 3.13.0, glibc >= 2.19 | ppc64le >=power8 | |
@@ -76,7 +76,7 @@ Depending on host platform, the selection of toolchains may vary.
7676

7777
#### Windows
7878

79-
* Visual Studio 2015 or Visual C++ Build Tools 2015 or newer
79+
* Visual Studio 2017 or the Build Tools thereof
8080

8181
## Building Node.js on supported platforms
8282

@@ -192,16 +192,11 @@ $ [sudo] make install
192192
Prerequisites:
193193

194194
* [Python 2.6 or 2.7](https://www.python.org/downloads/)
195-
* One of:
196-
* [Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)
197-
* [Visual Studio 2015 Update 3](https://www.visualstudio.com/), all editions
198-
including the Community edition (remember to select
199-
"Common Tools for Visual C++ 2015" feature during installation).
200-
* The "Desktop development with C++" workload from
201-
[Visual Studio 2017](https://www.visualstudio.com/downloads/) or the
202-
"Visual C++ build tools" workload from the
203-
[Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017),
204-
with the default optional components.
195+
* The "Desktop development with C++" workload from
196+
[Visual Studio 2017](https://www.visualstudio.com/downloads/) or the
197+
"Visual C++ build tools" workload from the
198+
[Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017),
199+
with the default optional components.
205200
* Basic Unix tools required for some tests,
206201
[Git for Windows](http://git-scm.com/download/win) includes Git Bash
207202
and tools which can be included in the global `PATH`.

doc/api/errors.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ Used when `Console` is instantiated without `stdout` stream or when `stdout` or
653653

654654
Used when the native call from `process.cpuUsage` cannot be processed properly.
655655

656+
<a id="ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED"></a>
657+
### ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED
658+
659+
Used when a client certificate engine is requested that is not supported by the
660+
version of OpenSSL being used.
661+
656662
<a id="ERR_CRYPTO_ECDH_INVALID_FORMAT"></a>
657663
### ERR_CRYPTO_ECDH_INVALID_FORMAT
658664

doc/api/https.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ Global instance of [`https.Agent`][] for all HTTPS client requests.
150150
<!-- YAML
151151
added: v0.3.6
152152
changes:
153+
- version: REPLACEME
154+
pr-url: https://github.com/nodejs/node/pull/6569
155+
description: The `options` parameter can now include `clientCertEngine`.
153156
- version: v7.5.0
154157
pr-url: https://github.com/nodejs/node/pull/10638
155158
description: The `options` parameter can be a WHATWG `URL` object.
@@ -164,9 +167,9 @@ changes:
164167

165168
Makes a request to a secure web server.
166169

167-
The following additional `options` from [`tls.connect()`][] are also accepted when using a
168-
custom [`Agent`][]:
169-
`pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`, `secureProtocol`, `servername`
170+
The following additional `options` from [`tls.connect()`][] are also accepted
171+
when using a custom [`Agent`][]: `ca`, `cert`, `ciphers`, `clientCertEngine`,
172+
`key`, `passphrase`, `pfx`, `rejectUnauthorized`, `secureProtocol`, `servername`
170173

171174
`options` can be an object, a string, or a [`URL`][] object. If `options` is a
172175
string, it is automatically parsed with [`url.parse()`][]. If it is a [`URL`][]

doc/api/tls.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,9 @@ port or host argument.
905905
<!-- YAML
906906
added: v0.11.13
907907
changes:
908+
- version: REPLACEME
909+
pr-url: https://github.com/nodejs/node/pull/6569
910+
description: The `options` parameter can now include `clientCertEngine`.
908911
- version: v7.3.0
909912
pr-url: https://github.com/nodejs/node/pull/10294
910913
description: If the `key` option is an array, individual entries do not
@@ -959,8 +962,6 @@ changes:
959962
certificate can match or chain to.
960963
For self-signed certificates, the certificate is its own CA, and must be
961964
provided.
962-
* `crl` {string|string[]|Buffer|Buffer[]} Optional PEM formatted
963-
CRLs (Certificate Revocation Lists).
964965
* `ciphers` {string} Optional cipher suite specification, replacing the
965966
default. For more information, see [modifying the default cipher suite][].
966967
* `honorCipherOrder` {boolean} Attempt to use the server's cipher suite
@@ -974,20 +975,24 @@ changes:
974975
[`crypto.getCurves()`][] to obtain a list of available curve names. On
975976
recent releases, `openssl ecparam -list_curves` will also display the name
976977
and description of each available elliptic curve.
978+
* `clientCertEngine` {string} Optional name of an OpenSSL engine which can
979+
provide the client certificate.
980+
* `crl` {string|string[]|Buffer|Buffer[]} Optional PEM formatted
981+
CRLs (Certificate Revocation Lists).
977982
* `dhparam` {string|Buffer} Diffie Hellman parameters, required for
978983
[Perfect Forward Secrecy][]. Use `openssl dhparam` to create the parameters.
979984
The key length must be greater than or equal to 1024 bits, otherwise an
980985
error will be thrown. It is strongly recommended to use 2048 bits or larger
981986
for stronger security. If omitted or invalid, the parameters are silently
982987
discarded and DHE ciphers will not be available.
983-
* `secureProtocol` {string} Optional SSL method to use, default is
984-
`"SSLv23_method"`. The possible values are listed as [SSL_METHODS][], use
985-
the function names as strings. For example, `"SSLv3_method"` to force SSL
986-
version 3.
987988
* `secureOptions` {number} Optionally affect the OpenSSL protocol behavior,
988989
which is not usually necessary. This should be used carefully if at all!
989990
Value is a numeric bitmask of the `SSL_OP_*` options from
990991
[OpenSSL Options][].
992+
* `secureProtocol` {string} Optional SSL method to use, default is
993+
`"SSLv23_method"`. The possible values are listed as [SSL_METHODS][], use
994+
the function names as strings. For example, `"SSLv3_method"` to force SSL
995+
version 3.
991996
* `sessionIdContext` {string} Optional opaque identifier used by servers to
992997
ensure session state is not shared between applications. Unused by clients.
993998

@@ -1015,6 +1020,9 @@ publicly trusted list of CAs as given in
10151020
<!-- YAML
10161021
added: v0.3.2
10171022
changes:
1023+
- version: REPLACEME
1024+
pr-url: https://github.com/nodejs/node/pull/6569
1025+
description: The `options` parameter can now include `clientCertEngine`.
10181026
- version: v8.0.0
10191027
pr-url: https://github.com/nodejs/node/pull/11984
10201028
description: The `ALPNProtocols` and `NPNProtocols` options can
@@ -1025,6 +1033,8 @@ changes:
10251033
-->
10261034

10271035
* `options` {Object}
1036+
* `clientCertEngine` {string} Optional name of an OpenSSL engine which can
1037+
provide the client certificate.
10281038
* `handshakeTimeout` {number} Abort the connection if the SSL/TLS handshake
10291039
does not finish in the specified number of milliseconds. Defaults to `120`
10301040
seconds. A `'tlsClientError'` is emitted on the `tls.Server` object whenever

lib/_tls_common.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,18 @@ exports.createSecureContext = function createSecureContext(options, context) {
208208
c.context.setFreeListLength(0);
209209
}
210210

211+
if (typeof options.clientCertEngine === 'string') {
212+
if (c.context.setClientCertEngine)
213+
c.context.setClientCertEngine(options.clientCertEngine);
214+
else
215+
throw new errors.Error('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED');
216+
} else if (options.clientCertEngine != null) {
217+
throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
218+
'options.clientCertEngine',
219+
['string', 'null', 'undefined'],
220+
options.clientCertEngine);
221+
}
222+
211223
return c;
212224
};
213225

lib/_tls_wrap.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ function tlsConnectionListener(rawSocket) {
816816
// - rejectUnauthorized. Boolean, default to true.
817817
// - key. string.
818818
// - cert: string.
819+
// - clientCertEngine: string.
819820
// - ca: string or array of strings.
820821
// - sessionTimeout: integer.
821822
//
@@ -859,6 +860,7 @@ function Server(options, listener) {
859860
key: this.key,
860861
passphrase: this.passphrase,
861862
cert: this.cert,
863+
clientCertEngine: this.clientCertEngine,
862864
ca: this.ca,
863865
ciphers: this.ciphers,
864866
ecdhCurve: this.ecdhCurve,
@@ -931,6 +933,8 @@ Server.prototype.setOptions = function(options) {
931933
if (options.key) this.key = options.key;
932934
if (options.passphrase) this.passphrase = options.passphrase;
933935
if (options.cert) this.cert = options.cert;
936+
if (options.clientCertEngine)
937+
this.clientCertEngine = options.clientCertEngine;
934938
if (options.ca) this.ca = options.ca;
935939
if (options.secureProtocol) this.secureProtocol = options.secureProtocol;
936940
if (options.crl) this.crl = options.crl;

lib/https.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ Agent.prototype.getName = function getName(options) {
160160
if (options.cert)
161161
name += options.cert;
162162

163+
name += ':';
164+
if (options.clientCertEngine)
165+
name += options.clientCertEngine;
166+
163167
name += ':';
164168
if (options.ciphers)
165169
name += options.ciphers;

lib/internal/errors.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received');
232232
E('ERR_CONSOLE_WRITABLE_STREAM',
233233
'Console expects a writable stream instance for %s');
234234
E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s');
235+
E('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED',
236+
'Custom engines not supported by this OpenSSL');
235237
E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s');
236238
E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found');
237239
E('ERR_CRYPTO_FIPS_FORCED',

src/env-inl.h

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,9 @@
3737

3838
namespace node {
3939

40-
inline IsolateData::IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop,
41-
uint32_t* zero_fill_field) :
42-
43-
// Create string and private symbol properties as internalized one byte strings.
44-
//
45-
// Internalized because it makes property lookups a little faster and because
46-
// the string is created in the old space straight away. It's going to end up
47-
// in the old space sooner or later anyway but now it doesn't go through
48-
// v8::Eternal's new space handling first.
49-
//
50-
// One byte because our strings are ASCII and we can safely skip V8's UTF-8
51-
// decoding step. It's a one-time cost, but why pay it when you don't have to?
52-
#define V(PropertyName, StringValue) \
53-
PropertyName ## _( \
54-
isolate, \
55-
v8::Private::New( \
56-
isolate, \
57-
v8::String::NewFromOneByte( \
58-
isolate, \
59-
reinterpret_cast<const uint8_t*>(StringValue), \
60-
v8::NewStringType::kInternalized, \
61-
sizeof(StringValue) - 1).ToLocalChecked())),
62-
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V)
63-
#undef V
64-
#define V(PropertyName, StringValue) \
65-
PropertyName ## _( \
66-
isolate, \
67-
v8::String::NewFromOneByte( \
68-
isolate, \
69-
reinterpret_cast<const uint8_t*>(StringValue), \
70-
v8::NewStringType::kInternalized, \
71-
sizeof(StringValue) - 1).ToLocalChecked()),
72-
PER_ISOLATE_STRING_PROPERTIES(V)
73-
#undef V
74-
event_loop_(event_loop), zero_fill_field_(zero_fill_field) {}
40+
inline v8::Isolate* IsolateData::isolate() const {
41+
return isolate_;
42+
}
7543

7644
inline uv_loop_t* IsolateData::event_loop() const {
7745
return event_loop_;
@@ -81,6 +49,10 @@ inline uint32_t* IsolateData::zero_fill_field() const {
8149
return zero_fill_field_;
8250
}
8351

52+
inline MultiIsolatePlatform* IsolateData::platform() const {
53+
return platform_;
54+
}
55+
8456
inline Environment::AsyncHooks::AsyncHooks(v8::Isolate* isolate)
8557
: isolate_(isolate),
8658
fields_(isolate, kFieldsCount),

src/env.cc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "async-wrap.h"
33
#include "v8-profiler.h"
44
#include "node_buffer.h"
5+
#include "node_platform.h"
56

67
#if defined(_MSC_VER)
78
#define getpid GetCurrentProcessId
@@ -17,10 +18,62 @@ namespace node {
1718
using v8::Context;
1819
using v8::FunctionTemplate;
1920
using v8::HandleScope;
21+
using v8::Isolate;
2022
using v8::Local;
2123
using v8::Message;
24+
using v8::Private;
2225
using v8::StackFrame;
2326
using v8::StackTrace;
27+
using v8::String;
28+
29+
IsolateData::IsolateData(Isolate* isolate,
30+
uv_loop_t* event_loop,
31+
MultiIsolatePlatform* platform,
32+
uint32_t* zero_fill_field) :
33+
34+
// Create string and private symbol properties as internalized one byte strings.
35+
//
36+
// Internalized because it makes property lookups a little faster and because
37+
// the string is created in the old space straight away. It's going to end up
38+
// in the old space sooner or later anyway but now it doesn't go through
39+
// v8::Eternal's new space handling first.
40+
//
41+
// One byte because our strings are ASCII and we can safely skip V8's UTF-8
42+
// decoding step. It's a one-time cost, but why pay it when you don't have to?
43+
#define V(PropertyName, StringValue) \
44+
PropertyName ## _( \
45+
isolate, \
46+
Private::New( \
47+
isolate, \
48+
String::NewFromOneByte( \
49+
isolate, \
50+
reinterpret_cast<const uint8_t*>(StringValue), \
51+
v8::NewStringType::kInternalized, \
52+
sizeof(StringValue) - 1).ToLocalChecked())),
53+
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V)
54+
#undef V
55+
#define V(PropertyName, StringValue) \
56+
PropertyName ## _( \
57+
isolate, \
58+
String::NewFromOneByte( \
59+
isolate, \
60+
reinterpret_cast<const uint8_t*>(StringValue), \
61+
v8::NewStringType::kInternalized, \
62+
sizeof(StringValue) - 1).ToLocalChecked()),
63+
PER_ISOLATE_STRING_PROPERTIES(V)
64+
#undef V
65+
isolate_(isolate),
66+
event_loop_(event_loop),
67+
zero_fill_field_(zero_fill_field),
68+
platform_(platform) {
69+
if (platform_ != nullptr)
70+
platform_->RegisterIsolate(this, event_loop);
71+
}
72+
73+
IsolateData::~IsolateData() {
74+
if (platform_ != nullptr)
75+
platform_->UnregisterIsolate(this);
76+
}
2477

2578
void Environment::Start(int argc,
2679
const char* const* argv,

0 commit comments

Comments
 (0)