diff --git a/lib/_tls_common.js b/lib/_tls_common.js index d857717dabae15..120dce5784b27b 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -99,7 +99,11 @@ exports.createSecureContext = function createSecureContext(options, context) { else if (options.ecdhCurve) c.context.setECDHCurve(options.ecdhCurve); - if (options.dhparam) c.context.setDHParam(options.dhparam); + if (options.dhparam) { + var warning = c.context.setDHParam(options.dhparam); + if (warning) + console.trace(warning); + } if (options.crl) { if (Array.isArray(options.crl)) { diff --git a/src/node_crypto.cc b/src/node_crypto.cc index e2c478a510be84..025909417b6289 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -761,7 +761,8 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { if (keylen < 1024) return env->ThrowError("DH parameter is less than 1024 bits"); else if (keylen < 2048) - fprintf(stderr, "WARNING: DH parameter is less than 2048 bits\n"); + args.GetReturnValue().Set(FIXED_ONE_BYTE_STRING( + env->isolate(), "WARNING: DH parameter is less than 2048 bits")); SSL_CTX_set_options(sc->ctx_, SSL_OP_SINGLE_DH_USE); int r = SSL_CTX_set_tmp_dh(sc->ctx_, dh);