summaryrefslogtreecommitdiff
path: root/src/node_constants.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2015-08-17 15:51:51 -0700
committerJames M Snell <jasnell@gmail.com>2015-08-23 08:52:01 -0700
commit5ba868f02493a9d81637d7f5983a47536332d7c8 (patch)
tree953013f47b6c6b5e2ab3b941558723826ddca6f4 /src/node_constants.cc
parent3a7be23f986f95412f968979c5d83ee68f3f2da2 (diff)
downloadandroid-node-v8-5ba868f02493a9d81637d7f5983a47536332d7c8.tar.gz
android-node-v8-5ba868f02493a9d81637d7f5983a47536332d7c8.tar.bz2
android-node-v8-5ba868f02493a9d81637d7f5983a47536332d7c8.zip
tls: add --tls-cipher-list command line switch
This adds a new `--tls-cipher-list` command line switch that can be used to override the built-in default cipher list. The intent of this is to make it possible to enforce an alternative default cipher list at the process level. Overriding the default cipher list is still permitted at the application level by changing the value of `require('tls').DEFAULT_CIPHERS`. As part of the change, the built in default list is moved out of tls.js and into node_constants.h and node_constants.cc. Two new constants are added to require('constants'): * defaultCipherList (the active default cipher list) * defaultCoreCipherList (the built-in default cipher list) A test case and doc changes are included. A new NODE_DEFINE_STRING_CONSTANT macro is also created in node_internals.h When node_constants is initialized, it will pick up either the passed in command line switch or fallback to the default built-in suite. Within joyent/node, this change had originaly been wrapped up with a number of other related commits involving the removal of the RC4 cipher. This breaks out this isolated change. /cc @mhdawson, @misterdjules, @trevnorris, @indutny, @rvagg Reviewed By: Ben Noordhuis <ben@strongloop.com> PR-URL: https://github.com/nodejs/node/pull/2412
Diffstat (limited to 'src/node_constants.cc')
-rw-r--r--src/node_constants.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/node_constants.cc b/src/node_constants.cc
index ce715a3246..59dd11113e 100644
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -24,6 +24,10 @@ namespace node {
using v8::Handle;
using v8::Object;
+#if HAVE_OPENSSL
+const char* default_cipher_list = DEFAULT_CIPHER_LIST_CORE;
+#endif
+
void DefineErrnoConstants(Handle<Object> target) {
#ifdef E2BIG
NODE_DEFINE_CONSTANT(target, E2BIG);
@@ -1108,6 +1112,17 @@ void DefineUVConstants(Handle<Object> target) {
NODE_DEFINE_CONSTANT(target, UV_UDP_REUSEADDR);
}
+void DefineCryptoConstants(Handle<Object> target) {
+#if HAVE_OPENSSL
+ NODE_DEFINE_STRING_CONSTANT(target,
+ "defaultCoreCipherList",
+ DEFAULT_CIPHER_LIST_CORE);
+ NODE_DEFINE_STRING_CONSTANT(target,
+ "defaultCipherList",
+ default_cipher_list);
+#endif
+}
+
void DefineConstants(Handle<Object> target) {
DefineErrnoConstants(target);
DefineWindowsErrorConstants(target);
@@ -1115,6 +1130,7 @@ void DefineConstants(Handle<Object> target) {
DefineOpenSSLConstants(target);
DefineSystemConstants(target);
DefineUVConstants(target);
+ DefineCryptoConstants(target);
}
} // namespace node