From 49a1a797a8f483a0b081204fcfac634689eab6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 26 Jan 2021 16:26:56 +0100 Subject: [PATCH] fixup! src: fix error handling for CryptoJob::ToResult --- test/parallel/test-crypto-keygen.js | 38 +++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index 51a4e22a0e9126..500f44357676f6 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -1289,26 +1289,28 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); // This test creates EC key pairs on curves without associated OIDs. // Specifying a key encoding should not crash. - const hasCurve = (c) => getCurves().includes(c); - const curvesWithoutOid = ['Oakley-EC2N-3', 'Oakley-EC2N-4'].filter(hasCurve); + if (process.versions.openssl >= '1.1.1i') { + const hasCurve = (c) => getCurves().includes(c); + const curvesWithoutOid = ['Oakley-EC2N-3', 'Oakley-EC2N-4'].filter(hasCurve); - for (const namedCurve of curvesWithoutOid) { - const params = { - namedCurve, - publicKeyEncoding: { - format: 'der', - type: 'spki' - } - }; + for (const namedCurve of curvesWithoutOid) { + const params = { + namedCurve, + publicKeyEncoding: { + format: 'der', + type: 'spki' + } + }; - assert.throws(() => { - generateKeyPairSync('ec', params); - }, { - code: 'ERR_OSSL_EC_MISSING_OID' - }); + assert.throws(() => { + generateKeyPairSync('ec', params); + }, { + code: 'ERR_OSSL_EC_MISSING_OID' + }); - generateKeyPair('ec', params, common.mustCall((err) => { - assert.strictEqual(err.code, 'ERR_OSSL_EC_MISSING_OID'); - })); + generateKeyPair('ec', params, common.mustCall((err) => { + assert.strictEqual(err.code, 'ERR_OSSL_EC_MISSING_OID'); + })); + } } }