Skip to content

Commit

Permalink
test: make test-dh-regr more efficient where possible
Browse files Browse the repository at this point in the history
test-dh-regr is timing out in CI because crypto.createDiffieHellman() is
considerably slower after an OpenSSL upgrade. This PR modifies the
change from 11ad744 which made the test
FIPS-compatible. When not in FIPS mode, the test will use a shorter key
which will enable it to run much faster.

PR-URL: #28390
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
  • Loading branch information
Trott authored and targos committed Jul 2, 2019
1 parent 9f508e3 commit 69f17f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/pummel/test-dh-regr.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ if (!common.hasCrypto)
const assert = require('assert');
const crypto = require('crypto');

const p = crypto.createDiffieHellman(1024).getPrime();
// FIPS requires length >= 1024 but we use 256 in this test to keep it from
// taking too long and timing out in CI.
const length = common.hasFipsCrypto ? 1024 : 256;

const p = crypto.createDiffieHellman(length).getPrime();

for (let i = 0; i < 2000; i++) {
const a = crypto.createDiffieHellman(p);
Expand Down

0 comments on commit 69f17f1

Please sign in to comment.