Skip to content

Commit

Permalink
test: update parallel/test-crypto-keygen for OpenSSL 3
Browse files Browse the repository at this point in the history
OpenSSL 3 returns a different error code.

PR-URL: #38136
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
  • Loading branch information
richardlau authored and jasnell committed Apr 7, 2021
1 parent 4bc8f75 commit f9b63b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/parallel/test-crypto-keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,8 @@ if (!common.hasOpenSSL3) {
if (!getCurves().includes(namedCurve))
continue;

const expectedErrorCode =
common.hasOpenSSL3 ? 'ERR_OSSL_MISSING_OID' : 'ERR_OSSL_EC_MISSING_OID';
const params = {
namedCurve,
publicKeyEncoding: {
Expand All @@ -1336,11 +1338,11 @@ if (!common.hasOpenSSL3) {
assert.throws(() => {
generateKeyPairSync('ec', params);
}, {
code: 'ERR_OSSL_EC_MISSING_OID'
code: expectedErrorCode
});

generateKeyPair('ec', params, common.mustCall((err) => {
assert.strictEqual(err.code, 'ERR_OSSL_EC_MISSING_OID');
assert.strictEqual(err.code, expectedErrorCode);
}));
}
}
Expand Down

0 comments on commit f9b63b8

Please sign in to comment.