Skip to content

Commit 31dadd2

Browse files
davidbenevanlucas
authored andcommitted
crypto: deprecate {ecdhCurve: false}
This doesn't work in OpenSSL 1.1.0. Per discussion on the PR, it is preferable to just deprecate this setting. Deprecate it and skip the test in OpenSSL 1.1.0. PR-URL: #16130 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 26e4c58 commit 31dadd2

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎doc/api/deprecations.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,16 @@ Type: Runtime
737737
internal mechanics of the `REPLServer` itself, and is therefore not
738738
necessary in user space.
739739
740+
<a id="DEP0083"></a>
741+
### DEP0083: Disabling ECDH by setting ecdhCurve to false
742+
743+
Type: Runtime
744+
745+
The `ecdhCurve` option to `tls.createSecureContext()` and `tls.TLSSocket` could
746+
be set to `false` to disable ECDH entirely on the server only. This mode is
747+
deprecated in preparation for migrating to OpenSSL 1.1.0 and consistency with
748+
the client. Use the `ciphers` parameter instead.
749+
740750
741751
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
742752
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array

‎lib/_tls_common.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ function validateKeyCert(value, type) {
6565
exports.SecureContext=SecureContext;
6666

6767

68+
functionecdhCurveWarning(){
69+
if(ecdhCurveWarning.emitted)return;
70+
process.emitWarning('{ ecdhCurve: false } is deprecated.',
71+
'DeprecationWarning',
72+
'DEP0083');
73+
ecdhCurveWarning.emitted=true;
74+
}
75+
ecdhCurveWarning.emitted=false;
76+
77+
6878
exports.createSecureContext=functioncreateSecureContext(options,context){
6979
if(!options)options={};
7080

@@ -140,6 +150,8 @@ exports.createSecureContext = function createSecureContext(options, context) {
140150
c.context.setECDHCurve(tls.DEFAULT_ECDH_CURVE);
141151
elseif(options.ecdhCurve)
142152
c.context.setECDHCurve(options.ecdhCurve);
153+
else
154+
ecdhCurveWarning();
143155

144156
if(options.dhparam){
145157
constwarning=c.context.setDHParam(options.dhparam);

‎test/parallel/test-tls-ecdh-disable.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ if (!common.hasCrypto)
3131
if(!common.opensslCli)
3232
common.skip('missing openssl-cli');
3333

34+
constOPENSSL_VERSION_NUMBER=
35+
require('crypto').constants.OPENSSL_VERSION_NUMBER;
36+
if(OPENSSL_VERSION_NUMBER>=0x10100000)
37+
common.skip('false ecdhCurve not supported in OpenSSL 1.1.0');
38+
3439
constassert=require('assert');
3540
consttls=require('tls');
3641
constexec=require('child_process').exec;
@@ -42,6 +47,9 @@ const options = {
4247
ecdhCurve: false
4348
};
4449

50+
common.expectWarning('DeprecationWarning',
51+
'{ ecdhCurve: false } is deprecated.');
52+
4553
constserver=tls.createServer(options,common.mustNotCall());
4654

4755
server.listen(0,'127.0.0.1',common.mustCall(function(){

0 commit comments

Comments
 (0)