Skip to content

Commit

Permalink
test: increase diffie-hellman test coverage
Browse files Browse the repository at this point in the history
PR-URL: #17728
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
  • Loading branch information
Leko authored and MylesBorins committed Jan 9, 2018
1 parent 6d15185 commit c953967
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/parallel/test-crypto-dh.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ assert.strictEqual(secret2.toString('base64'), secret1);
assert.strictEqual(dh1.verifyError, 0);
assert.strictEqual(dh2.verifyError, 0);

{
const DiffieHellman = crypto.DiffieHellman;
const dh = DiffieHellman(p1, 'buffer');
assert(dh instanceof DiffieHellman, 'DiffieHellman is expected to return a ' +
'new instance when called without `new`');
}

{
const DiffieHellmanGroup = crypto.DiffieHellmanGroup;
const dhg = DiffieHellmanGroup('modp5');
assert(dhg instanceof DiffieHellmanGroup, 'DiffieHellmanGroup is expected ' +
'to return a new instance when ' +
'called without `new`');
}

{
const ECDH = crypto.ECDH;
const ecdh = ECDH('prime256v1');
assert(ecdh instanceof ECDH, 'ECDH is expected to return a new instance ' +
'when called without `new`');
}

[
[0x1, 0x2],
() => { },
Expand Down

0 comments on commit c953967

Please sign in to comment.