Skip to content

Commit 6d42e44

Browse files
mhdawsontargos
authored andcommittedOct 4, 2024
test: adjust tls-set-ciphers for OpenSSL32
Refs: #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 <midawson@redhat.com> PR-URL: #55016 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b62f2f8 commit 6d42e44

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed
 

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

+19-10
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');
@@ -89,13 +94,13 @@ test('TLS_AES_256_GCM_SHA384:!TLS_CHACHA20_POLY1305_SHA256', U, 'TLS_AES_256_GCM
8994

9095
// Do not have shared ciphers.
9196
test('TLS_AES_256_GCM_SHA384', 'TLS_CHACHA20_POLY1305_SHA256',
92-
U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', 'ERR_SSL_NO_SHARED_CIPHER');
97+
U, expectedTLSAlertError, 'ERR_SSL_NO_SHARED_CIPHER');
9398

94-
test('AES128-SHA', 'AES256-SHA', U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE',
99+
test('AES256-SHA', 'AES256-SHA256', U, expectedTLSAlertError,
95100
'ERR_SSL_NO_SHARED_CIPHER');
96-
test('AES128-SHA:TLS_AES_256_GCM_SHA384',
97-
'TLS_CHACHA20_POLY1305_SHA256:AES256-SHA',
98-
U, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', 'ERR_SSL_NO_SHARED_CIPHER');
101+
test('AES256-SHA:TLS_AES_256_GCM_SHA384',
102+
'TLS_CHACHA20_POLY1305_SHA256:AES256-SHA256',
103+
U, expectedTLSAlertError, 'ERR_SSL_NO_SHARED_CIPHER');
99104

100105
// Cipher order ignored, TLS1.3 chosen before TLS1.2.
101106
test('AES256-SHA:TLS_AES_256_GCM_SHA384', U, 'TLS_AES_256_GCM_SHA384');
@@ -110,11 +115,15 @@ test(U, 'AES256-SHA', 'TLS_AES_256_GCM_SHA384', U, U, { maxVersion: 'TLSv1.3' })
110115

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.