Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: more regression tests for minDHSize option #3629

Merged
merged 2 commits into from
Nov 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ exports.connect = function(/* [port, host], options, cb */) {
assert(typeof options.minDHSize === 'number',
'options.minDHSize is not a number: ' + options.minDHSize);
assert(options.minDHSize > 0,
'options.minDHSize is not a posivie number: ' +
'options.minDHSize is not a positive number: ' +
options.minDHSize);

var hostname = options.servername ||
Expand Down
12 changes: 12 additions & 0 deletions test/parallel/test-tls-client-mindhsize.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ function testDHE2048() {

testDHE1024();

assert.throws(() => test(512, true, assert.fail),
/DH parameter is less than 1024 bits/);

[0, -1, -Infinity, NaN].forEach(minDHSize => {
assert.throws(() => tls.connect({ minDHSize }),
/minDHSize is not a positive number/);
});

[true, false, null, undefined, {}, [], '', '1'].forEach(minDHSize => {
assert.throws(() => tls.connect({ minDHSize }), /minDHSize is not a number/);
});

process.on('exit', function() {
assert.equal(nsuccess, 1);
assert.equal(nerror, 1);
Expand Down