mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
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>
25 lines
873 B
JavaScript
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);
|
|
}
|