Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extendable ca certs v4 #9771

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
4d3e158
test,lib,benchmark: match function names
Trott Oct 15, 2016
2677b9b
deps: V8: fix debug backtrace for symbols
ofrobots Jan 11, 2017
47d18d4
deps: backport d800a65 from V8 upstream
MylesBorins Jun 20, 2016
83144af
deps: backport 7a88ff3 from V8 upstream
MylesBorins Jun 22, 2016
e0db108
deps: backport a715957 from V8 upstream
MylesBorins Jun 29, 2016
20bee0f
deps: update patch level in V8
MylesBorins Jan 12, 2017
504b01b
v8,src: expose statistics about heap spaces
bripkens Dec 29, 2015
1c81530
child_process: add shell option to spawn()
cjihrig Jan 8, 2016
12ede48
fs: add the fs.mkdtemp() function.
ralt Feb 24, 2016
2912da4
process: add `process.memoryUsage.external`
indutny Nov 12, 2016
6b66647
test: refactor test-net-keepalive.js
kmccmk9 Dec 1, 2016
821498e
test: check for error on invalid signal
mattcphillips Dec 1, 2016
25fea45
tools: add macosx-firwall script to avoid popups
danbev Dec 3, 2016
3bd7ab1
test: stream readableListening internal state
italoacasas Dec 1, 2016
b302358
test: refactor test-handle-wrap-close-abort
Trott Dec 9, 2016
151cca6
process: add process.cpuUsage() - implementation, doc, tests
Apr 5, 2016
1a40f2d
tls, crypto: add ALPN Support
Apr 23, 2015
d706c0d
tls,crypto: move NPN protcol data to hidden value
Oct 26, 2015
43ee08f
test: fix alpn tests for openssl1.0.2h
May 3, 2016
15462eb
tls: copy the Buffer object before using
thefourtheye Aug 10, 2016
4341166
crypto: remove unnecessary variables of alpn/npn
shigeki Jan 16, 2017
2390fa9
test: refactor http pipelined socket test
Trott Dec 9, 2016
126d243
test: refactor assert.equal, update syntax to ES6
Dec 1, 2016
8109d61
test: refactor test-http-after-connect.js
larissayvette Dec 11, 2016
b4879f8
test: refactor test-fs-fsync
radelmann Dec 7, 2016
dccd5fd
test: refactor test-crypto-random
Trott Dec 12, 2016
494d236
test: use const/let and common.mustCall
outsideris Dec 1, 2016
2104124
test: cleanup test-stdout-close-catch.js
furnox Dec 1, 2016
6f8c901
test: refactor test-tls-ecdh-disable
Dec 1, 2016
a9ee489
win,msi: add required UIRef for localized strings
billti Oct 1, 2016
d5babe6
test: refactor test-timers-this
Trott Dec 17, 2016
5e9c6b5
doc: add Michaël Zasso to the CTC
targos Dec 21, 2016
3b7694f
test: add test-require-invalid-package
Dec 21, 2016
d559ba3
test: refactor test-net-reconnect-error
Dec 21, 2016
46d673a
test: use strictEqual in test-cwd-enoent-repl.js
nitsnwits Dec 1, 2016
c092aa3
test: refactor the code in test-http-keep-alive
edsadr Dec 21, 2016
2968876
test: change assert.strict to assert.strictEqual()
ashita92 Dec 1, 2016
ce95ba6
test: refactor test-stream2-writable
Trott Dec 20, 2016
5afa352
test: refactor test-stdin-script-child
emanuelbuholzer Dec 18, 2016
a123e8c
test: refactoring test-cluster-worker-constructor
crokita Dec 1, 2016
cd08da8
test: change var declarations, add mustCall check
Dec 1, 2016
e205bbd
doc: clarify macosx-firewall suggestion BUILDING
chasestarr Dec 17, 2016
6993d1c
doc: consistent 'Returns:' part two
MylesBorins Dec 21, 2016
0e0dc86
test: refactor test-child-process-stdin
navulirs Dec 23, 2016
f0714d2
test: improve test-cluster-net-listen.js
Dec 1, 2016
f45086b
test: update test-tls-check-server-identity.js
koxauvin Dec 1, 2016
3a9b5b4
test: refactor test-cluster-send-handle-twice.js
amarzavery Dec 1, 2016
9b13d98
test: refactor test-tls-interleave
bchirgwin Dec 1, 2016
f69b01e
test: refactor test-pipe-file-to-http
Dec 1, 2016
f80084c
test: fix and improve debug-break-on-uncaught
thefourtheye Dec 21, 2016
c074982
test: refactor test-child-process-ipc
malenesok007 Dec 1, 2016
6d51108
test: improve code in test-vm-symbols
edsadr Dec 23, 2016
81649fd
test: improve code in test-fs-readfile-error
edsadr Dec 21, 2016
7059543
test: improve the code in test-pipe.js
edsadr Dec 27, 2016
a394d00
doc: var -> const / let in the console.md
vsemozhetbyt Dec 25, 2016
f59b6dd
doc: more efficient example in the console.md
vsemozhetbyt Dec 25, 2016
03d3990
test: refactor the code in test-fs-chmod
edsadr Dec 24, 2016
b5b1ca6
doc: add Working Group dissolution text
williamkapke Nov 17, 2016
e197129
test: refactor test-stdin-from-file
radelmann Dec 19, 2016
e83c121
test: fix flaky test-http-client-timeout-with-data
Trott Dec 23, 2016
cbbe46a
test: s/ASSERT/assert/
cjihrig Dec 30, 2016
a8ff6b9
doc: redirect 'Start a Working Group' to TSC repo
williamkapke Nov 17, 2016
d32d64b
crypto: Use reference count to manage cert_store
AdamMajer Aug 30, 2016
5c8881d
debugger: call `this.resume()` after `this.run()`
lance Dec 2, 2016
8f4c29b
test: stream readableState readingMore state
chmln Dec 1, 2016
2f7270a
test: fail for missing output files
addaleax Dec 6, 2016
2410008
test: refactor test-domain.js
sidthekidder Dec 9, 2016
ffbd630
test: update test-domain-uncaught-exception.js
amazingandyyy Dec 9, 2016
b6c88d6
test: clean up domain-no-error-handler test
weyj4 Dec 15, 2016
906092b
src: fix string format mistake for 32 bit node
posix4e Dec 1, 2016
f26213a
stream, test: test _readableState.emittedReadable
joyeecheung Dec 13, 2016
083ff5c
test: stream readable needReadable state
joyeecheung Dec 12, 2016
cf1587a
test: stream readable resumeScheduled state
italoacasas Dec 16, 2016
6dfddc8
doc: clarify the review and landing process
joyeecheung Dec 9, 2016
2fb30f8
doc: require() tries first core not native modules
vice Dec 18, 2016
312745a
test: improve test-cluster-worker-constructor.js
edsadr Dec 21, 2016
b3bc996
test: fix flaky test-https-timeout
Trott Dec 22, 2016
2a26a31
test: improve code in test-vm-preserves-property
edsadr Dec 23, 2016
0ea78d4
doc: use "Node.js" in V8 guide
Trott Dec 24, 2016
78d85c6
src: describe what NODE_MODULE_VERSION is for
sam-github Dec 22, 2016
418d5ce
build: add (not) cross-compiled configure flags
piranna Dec 26, 2016
ff5c111
os: fix os.release() for aix and add test
jBarz Dec 13, 2016
4b55e9c
test: add test for SIGWINCH handling by stdio.js
sarahmeyer Dec 1, 2016
4502851
test: refactor test-stream2-unpipe-drain
storytimesolutions Dec 1, 2016
41a67c9
build: add /opt/freeware/... to AIX library path
Dec 13, 2016
2eba1d5
test: use strictEqual in test-http-server
ftatieze Dec 28, 2016
c51c3b0
doc: require two-factor authentication
Trott Dec 30, 2016
cd0ad3f
test: improve test-fs-empty-readStream.js
edsadr Dec 28, 2016
678c563
doc: warn about unvalidated input in child_process
Dec 26, 2016
04fb784
test: improve test-http-allow-req-after-204-res
edsadr Dec 30, 2016
0aa900f
test: avoid assigning this to variables
cjihrig Dec 30, 2016
823bcd6
test: update test-cluster-shared-handle-bind-error
cjihrig Dec 30, 2016
c6cb93f
test: add tests for clearBuffer state machine
captainsafia Dec 1, 2016
0ef4ea6
doc: add joyeecheung to collaborators
joyeecheung Jan 4, 2017
2b6581c
vm: add error message if we abort
fhinkel Sep 17, 2016
69c2ea9
test: add stdin-setrawmode.out file
Dec 6, 2016
a5fdd6a
test: set stdin too for pseudo-tty tests
addaleax Dec 6, 2016
1d7d640
doc: update CONTRIBUTING.MD with link to V8 guide
sarahmeyer Dec 1, 2016
ababc8a
test: use mustCall() for simple flow tracking
cjihrig Jul 15, 2016
f4e76eb
test: refactor test-tls-server-verify
Dec 1, 2016
42a52c0
test: refactor test-net-dns-custom-lookup
funkent Dec 1, 2016
beffa82
test: refactor test-repl-mode.js
cesarhq Dec 1, 2016
7492d3b
test: use common.fixturesDir almost everywhere
bengl May 26, 2016
657d3f3
test: test: refactor test-sync-fileread
jhwohlgemuth Dec 1, 2016
fb9a704
test: refactor test-tls-0-dns-altname
Dec 1, 2016
6625373
tools: add ESLint rule for assert.throws arguments
targos Nov 26, 2016
f0ede65
tools: forbid template literals in assert.throws
targos Dec 16, 2016
87463bf
test: add second argument to assert.throws()
russokj Dec 1, 2016
869b0a6
test: refactoring test-pipe-head
furnox Dec 1, 2016
2c33751
test: invalid package.json causes error when require()ing in directory
Dec 1, 2016
50f7e2f
test: refactor test-preload
Trott Nov 26, 2016
fa8f128
lib,test: use consistent operator linebreak style
targos Dec 8, 2016
84b312c
tools: enforce consistent operator linebreak style
targos Dec 8, 2016
f5c57c7
test: cleanup stream tests
italoacasas Sep 20, 2016
b342679
crypto: allow adding extra certs to well-known CAs
sam-github Oct 17, 2016
0b2d0eb
fixup! crypto: allow adding extra certs to well-known CAs
sam-github Jan 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tls,crypto: move NPN protcol data to hidden value
cherry-pick 7eee372 from v6-staging.

This fix is to be consistent implementation with ALPN. Tow NPN
protocol data in the persistent memebers move to hidden variables in
the wrap object.

PR-URL: #2564
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
Shigeki Ohtsu authored and MylesBorins committed Jan 19, 2017
commit d706c0dcc88c12305fc76768f88b0fc8e825963f
2 changes: 2 additions & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace node {
V(netmask_string, "netmask") \
V(nice_string, "nice") \
V(nlink_string, "nlink") \
V(npn_buffer_string, "npnBuffer") \
V(nsname_string, "nsname") \
V(ocsp_request_string, "OCSPRequest") \
V(offset_string, "offset") \
Expand Down Expand Up @@ -184,6 +185,7 @@ namespace node {
V(serial_string, "serial") \
V(scavenge_string, "scavenge") \
V(scopeid_string, "scopeid") \
V(selected_npn_buffer_string, "selectedNpnBuffer") \
V(sent_shutdown_string, "sentShutdown") \
V(serial_number_string, "serialNumber") \
V(service_string, "service") \
Expand Down
47 changes: 29 additions & 18 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1960,14 +1960,17 @@ int SSLWrap<Base>::AdvertiseNextProtoCallback(SSL* s,
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());

if (w->npn_protos_.IsEmpty()) {
Local<Value> npn_buffer =
w->object()->GetHiddenValue(env->npn_buffer_string());

if (npn_buffer.IsEmpty()) {
// No initialization - no NPN protocols
*data = reinterpret_cast<const unsigned char*>("");
*len = 0;
} else {
Local<Object> obj = PersistentToLocal(env->isolate(), w->npn_protos_);
*data = reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
*len = Buffer::Length(obj);
CHECK(Buffer::HasInstance(npn_buffer));
*data = reinterpret_cast<const unsigned char*>(Buffer::Data(npn_buffer));
*len = Buffer::Length(npn_buffer);
}

return SSL_TLSEXT_ERR_OK;
Expand All @@ -1986,25 +1989,27 @@ int SSLWrap<Base>::SelectNextProtoCallback(SSL* s,
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());

// Release old protocol handler if present
w->selected_npn_proto_.Reset();
Local<Value> npn_buffer =
w->object()->GetHiddenValue(env->npn_buffer_string());

if (w->npn_protos_.IsEmpty()) {
if (npn_buffer.IsEmpty()) {
// We should at least select one protocol
// If server is using NPN
*out = reinterpret_cast<unsigned char*>(const_cast<char*>("http/1.1"));
*outlen = 8;

// set status: unsupported
w->selected_npn_proto_.Reset(env->isolate(), False(env->isolate()));
bool r = w->object()->SetHiddenValue(env->selected_npn_buffer_string(),
False(env->isolate()));
CHECK(r);

return SSL_TLSEXT_ERR_OK;
}

Local<Object> obj = PersistentToLocal(env->isolate(), w->npn_protos_);
CHECK(Buffer::HasInstance(npn_buffer));
const unsigned char* npn_protos =
reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
size_t len = Buffer::Length(obj);
reinterpret_cast<const unsigned char*>(Buffer::Data(npn_buffer));
size_t len = Buffer::Length(npn_buffer);

int status = SSL_select_next_proto(out, outlen, in, inlen, npn_protos, len);
Local<Value> result;
Expand All @@ -2022,8 +2027,9 @@ int SSLWrap<Base>::SelectNextProtoCallback(SSL* s,
break;
}

if (!result.IsEmpty())
w->selected_npn_proto_.Reset(env->isolate(), result);
bool r = w->object()->SetHiddenValue(env->selected_npn_buffer_string(),
result);
CHECK(r);

return SSL_TLSEXT_ERR_OK;
}
Expand All @@ -2036,9 +2042,12 @@ void SSLWrap<Base>::GetNegotiatedProto(
ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder());

if (w->is_client()) {
if (w->selected_npn_proto_.IsEmpty() == false) {
args.GetReturnValue().Set(w->selected_npn_proto_);
}
Local<Value> selected_npn_buffer =
w->object()->GetHiddenValue(w->env()->selected_npn_buffer_string());

if (selected_npn_buffer.IsEmpty() == false)
args.GetReturnValue().Set(selected_npn_buffer);

return;
}

Expand All @@ -2062,9 +2071,11 @@ void SSLWrap<Base>::SetNPNProtocols(const FunctionCallbackInfo<Value>& args) {
Environment* env = w->ssl_env();

if (args.Length() < 1 || !Buffer::HasInstance(args[0]))
return w->env()->ThrowTypeError("Must give a Buffer as first argument");
return env->ThrowTypeError("Must give a Buffer as first argument");

w->npn_protos_.Reset(args.GetIsolate(), args[0].As<Object>());
Local<Value> npn_buffer = Local<Value>::New(env->isolate(), args[0]);
bool r = w->object()->SetHiddenValue(env->npn_buffer_string(), npn_buffer);
CHECK(r);
}
#endif // OPENSSL_NPN_NEGOTIATED

Expand Down
9 changes: 0 additions & 9 deletions src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ class SSLWrap {
next_sess_ = nullptr;
}

#ifdef OPENSSL_NPN_NEGOTIATED
npn_protos_.Reset();
selected_npn_proto_.Reset();
#endif
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
sni_context_.Reset();
#endif
Expand Down Expand Up @@ -313,11 +309,6 @@ class SSLWrap {
v8::Persistent<v8::Object> ocsp_response_;
#endif // NODE__HAVE_TLSEXT_STATUS_CB

#ifdef OPENSSL_NPN_NEGOTIATED
v8::Persistent<v8::Object> npn_protos_;
v8::Persistent<v8::Value> selected_npn_proto_;
#endif // OPENSSL_NPN_NEGOTIATED

#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
v8::Persistent<v8::Value> sni_context_;
#endif
Expand Down