Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b6d3d52

Browse filesBrowse files
mhdawsontargos
authored andcommitted
test: adjust check to use OpenSSL sec level
Some checks should use the sec level instead of the OpenSSL version, adjust test-tls-client-mindhsize.js Signed-off-by: Michael Dawson <midawson@redhat.com> PR-URL: #56819 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 974cec7 commit b6d3d52
Copy full SHA for b6d3d52

File tree

Expand file treeCollapse file tree

1 file changed

+12
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-5
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-tls-client-mindhsize.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-client-mindhsize.js
+12-5Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
// Flags: --expose-internals
12
'use strict';
23
const common = require('../common');
34
if (!common.hasCrypto)
45
common.skip('missing crypto');
56

6-
const { hasOpenSSL } = require('../common/crypto');
7+
// OpenSSL has a set of security levels which affect what algorithms
8+
// are available by default. Different OpenSSL veresions have different
9+
// default security levels and we use this value to adjust what a test
10+
// expects based on the security level. You can read more in
11+
// https://docs.openssl.org/1.1.1/man3/SSL_CTX_set_security_level/#default-callback-behaviour
12+
const secLevel = require('internal/crypto/util').getOpenSSLSecLevel();
713
const assert = require('assert');
814
const tls = require('tls');
915
const fixtures = require('../common/fixtures');
@@ -38,8 +44,9 @@ function test(size, err, next) {
3844
server.listen(0, function() {
3945
// Client set minimum DH parameter size to 2048 or 3072 bits
4046
// so that it fails when it makes a connection to the tls
41-
// server where is too small
42-
const minDHSize = hasOpenSSL(3, 2) ? 3072 : 2048;
47+
// server where is too small. This depends on the openssl
48+
// security level
49+
const minDHSize = (secLevel > 1) ? 3072 : 2048;
4350
const client = tls.connect({
4451
minDHSize: minDHSize,
4552
port: this.address().port,
@@ -77,8 +84,8 @@ function testDHE3072() {
7784
test(3072, false, null);
7885
}
7986

80-
if (hasOpenSSL(3, 2)) {
81-
// Minimum size for OpenSSL 3.2 is 2048 by default
87+
if (secLevel > 1) {
88+
// Minimum size for OpenSSL security level 2 and above is 2048 by default
8289
testDHE2048(true, testDHE3072);
8390
} else {
8491
testDHE1024();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.