GeezerVison is showing github.com — crypto: expose crypto.constants.OPENSSL_IS_BORINGSSL · nodejs/node@9fccb06
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/bootstrap/node.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -266,7 +266,7 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', { | 266 | 266 |
| 267 | 267 | // TODO(joyeecheung): this property has not been well-maintained, should we | 268 | 268 | // deprecate it in favor of a better API? | 269 | | -const { isDebugBuild, hasOpenSSL, hasInspector } = config; | | 269 | +const { isDebugBuild, hasOpenSSL, openSSLIsBoringSSL, hasInspector } = config; | 270 | 270 | const features = { | 271 | 271 | inspector: hasInspector, | 272 | 272 | debug: isDebugBuild, | @@ -276,6 +276,7 @@ const features = { | 276 | 276 | tls_sni: hasOpenSSL, | 277 | 277 | tls_ocsp: hasOpenSSL, | 278 | 278 | tls: hasOpenSSL, | | 279 | + openssl_is_boringssl: openSSLIsBoringSSL, | 279 | 280 | // This needs to be dynamic because --no-node-snapshot disables the | 280 | 281 | // code cache even if the binary is built with embedded code cache. | 281 | 282 | get cached_builtins() { | |
Collapse file Copy file name to clipboardExpand all lines: src/node_config.cc +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,6 +48,12 @@ static void InitConfig(Local<Object> target, | 48 | 48 | READONLY_FALSE_PROPERTY(target, "isDebugBuild"); | 49 | 49 | #endif // defined(DEBUG) && DEBUG | 50 | 50 |
| | 51 | +#ifdef OPENSSL_IS_BORINGSSL | | 52 | + READONLY_TRUE_PROPERTY(target, "openSSLIsBoringSSL"); | | 53 | +#else | | 54 | + READONLY_FALSE_PROPERTY(target, "openSSLIsBoringSSL"); | | 55 | +#endif // OPENSSL_IS_BORINGSSL | | 56 | + | 51 | 57 | #if HAVE_OPENSSL | 52 | 58 | READONLY_TRUE_PROPERTY(target, "hasOpenSSL"); | 53 | 59 | #else | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-crypto-getcipherinfo.js +8-4Lines changed: 8 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,9 +62,13 @@ assert(getCipherInfo('aes-128-cbc', { ivLength: 16 })); | 62 | 62 |
| 63 | 63 | assert(!getCipherInfo('aes-128-ccm', { ivLength: 1 })); | 64 | 64 | assert(!getCipherInfo('aes-128-ccm', { ivLength: 14 })); | 65 | | -for (let n = 7; n <= 13; n++) | 66 | | - assert(getCipherInfo('aes-128-ccm', { ivLength: n })); | | 65 | +if (!process.features.openssl_is_boringssl) { | | 66 | + for (let n = 7; n <= 13; n++) | | 67 | + assert(getCipherInfo('aes-128-ccm', { ivLength: n })); | | 68 | +} | 67 | 69 |
| 68 | 70 | assert(!getCipherInfo('aes-128-ocb', { ivLength: 16 })); | 69 | | -for (let n = 1; n < 16; n++) | 70 | | - assert(getCipherInfo('aes-128-ocb', { ivLength: n })); | | 71 | +if (!process.features.openssl_is_boringssl) { | | 72 | + for (let n = 1; n < 16; n++) | | 73 | + assert(getCipherInfo('aes-128-ocb', { ivLength: n })); | | 74 | +} |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-crypto-hkdf.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -125,7 +125,7 @@ const algorithms = [ | 125 | 125 | ['sha256', '', 'salt', '', 10], | 126 | 126 | ['sha512', 'secret', 'salt', '', 15], | 127 | 127 | ]; | 128 | | -if (!hasOpenSSL3) | | 128 | +if (!hasOpenSSL3 && !process.features.openssl_is_boringssl) | 129 | 129 | algorithms.push(['whirlpool', 'secret', '', 'info', 20]); | 130 | 130 |
| 131 | 131 | algorithms.forEach(([ hash, secret, salt, info, length ]) => { | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-process-features.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,6 +9,7 @@ const expectedKeys = new Map([ | 9 | 9 | ['debug', ['boolean']], | 10 | 10 | ['uv', ['boolean']], | 11 | 11 | ['ipv6', ['boolean']], | | 12 | + ['openssl_is_boringssl', ['boolean']], | 12 | 13 | ['tls_alpn', ['boolean']], | 13 | 14 | ['tls_sni', ['boolean']], | 14 | 15 | ['tls_ocsp', ['boolean']], | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-tls-getprotocol.js +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,11 +29,14 @@ const clientConfigs = [ | 29 | 29 |
| 30 | 30 | const serverConfig = { | 31 | 31 | secureProtocol: 'TLS_method', | 32 | | - ciphers: 'RSA@SECLEVEL=0', | 33 | 32 | key: fixtures.readKey('agent2-key.pem'), | 34 | 33 | cert: fixtures.readKey('agent2-cert.pem') | 35 | 34 | }; | 36 | 35 |
| | 36 | +if (!process.features.openssl_is_boringssl) { | | 37 | + serverConfig.ciphers = 'RSA@SECLEVEL=0'; | | 38 | +} | | 39 | + | 37 | 40 | const server = tls.createServer(serverConfig, common.mustCall(clientConfigs.length)) | 38 | 41 | .listen(0, common.localhostIPv4, function() { | 39 | 42 | let connected = 0; | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-tls-write-error.js +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,9 +17,12 @@ const server_cert = fixtures.readKey('agent1-cert.pem'); | 17 | 17 | const opts = { | 18 | 18 | key: server_key, | 19 | 19 | cert: server_cert, | 20 | | - ciphers: 'ALL@SECLEVEL=0' | 21 | 20 | }; | 22 | 21 |
| | 22 | +if (!process.features.openssl_is_boringssl) { | | 23 | + opts.ciphers = 'ALL@SECLEVEL=0'; | | 24 | +} | | 25 | + | 23 | 26 | const server = https.createServer(opts, (req, res) => { | 24 | 27 | res.write('hello'); | 25 | 28 | }).listen(0, common.mustCall(() => { | |
|