Skip to content

Commit c6ac626

Browse files
mhdawsonaduh95
authored andcommitted
test: adjust tls-set-ciphers for OpenSSL32
Refs: nodejs#53382 The test failed as it was using AES128 which is not supported in OpenSSL32 due to default security level and because some error messages have changed. Adjusted to use AES256 where it made sense and not run tests on OpenSSL32 where test was specific to AES128. Adjust to use the expected error messages based on version. Signed-off-by: Michael Dawson <[email protected]> PR-URL: nodejs#55016 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a0b1e48 commit c6ac626

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

test/parallel/test-tls-set-ciphers.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ function test(cciphers, sciphers, cipher, cerr, serr, options) {
7979

8080
const U = undefined;
8181

82+
let expectedTLSAlertError = 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE';
83+
if (common.hasOpenSSL(3, 2)) {
84+
expectedTLSAlertError = 'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE';
85+
}
86+
8287
// Have shared ciphers.
8388
test(U, 'AES256-SHA', 'AES256-SHA');
8489
test('AES256-SHA', U, 'AES256-SHA');
@@ -88,13 +93,13 @@ test('TLS_AES_256_GCM_SHA384', U, 'TLS_AES_256_GCM_SHA384');
8893

8994
// Do not have shared ciphers.
9095
test('TLS_AES_256_GCM_SHA384', 'TLS_CHACHA20_POLY1305_SHA256',
91-
U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', 'ERR_SSL_NO_SHARED_CIPHER');
96+
U, expectedTLSAlertError, 'ERR_SSL_NO_SHARED_CIPHER');
9297

93-
test('AES128-SHA', 'AES256-SHA', U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE',
98+
test('AES256-SHA', 'AES256-SHA256', U, expectedTLSAlertError,
9499
'ERR_SSL_NO_SHARED_CIPHER');
95-
test('AES128-SHA:TLS_AES_256_GCM_SHA384',
96-
'TLS_CHACHA20_POLY1305_SHA256:AES256-SHA',
97-
U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', 'ERR_SSL_NO_SHARED_CIPHER');
100+
test('AES256-SHA:TLS_AES_256_GCM_SHA384',
101+
'TLS_CHACHA20_POLY1305_SHA256:AES256-SHA256',
102+
U, expectedTLSAlertError, 'ERR_SSL_NO_SHARED_CIPHER');
98103

99104
// Cipher order ignored, TLS1.3 chosen before TLS1.2.
100105
test('AES256-SHA:TLS_AES_256_GCM_SHA384', U, 'TLS_AES_256_GCM_SHA384');
@@ -109,11 +114,15 @@ test(U, 'AES256-SHA', 'TLS_AES_256_GCM_SHA384', U, U, { maxVersion: 'TLSv1.3' })
109114

110115
// TLS_AES_128_CCM_8_SHA256 & TLS_AES_128_CCM_SHA256 are not enabled by
111116
// default, but work.
112-
test('TLS_AES_128_CCM_8_SHA256', U,
113-
U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', 'ERR_SSL_NO_SHARED_CIPHER');
114-
115-
test('TLS_AES_128_CCM_8_SHA256', 'TLS_AES_128_CCM_8_SHA256',
116-
'TLS_AES_128_CCM_8_SHA256');
117+
// However, for OpenSSL32 AES_128 is not enabled due to the
118+
// default security level
119+
if (!common.hasOpenSSL(3, 2)) {
120+
test('TLS_AES_128_CCM_8_SHA256', U,
121+
U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', 'ERR_SSL_NO_SHARED_CIPHER');
122+
123+
test('TLS_AES_128_CCM_8_SHA256', 'TLS_AES_128_CCM_8_SHA256',
124+
'TLS_AES_128_CCM_8_SHA256');
125+
}
117126

118127
// Invalid cipher values
119128
test(9, 'AES256-SHA', U, 'ERR_INVALID_ARG_TYPE', U);

0 commit comments

Comments
 (0)