From 33c35a38dc116914847b76428ff696c403dfb9e6 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 22 Mar 2021 11:28:48 +0100 Subject: [PATCH] test: add OpenSSL 3.0 checks to test-crypto-keygen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently test-crypto-keygen.js fails when dynamically linking against OpenSSL 3.0 which the following error: === debug test-crypto-keygen === Path: parallel/test-crypto-keygen node:assert:901 throw newErr; ^ AssertionError [ERR_ASSERTION]: ifError got unwanted exception: error:05000072:dsa routines::bad ffc parameters at DsaKeyPairGenJob. (/nodejs/openssl/test/common/index.js:342:12) at DsaKeyPairGenJob. (/openssl/test/common/index.js:379:15) at DsaKeyPairGenJob.job.ondone (node:internal/crypto/keygen:77:23) { generatedMessage: false, code: 'ERR_ASSERTION', actual: [Error: error:05000072:dsa routines::bad ffc parameters], expected: null, operator: 'ifError' } Command: node /nodejs/openssl/test/parallel/test-crypto-keygen.js This commit adds a check and adjusts the modulus length when linking against OpenSSL 3.0. PR-URL: https://github.com/nodejs/node/pull/37860 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Richard Lau Reviewed-By: Beth Griggs Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- test/parallel/test-crypto-keygen.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index af73d5a6b45fd6..e5c8a107ba58a1 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -389,20 +389,20 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); { // Test async DSA key object generation. generateKeyPair('dsa', { - modulusLength: 512, + modulusLength: common.hasOpenSSL3 ? 2048 : 512, divisorLength: 256 }, common.mustSucceed((publicKey, privateKey) => { assert.strictEqual(publicKey.type, 'public'); assert.strictEqual(publicKey.asymmetricKeyType, 'dsa'); assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { - modulusLength: 512, + modulusLength: common.hasOpenSSL3 ? 2048 : 512, divisorLength: 256 }); assert.strictEqual(privateKey.type, 'private'); assert.strictEqual(privateKey.asymmetricKeyType, 'dsa'); assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { - modulusLength: 512, + modulusLength: common.hasOpenSSL3 ? 2048 : 512, divisorLength: 256 }); }));