Skip to content

Commit 0e24eeb

Browse files
aduh95ruyadorno
authored andcommitted
test: remove hasOpenSSL3x utils
In favor of `hasOpenSSL`. PR-URL: #56164 Refs: https://github.com/nodejs/node/pull/56160/files#r1874118863 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]>
1 parent a88e4ce commit 0e24eeb

8 files changed

+9
-17
lines changed

test/common/index.js

-8
Original file line numberDiff line numberDiff line change
@@ -1051,14 +1051,6 @@ const common = {
10511051
return hasOpenSSL(3);
10521052
},
10531053

1054-
get hasOpenSSL31() {
1055-
return hasOpenSSL(3, 1);
1056-
},
1057-
1058-
get hasOpenSSL32() {
1059-
return hasOpenSSL(3, 2);
1060-
},
1061-
10621054
get inFreeBSDJail() {
10631055
if (inFreeBSDJail !== null) return inFreeBSDJail;
10641056

test/parallel/test-https-agent-session-eviction.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function faultyServer(port) {
5656
function second(server, session) {
5757
const req = https.request({
5858
port: server.address().port,
59-
ciphers: (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT'),
59+
ciphers: (common.hasOpenSSL(3, 1) ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT'),
6060
rejectUnauthorized: false
6161
}, function(res) {
6262
res.resume();

test/parallel/test-tls-alert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const server = tls.Server({
4242
cert: loadPEM('agent2-cert')
4343
}, null).listen(0, common.mustCall(() => {
4444
const args = ['s_client', '-quiet', '-tls1_1',
45-
'-cipher', (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT'),
45+
'-cipher', (common.hasOpenSSL(3, 1) ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT'),
4646
'-connect', `127.0.0.1:${server.address().port}`];
4747

4848
execFile(common.opensslCli, args, common.mustCall((err, _, stderr) => {

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

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

2828
c.on('error', common.mustCall((err) => {
29-
const expectedErr = common.hasOpenSSL32 ?
29+
const expectedErr = common.hasOpenSSL(3, 2) ?
3030
'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE' : 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE';
3131
assert.strictEqual(err.code, expectedErr);
3232
}));

test/parallel/test-tls-getprotocol.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ const clientConfigs = [
1414
{
1515
secureProtocol: 'TLSv1_method',
1616
version: 'TLSv1',
17-
ciphers: (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT')
17+
ciphers: (common.hasOpenSSL(3, 1) ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT')
1818
}, {
1919
secureProtocol: 'TLSv1_1_method',
2020
version: 'TLSv1.1',
21-
ciphers: (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT')
21+
ciphers: (common.hasOpenSSL(3, 1) ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT')
2222
}, {
2323
secureProtocol: 'TLSv1_2_method',
2424
version: 'TLSv1.2'

test/parallel/test-tls-min-max-version.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function test(cmin, cmax, cprot, smin, smax, sprot, proto, cerr, serr) {
2222
if (serr !== 'ERR_SSL_UNSUPPORTED_PROTOCOL')
2323
ciphers = 'ALL@SECLEVEL=0';
2424
}
25-
if (common.hasOpenSSL31 && cerr === 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION') {
25+
if (common.hasOpenSSL(3, 1) && cerr === 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION') {
2626
ciphers = 'DEFAULT@SECLEVEL=0';
2727
}
2828
// Report where test was called from. Strip leading garbage from

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,11 +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-
const expectedHandshakeErr = common.hasOpenSSL32 ?
65+
const expectedHandshakeErr = common.hasOpenSSL(3, 2) ?
6666
'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE' : 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE';
6767
test({ psk: USERS.UserB, identity: 'UserC' }, {}, expectedHandshakeErr);
6868
// Recognized user but incorrect secret should fail handshake
69-
const expectedIllegalParameterErr = common.hasOpenSSL32 ?
69+
const expectedIllegalParameterErr = common.hasOpenSSL(3, 2) ?
7070
'ERR_SSL_SSL/TLS_ALERT_ILLEGAL_PARAMETER' : 'ERR_SSL_SSLV3_ALERT_ILLEGAL_PARAMETER';
7171
test({ psk: USERS.UserA, identity: 'UserB' }, {}, expectedIllegalParameterErr);
7272
test({ psk: USERS.UserB, identity: 'UserB' });

test/parallel/test-tls-session-cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function doTest(testOptions, callback) {
100100
const args = [
101101
's_client',
102102
'-tls1',
103-
'-cipher', (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT'),
103+
'-cipher', (common.hasOpenSSL(3, 1) ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT'),
104104
'-connect', `localhost:${this.address().port}`,
105105
'-servername', 'ohgod',
106106
'-key', fixtures.path('keys/rsa_private.pem'),

0 commit comments

Comments
 (0)