diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index d6e9fee643e7bb..963fe2ab11927a 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -266,7 +266,7 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', { // TODO(joyeecheung): this property has not been well-maintained, should we // deprecate it in favor of a better API? -const { isDebugBuild, hasOpenSSL, hasInspector } = config; +const { isDebugBuild, hasOpenSSL, openSSLIsBoringSSL, hasInspector } = config; const features = { inspector: hasInspector, debug: isDebugBuild, @@ -276,6 +276,7 @@ const features = { tls_sni: hasOpenSSL, tls_ocsp: hasOpenSSL, tls: hasOpenSSL, + openssl_is_boringssl: openSSLIsBoringSSL, // This needs to be dynamic because --no-node-snapshot disables the // code cache even if the binary is built with embedded code cache. get cached_builtins() { diff --git a/src/node_config.cc b/src/node_config.cc index f6ca010ff9304f..ea97eb2740cf74 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -48,6 +48,12 @@ static void InitConfig(Local target, READONLY_FALSE_PROPERTY(target, "isDebugBuild"); #endif // defined(DEBUG) && DEBUG +#ifdef OPENSSL_IS_BORINGSSL + READONLY_TRUE_PROPERTY(target, "openSSLIsBoringSSL"); +#else + READONLY_FALSE_PROPERTY(target, "openSSLIsBoringSSL"); +#endif // OPENSSL_IS_BORINGSSL + #if HAVE_OPENSSL READONLY_TRUE_PROPERTY(target, "hasOpenSSL"); #else diff --git a/test/parallel/test-crypto-getcipherinfo.js b/test/parallel/test-crypto-getcipherinfo.js index 64b79fc36ccf4d..b0902908b5c454 100644 --- a/test/parallel/test-crypto-getcipherinfo.js +++ b/test/parallel/test-crypto-getcipherinfo.js @@ -62,9 +62,13 @@ assert(getCipherInfo('aes-128-cbc', { ivLength: 16 })); assert(!getCipherInfo('aes-128-ccm', { ivLength: 1 })); assert(!getCipherInfo('aes-128-ccm', { ivLength: 14 })); -for (let n = 7; n <= 13; n++) - assert(getCipherInfo('aes-128-ccm', { ivLength: n })); +if (!process.features.openssl_is_boringssl) { + for (let n = 7; n <= 13; n++) + assert(getCipherInfo('aes-128-ccm', { ivLength: n })); +} assert(!getCipherInfo('aes-128-ocb', { ivLength: 16 })); -for (let n = 1; n < 16; n++) - assert(getCipherInfo('aes-128-ocb', { ivLength: n })); +if (!process.features.openssl_is_boringssl) { + for (let n = 1; n < 16; n++) + assert(getCipherInfo('aes-128-ocb', { ivLength: n })); +} diff --git a/test/parallel/test-crypto-hkdf.js b/test/parallel/test-crypto-hkdf.js index 3f7e61e9b2ebc0..360ed52370fbe1 100644 --- a/test/parallel/test-crypto-hkdf.js +++ b/test/parallel/test-crypto-hkdf.js @@ -125,7 +125,7 @@ const algorithms = [ ['sha256', '', 'salt', '', 10], ['sha512', 'secret', 'salt', '', 15], ]; -if (!hasOpenSSL3) +if (!hasOpenSSL3 && !process.features.openssl_is_boringssl) algorithms.push(['whirlpool', 'secret', '', 'info', 20]); algorithms.forEach(([ hash, secret, salt, info, length ]) => { diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js index b1eab88fd6517e..c28b329ba7b642 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.js @@ -29,11 +29,14 @@ const clientConfigs = [ const serverConfig = { secureProtocol: 'TLS_method', - ciphers: 'RSA@SECLEVEL=0', key: fixtures.readKey('agent2-key.pem'), cert: fixtures.readKey('agent2-cert.pem') }; +if (!process.features.openssl_is_boringssl) { + serverConfig.ciphers = 'RSA@SECLEVEL=0'; +} + const server = tls.createServer(serverConfig, common.mustCall(clientConfigs.length)) .listen(0, common.localhostIPv4, function() { let connected = 0; diff --git a/test/parallel/test-tls-write-error.js b/test/parallel/test-tls-write-error.js index b06f2fa2c53ea7..8a8d820a09cca9 100644 --- a/test/parallel/test-tls-write-error.js +++ b/test/parallel/test-tls-write-error.js @@ -17,9 +17,12 @@ const server_cert = fixtures.readKey('agent1-cert.pem'); const opts = { key: server_key, cert: server_cert, - ciphers: 'ALL@SECLEVEL=0' }; +if (!process.features.openssl_is_boringssl) { + opts.ciphers = 'ALL@SECLEVEL=0'; +} + const server = https.createServer(opts, (req, res) => { res.write('hello'); }).listen(0, common.mustCall(() => {