Skip to content

Commit 7349edb

Browse files
richardlautargos
authored andcommitted
test: update TLS tests for OpenSSL 3.2
Update the following TLS tests to account for error code changes in OpenSSL 3.2 and later. - `parallel/test-tls-empty-sni-context` - `parallel/test-tls-psk-circuit` PR-URL: #53384 Refs: #53382 Refs: openssl/openssl#19950 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
1 parent 0b9191d commit 7349edb

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

test/common/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const hasOpenSSL3 = hasCrypto &&
6363
const hasOpenSSL31 = hasCrypto &&
6464
require('crypto').constants.OPENSSL_VERSION_NUMBER >= 0x30100000;
6565

66+
const hasOpenSSL32 = hasCrypto &&
67+
require('crypto').constants.OPENSSL_VERSION_NUMBER >= 0x30200000;
68+
6669
const hasQuic = hasCrypto && !!process.config.variables.openssl_quic;
6770

6871
function parseTestFlags(filename = process.argv[1]) {
@@ -968,6 +971,7 @@ const common = {
968971
hasCrypto,
969972
hasOpenSSL3,
970973
hasOpenSSL31,
974+
hasOpenSSL32,
971975
hasQuic,
972976
hasMultiLocalhost,
973977
invalidArgTypeHelper,

test/parallel/test-tls-empty-sni-context.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const server = tls.createServer(options, (c) => {
2626
}, common.mustNotCall());
2727

2828
c.on('error', common.mustCall((err) => {
29-
assert.strictEqual(err.code, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE');
29+
const expectedErr = common.hasOpenSSL32 ?
30+
'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE' : 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE';
31+
assert.strictEqual(err.code, expectedErr);
3032
}));
3133
}));

test/parallel/test-tls-psk-circuit.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ test({ psk: USERS.UserA, identity: 'UserA' }, { minVersion: 'TLSv1.3' });
6262
test({ psk: USERS.UserB, identity: 'UserB' });
6363
test({ psk: USERS.UserB, identity: 'UserB' }, { minVersion: 'TLSv1.3' });
6464
// Unrecognized user should fail handshake
65-
test({ psk: USERS.UserB, identity: 'UserC' }, {},
66-
'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE');
65+
const expectedHandshakeErr = common.hasOpenSSL32 ?
66+
'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE' : 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE';
67+
test({ psk: USERS.UserB, identity: 'UserC' }, {}, expectedHandshakeErr);
6768
// Recognized user but incorrect secret should fail handshake
68-
test({ psk: USERS.UserA, identity: 'UserB' }, {},
69-
'ERR_SSL_SSLV3_ALERT_ILLEGAL_PARAMETER');
69+
const expectedIllegalParameterErr = common.hasOpenSSL32 ?
70+
'ERR_SSL_SSL/TLS_ALERT_ILLEGAL_PARAMETER' : 'ERR_SSL_SSLV3_ALERT_ILLEGAL_PARAMETER';
71+
test({ psk: USERS.UserA, identity: 'UserB' }, {}, expectedIllegalParameterErr);
7072
test({ psk: USERS.UserB, identity: 'UserB' });

0 commit comments

Comments
 (0)