summaryrefslogtreecommitdiff
path: root/test/pummel
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-06-22 15:57:14 -0600
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-06-25 05:37:30 +0200
commitc3284822af61be6dcdc3c54bb4c05a7b6f025a99 (patch)
treee5ab152ba79714baed370e5201d7b8a031c39908 /test/pummel
parent2e8e0707d0ec1bcbbeddbd1e7bcc7d50337d2510 (diff)
downloadandroid-node-v8-c3284822af61be6dcdc3c54bb4c05a7b6f025a99.tar.gz
android-node-v8-c3284822af61be6dcdc3c54bb4c05a7b6f025a99.tar.bz2
android-node-v8-c3284822af61be6dcdc3c54bb4c05a7b6f025a99.zip
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 <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'test/pummel')
-rw-r--r--test/pummel/test-dh-regr.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js
index ff964ec13a..f2da464bbb 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);