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

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎test/common/index.js‎

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

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

6871
functionparseTestFlags(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‎

Lines changed: 3 additions & 1 deletion
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+
constexpectedErr=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‎

Lines changed: 6 additions & 4 deletions
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+
constexpectedHandshakeErr=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+
constexpectedIllegalParameterErr=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)