test: use an always invalid cipher and cover OpenSSL 4.0 behaviours

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62805
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Filip Skokan authored and Antoine du Hamel committed 2026-05-07 15:41:42 +02:00
1 parent 036bc6f300
commit 698d8287d1
1 file changed
+18 -1
+18 -1
View File
@@ -7,12 +7,13 @@ if (!common.hasCrypto)
const assert = require('assert');
const tls = require('tls');
const fixtures = require('../common/fixtures');
const { hasOpenSSL } = require('../common/crypto');
{
const options = {
key: fixtures.readKey('agent2-key.pem'),
cert: fixtures.readKey('agent2-cert.pem'),
ciphers: 'aes256-sha'
ciphers: 'DES-CBC-SHA'
};
assert.throws(() => tls.createServer(options, common.mustNotCall()),
/no[_ ]cipher[_ ]match/i);
@@ -23,3 +24,19 @@ const fixtures = require('../common/fixtures');
assert.throws(() => tls.createServer(options, common.mustNotCall()),
/no[_ ]cipher[_ ]match/i);
}
// Cipher name matching is case-sensitive prior to OpenSSL 4.0, and
// case-insensitive starting with OpenSSL 4.0.
{
const options = {
key: fixtures.readKey('agent2-key.pem'),
cert: fixtures.readKey('agent2-cert.pem'),
ciphers: 'aes256-sha',
};
if (hasOpenSSL(4, 0)) {
tls.createServer(options).close();
} else {
assert.throws(() => tls.createServer(options, common.mustNotCall()),
/no[_ ]cipher[_ ]match/i);
}
}