From 82df345fbba15ba42eeb9955f3bc76609c86e677 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 21 Oct 2012 23:55:52 +0200 Subject: [PATCH] test: add diffie-hellman regression test Exercises the error path in DiffieHellman::ComputeSecret() in src/node_crypto.cc --- test/simple/test-crypto.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js index de8c1a9d638cef..535af760fac0ab 100644 --- a/test/simple/test-crypto.js +++ b/test/simple/test-crypto.js @@ -530,6 +530,10 @@ var secret3 = dh3.computeSecret(key2, 'hex', 'base64'); assert.equal(secret1, secret3); +assert.throws(function() { + dh3.computeSecret(''); +}, /key is too small/i); + // https://github.com/joyent/node/issues/2338 assert.throws(function() { var p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' +