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: fix test-tls-client-mindhsize for OpenSSL32 · nodejs/node@68156cb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test
    • fixtures/keys
      • Makefile
      • dh3072.pem
    • parallel
      • test-tls-client-mindhsize.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/fixtures/keys/Makefile‎

Copy file name to clipboardExpand all lines: test/fixtures/keys/Makefile
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ all: \
2424
dh512.pem \
2525
dh1024.pem \
2626
dh2048.pem \
27+
dh3072.pem \
2728
dherror.pem \
2829
dsa_params.pem \
2930
dsa_private.pem \
@@ -594,6 +595,9 @@ dh1024.pem:
594595
dh2048.pem:
595596
openssl dhparam -out dh2048.pem 2048
596597

598+
dh3072.pem:
599+
openssl dhparam -out dh3072.pem 3072
600+
597601
dherror.pem: dh1024.pem
598602
sed 's/^[^-].*/AAAAAAAAAA/g' dh1024.pem > dherror.pem
599603

Collapse file

‎test/fixtures/keys/dh3072.pem‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN DH PARAMETERS-----
2+
MIIBiAKCAYEAmV6aZ8ADnmRQoF9aGlV1AmajCkoc2eEltua1KpGFrxM0cr99gcS9
3+
/zxTDo8ixwPoHBOOBD+9MN6KbSJ+61xvu9yQ2qt8HfNcUI7QZxdVQ4ZHCQM3Jw8h
4+
BPHFgjpx8w/pteZ3+L42felUxbd8/qfDv+gKsfuxrm6Ht7zzKLfbX9oNdJwpxX7N
5+
yGP3nNadYDM/ZmvmEY8xh2dwLHSMaAP1gxuWiitdYXX60Yg6EFgIotznqbdW075D
6+
KccGTTseFx9gNbxYkW33qX/p5IAf3wRFmptiRWCol88NHTDqtQRs0nhVQ1R28tiL
7+
rQhSJLHLSa4esF+whfC64oXECr2AtarcKWG+LX1dEWI4SXqurnBPiBoyqfVWHS4b
8+
PVgR90LlBJoXqblhsVrd+CkJI7ULDJmSA/cpgCqXH6vSvhb40yr5rpU4vZz+zhHY
9+
CTXVpH95JD35PiZOfQYhfDA4LGvfICPLIH7E8YL5v2F6Xxsf8trI5KiAs1S3TN8b
10+
lsLV6og5VoPXAgEC
11+
-----END DH PARAMETERS-----
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-tls-client-mindhsize.js
+21-9Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ function test(size, err, next) {
3535
});
3636

3737
server.listen(0, function() {
38-
// Client set minimum DH parameter size to 2048 bits so that
39-
// it fails when it make a connection to the tls server where
40-
// dhparams is 1024 bits
38+
// Client set minimum DH parameter size to 2048 or 3072 bits
39+
// so that it fails when it makes a connection to the tls
40+
// server where is too small
41+
const minDHSize = common.hasOpenSSL(3, 2) ? 3072 : 2048;
4142
const client = tls.connect({
42-
minDHSize: 2048,
43+
minDHSize: minDHSize,
4344
port: this.address().port,
4445
rejectUnauthorized: false,
4546
maxVersion: 'TLSv1.2',
@@ -60,16 +61,27 @@ function test(size, err, next) {
6061
// A client connection fails with an error when a client has an
6162
// 2048 bits minDHSize option and a server has 1024 bits dhparam
6263
function testDHE1024() {
63-
test(1024, true, testDHE2048);
64+
test(1024, true, testDHE2048(false, null));
65+
}
66+
67+
// Test a client connection when a client has an
68+
// 2048 bits minDHSize option
69+
function testDHE2048(expect_to_fail, next) {
70+
test(2048, expect_to_fail, next);
6471
}
6572

6673
// A client connection successes when a client has an
67-
// 2048 bits minDHSize option and a server has 2048 bits dhparam
68-
function testDHE2048() {
69-
test(2048, false, null);
74+
// 3072 bits minDHSize option and a server has 3072 bits dhparam
75+
function testDHE3072() {
76+
test(3072, false, null);
7077
}
7178

72-
testDHE1024();
79+
if (common.hasOpenSSL(3, 2)) {
80+
// Minimum size for OpenSSL 3.2 is 2048 by default
81+
testDHE2048(true, testDHE3072);
82+
} else {
83+
testDHE1024();
84+
}
7385

7486
assert.throws(() => test(512, true, common.mustNotCall()),
7587
/DH parameter is less than 1024 bits/);

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.