| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f72e178 commit 0140e1b
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,11 @@ exports.createSecureContext = function createSecureContext(options, context) { | |||
| 99 | 99 | else if (options.ecdhCurve) | |
| 100 | 100 | c.context.setECDHCurve(options.ecdhCurve); | |
| 101 | 101 | ||
| 102 | - if (options.dhparam) c.context.setDHParam(options.dhparam); | ||
| 102 | + if (options.dhparam) { | ||
| 103 | + var warning = c.context.setDHParam(options.dhparam); | ||
| 104 | + if (warning) | ||
| 105 | + console.trace(warning); | ||
| 106 | + } | ||
| 103 | 107 | ||
| 104 | 108 | if (options.crl) { | |
| 105 | 109 | if (Array.isArray(options.crl)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -797,12 +797,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { | |||
| 797 | 797 | if (dh == nullptr) | |
| 798 | 798 | return; | |
| 799 | 799 | ||
| 800 | - const int keylen = BN_num_bits(dh->p); | ||
| 801 | - if (keylen < 1024) { | ||
| 802 | - DH_free(dh); | ||
| 800 | + const int size = BN_num_bits(dh->p); | ||
| 801 | + if (size < 1024) { | ||
| 803 | 802 | return env->ThrowError("DH parameter is less than 1024 bits"); | |
| 804 | - } else if (keylen < 2048) { | ||
| 805 | - fprintf(stderr, "WARNING: DH parameter is less than 2048 bits\n"); | ||
| 803 | + } else if (size < 2048) { | ||
| 804 | + args.GetReturnValue().Set(FIXED_ONE_BYTE_STRING( | ||
| 805 | + env->isolate(), "WARNING: DH parameter is less than 2048 bits")); | ||
| 806 | 806 | } | |
| 807 | 807 | ||
| 808 | 808 | SSL_CTX_set_options(sc->ctx_, SSL_OP_SINGLE_DH_USE); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments