mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 21:46:48 +00:00

Since `common/crypto` already exists, it makes sense to keep crypto-related utilities there. The only exception being common.hasCrypto which is needed up front to determine if tests should be skipped. Eliminate the redundant check in hasFipsCrypto and just use crypto.getFips() directly where needed. PR-URL: https://github.com/nodejs/node/pull/56714 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
35 lines
831 B
JavaScript
35 lines
831 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
}
|
|
|
|
const { hasOpenSSL } = require('../common/crypto');
|
|
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(function(s) {
|
|
s.once('data', function() {
|
|
s.end('I was waiting for you, hello!', function() {
|
|
s.destroy();
|
|
});
|
|
});
|
|
});
|
|
|
|
server.listen(0, function() {
|
|
const req = https.request({ port: this.address().port });
|
|
req.end();
|
|
|
|
let expectedErrorMessage = new RegExp('wrong version number');
|
|
if (hasOpenSSL(3, 2)) {
|
|
expectedErrorMessage = new RegExp('packet length too long');
|
|
};
|
|
req.once('error', common.mustCall(function(err) {
|
|
assert(expectedErrorMessage.test(err.message));
|
|
server.close();
|
|
}));
|
|
});
|