| 75 | } |
| 76 | |
| 77 | function test(dhparam, keylen, expectedCipher) { |
| 78 | const options = { |
| 79 | key, |
| 80 | cert, |
| 81 | ciphers, |
| 82 | dhparam, |
| 83 | maxVersion: 'TLSv1.2', |
| 84 | }; |
| 85 | |
| 86 | const server = tls.createServer(options, (conn) => conn.end()); |
| 87 | |
| 88 | server.listen(0, '127.0.0.1', common.mustCall(() => { |
| 89 | const args = ['s_client', '-connect', `127.0.0.1:${server.address().port}`, |
| 90 | '-cipher', `${ciphers}:@SECLEVEL=1`]; |
| 91 | |
| 92 | execFile(opensslCli, args, common.mustSucceed((stdout) => { |
| 93 | assert(keylen === null || |
| 94 | // s_client < OpenSSL 3.5 |
| 95 | stdout.includes(`Server Temp Key: DH, ${keylen} bits`) || |
| 96 | // s_client >= OpenSSL 3.5 |
| 97 | stdout.includes(`Peer Temp Key: DH, ${keylen} bits`)); |
| 98 | assert(stdout.includes(`Cipher : ${expectedCipher}`)); |
| 99 | server.close(); |
| 100 | })); |
| 101 | })); |
| 102 | |
| 103 | return once(server, 'close'); |
| 104 | } |
| 105 | |
| 106 | function testCustomParam(keylen, expectedCipher) { |
| 107 | const dhparam = loadDHParam(keylen); |