Skip to content

Commit 33c35a3

Browse files
danbevruyadorno
authored andcommitted
test: add OpenSSL 3.0 checks to test-crypto-keygen
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.<anonymous> (/nodejs/openssl/test/common/index.js:342:12) at DsaKeyPairGenJob.<anonymous> (/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: #37860 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent d5b472b commit 33c35a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/parallel/test-crypto-keygen.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,20 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
389389
{
390390
// Test async DSA key object generation.
391391
generateKeyPair('dsa', {
392-
modulusLength: 512,
392+
modulusLength: common.hasOpenSSL3 ? 2048 : 512,
393393
divisorLength: 256
394394
}, common.mustSucceed((publicKey, privateKey) => {
395395
assert.strictEqual(publicKey.type, 'public');
396396
assert.strictEqual(publicKey.asymmetricKeyType, 'dsa');
397397
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {
398-
modulusLength: 512,
398+
modulusLength: common.hasOpenSSL3 ? 2048 : 512,
399399
divisorLength: 256
400400
});
401401

402402
assert.strictEqual(privateKey.type, 'private');
403403
assert.strictEqual(privateKey.asymmetricKeyType, 'dsa');
404404
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {
405-
modulusLength: 512,
405+
modulusLength: common.hasOpenSSL3 ? 2048 : 512,
406406
divisorLength: 256
407407
});
408408
}));

0 commit comments

Comments
 (0)