Files
node/test/parallel/test-crypto-sec-level.js
T
Filip Skokan b0d56c7328 test,benchmark: use OpenSSL feature helpers
Add isBoringSSL to the test crypto helpers and use it in tests and
benchmarks. Replace hasOpenSSL3 call sites with hasOpenSSL(3).

Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65762
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-09-05 13:31:22 +00:00

25 lines
873 B
JavaScript

// Flags: --expose-internals
'use strict';
const common = require('../common');
const { isBoringSSL } = require('../common/crypto');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
// OpenSSL has a set of security levels which affect what algorithms
// are available by default. Different OpenSSL versions have different
// default security levels and we use this value to adjust what a test
// expects based on the security level. You can read more in
// https://docs.openssl.org/1.1.1/man3/SSL_CTX_set_security_level/#default-callback-behaviour
// This test simply validates that we can get some value for the secLevel
// when needed by tests.
const secLevel = require('internal/crypto/util').getOpenSSLSecLevel();
if (isBoringSSL) {
assert.strictEqual(secLevel, 0);
} else {
assert.ok(secLevel >= 0 && secLevel <= 5);
}