Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-04-03 21:32:34 +0300
committerSam Roberts <vieuxtech@gmail.com>2019-04-08 19:46:55 +0300
commita3f30a48c2392f97e40bfc347bcd301935131267 (patch)
treefba78e4adefc0c7c3ce9bbd5a3b3fad958410bc7 /src/node_constants.cc
parent0911e88056618766093a086fe643949eab430fa5 (diff)
src: unify crypto constant setup
DefineCryptoConstants() sets constants from OpenSSL into `crypto.constants`, for crypto and tls. DefineOpenSSLConstants() did exactly the same. Unify them. PR-URL: https://github.com/nodejs/node/pull/27077 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_constants.cc')
-rw-r--r--src/node_constants.cc52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/node_constants.cc b/src/node_constants.cc
index f08bcbcb25b..ddb2bdda1f1 100644
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -795,7 +795,7 @@ void DefinePriorityConstants(Local<Object> target) {
#endif
}
-void DefineOpenSSLConstants(Local<Object> target) {
+void DefineCryptoConstants(Local<Object> target) {
#ifdef OPENSSL_VERSION_NUMBER
NODE_DEFINE_CONSTANT(target, OPENSSL_VERSION_NUMBER);
#endif
@@ -1041,6 +1041,31 @@ void DefineOpenSSLConstants(Local<Object> target) {
NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_AUTO);
#endif
+#ifdef DEFAULT_CIPHER_LIST_CORE
+ NODE_DEFINE_STRING_CONSTANT(target,
+ "defaultCoreCipherList",
+ DEFAULT_CIPHER_LIST_CORE);
+#endif
+
+#ifdef TLS1_VERSION
+ NODE_DEFINE_CONSTANT(target, TLS1_VERSION);
+#endif
+
+#ifdef TLS1_1_VERSION
+ NODE_DEFINE_CONSTANT(target, TLS1_1_VERSION);
+#endif
+
+#ifdef TLS1_2_VERSION
+ NODE_DEFINE_CONSTANT(target, TLS1_2_VERSION);
+#endif
+
+#ifdef TLS1_3_VERSION
+ NODE_DEFINE_CONSTANT(target, TLS1_3_VERSION);
+#endif
+
+ // Unused by node, but removing it is semver-major.
+ NODE_DEFINE_CONSTANT(target, INT_MAX);
+
#if HAVE_OPENSSL
// NOTE: These are not defines
NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_COMPRESSED);
@@ -1048,6 +1073,12 @@ void DefineOpenSSLConstants(Local<Object> target) {
NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_UNCOMPRESSED);
NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_HYBRID);
+
+ NODE_DEFINE_STRING_CONSTANT(
+ target,
+ "defaultCipherList",
+ per_process::cli_options->tls_cipher_list.c_str());
+
#endif
}
@@ -1232,24 +1263,6 @@ void DefineSystemConstants(Local<Object> target) {
#endif
}
-void DefineCryptoConstants(Local<Object> target) {
-#if HAVE_OPENSSL
- NODE_DEFINE_STRING_CONSTANT(target,
- "defaultCoreCipherList",
- DEFAULT_CIPHER_LIST_CORE);
- NODE_DEFINE_STRING_CONSTANT(
- target,
- "defaultCipherList",
- per_process::cli_options->tls_cipher_list.c_str());
-
- NODE_DEFINE_CONSTANT(target, TLS1_VERSION);
- NODE_DEFINE_CONSTANT(target, TLS1_1_VERSION);
- NODE_DEFINE_CONSTANT(target, TLS1_2_VERSION);
- NODE_DEFINE_CONSTANT(target, TLS1_3_VERSION);
-#endif
- NODE_DEFINE_CONSTANT(target, INT_MAX);
-}
-
void DefineDLOpenConstants(Local<Object> target) {
#ifdef RTLD_LAZY
NODE_DEFINE_CONSTANT(target, RTLD_LAZY);
@@ -1347,7 +1360,6 @@ void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
DefineSignalConstants(sig_constants);
DefinePriorityConstants(priority_constants);
DefineSystemConstants(fs_constants);
- DefineOpenSSLConstants(crypto_constants);
DefineCryptoConstants(crypto_constants);
DefineZlibConstants(zlib_constants);
DefineDLOpenConstants(dlopen_constants);