tls: output warning of setDHParam to console.trace
To make it easy to figure out where the warning comes from. Also fix style and variable name that was made in #1739. PR-URL: https://github.com/nodejs/node/pull/1831 Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
f72e178a78
commit
0140e1b5e3
@ -99,7 +99,11 @@ exports.createSecureContext = function createSecureContext(options, context) {
|
|||||||
else if (options.ecdhCurve)
|
else if (options.ecdhCurve)
|
||||||
c.context.setECDHCurve(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 (options.crl) {
|
||||||
if (Array.isArray(options.crl)) {
|
if (Array.isArray(options.crl)) {
|
||||||
|
@ -797,12 +797,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
|
|||||||
if (dh == nullptr)
|
if (dh == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int keylen = BN_num_bits(dh->p);
|
const int size = BN_num_bits(dh->p);
|
||||||
if (keylen < 1024) {
|
if (size < 1024) {
|
||||||
DH_free(dh);
|
|
||||||
return env->ThrowError("DH parameter is less than 1024 bits");
|
return env->ThrowError("DH parameter is less than 1024 bits");
|
||||||
} else if (keylen < 2048) {
|
} else if (size < 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);
|
SSL_CTX_set_options(sc->ctx_, SSL_OP_SINGLE_DH_USE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user