GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: adjust check to use OpenSSL sec level · nodejs/node@b6d3d52

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-tls-client-mindhsize.js
Expand file treeCollapse file tree
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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.