Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c10f19b

Browse files
committedMay 10, 2023
test: adapt tests for OpenSSL 3.1
1 parent 9e5e2f1 commit c10f19b

6 files changed

+24
-4
lines changed
 

‎test/common/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ const hasCrypto = Boolean(process.versions.openssl) &&
5757
!process.env.NODE_SKIP_CRYPTO;
5858

5959
const hasOpenSSL3 = hasCrypto &&
60-
require('crypto').constants.OPENSSL_VERSION_NUMBER >= 805306368;
60+
require('crypto').constants.OPENSSL_VERSION_NUMBER >= 0x30000000;
61+
62+
const hasOpenSSL31 = hasCrypto &&
63+
require('crypto').constants.OPENSSL_VERSION_NUMBER >= 0x30100000;
6164

6265
const hasQuic = hasCrypto && !!process.config.variables.openssl_quic;
6366

@@ -913,6 +916,7 @@ const common = {
913916
hasIntl,
914917
hasCrypto,
915918
hasOpenSSL3,
919+
hasOpenSSL31,
916920
hasQuic,
917921
hasMultiLocalhost,
918922
invalidArgTypeHelper,

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

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +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'),
5960
rejectUnauthorized: false
6061
}, function(res) {
6162
res.resume();

‎test/parallel/test-tls-alert.js

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +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'),
4546
'-connect', `127.0.0.1:${server.address().port}`];
4647

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

‎test/parallel/test-tls-getprotocol.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@ const tls = require('tls');
1111
const fixtures = require('../common/fixtures');
1212

1313
const clientConfigs = [
14-
{ secureProtocol: 'TLSv1_method', version: 'TLSv1' },
15-
{ secureProtocol: 'TLSv1_1_method', version: 'TLSv1.1' },
16-
{ secureProtocol: 'TLSv1_2_method', version: 'TLSv1.2' },
14+
{
15+
secureProtocol: 'TLSv1_method',
16+
version: 'TLSv1',
17+
ciphers: (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT')
18+
}, {
19+
secureProtocol: 'TLSv1_1_method',
20+
version: 'TLSv1.1',
21+
ciphers: (common.hasOpenSSL31 ? 'DEFAULT:@SECLEVEL=0' : 'DEFAULT')
22+
}, {
23+
secureProtocol: 'TLSv1_2_method',
24+
version: 'TLSv1.2'
25+
},
1726
];
1827

1928
const serverConfig = {
@@ -30,6 +39,7 @@ const server = tls.createServer(serverConfig, common.mustCall(clientConfigs.leng
3039
tls.connect({
3140
host: common.localhostIPv4,
3241
port: server.address().port,
42+
ciphers: v.ciphers,
3343
rejectUnauthorized: false,
3444
secureProtocol: v.secureProtocol
3545
}, common.mustCall(function() {

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

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ 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') {
26+
ciphers = 'DEFAULT@SECLEVEL=0';
27+
}
2528
// Report where test was called from. Strip leading garbage from
2629
// at Object.<anonymous> (file:line)
2730
// from the stack location, we only want the file:line part.

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.