From 69f17f1ab097fba6101631ca3d844e17b153c403 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 22 Jun 2019 15:57:14 -0600 Subject: [PATCH] test: make test-dh-regr more efficient where possible test-dh-regr is timing out in CI because crypto.createDiffieHellman() is considerably slower after an OpenSSL upgrade. This PR modifies the change from 11ad744a92374ad71730cbfb7abea71fda0abb74 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: https://github.com/nodejs/node/pull/28390 Reviewed-By: Ben Noordhuis Reviewed-By: Daniel Bevenius --- test/pummel/test-dh-regr.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index ff964ec13a47c6..f2da464bbbfbd7 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -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);