test: simplify loadDHParam in TLS test
PR-URL: https://github.com/nodejs/node/pull/18103 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
4e2e7d11e1
commit
eb68a06a3e
@ -6,7 +6,6 @@ const fixtures = require('../common/fixtures');
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const key = fixtures.readKey('agent2-key.pem');
|
const key = fixtures.readKey('agent2-key.pem');
|
||||||
const cert = fixtures.readKey('agent2-cert.pem');
|
const cert = fixtures.readKey('agent2-cert.pem');
|
||||||
@ -15,9 +14,7 @@ let ntests = 0;
|
|||||||
let nsuccess = 0;
|
let nsuccess = 0;
|
||||||
|
|
||||||
function loadDHParam(n) {
|
function loadDHParam(n) {
|
||||||
let path = fixtures.fixturesDir;
|
return fixtures.readKey(`dh${n}.pem`);
|
||||||
if (n !== 'error') path += '/keys';
|
|
||||||
return fs.readFileSync(`${path}/dh${n}.pem`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipherlist = {
|
const cipherlist = {
|
||||||
|
@ -14,10 +14,7 @@ let nsuccess = 0;
|
|||||||
let nerror = 0;
|
let nerror = 0;
|
||||||
|
|
||||||
function loadDHParam(n) {
|
function loadDHParam(n) {
|
||||||
const params = [`dh${n}.pem`];
|
return fixtures.readKey(`dh${n}.pem`);
|
||||||
if (n !== 'error')
|
|
||||||
params.unshift('keys');
|
|
||||||
return fixtures.readSync(params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test(size, err, next) {
|
function test(size, err, next) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user