crypto: expose crypto.constants.OPENSSL_IS_BORINGSSL · nodejs/node@9fccb06 · GitHub
Skip to content

Commit 9fccb06

Browse files
codebyteretargos
authored andcommitted
crypto: expose crypto.constants.OPENSSL_IS_BORINGSSL
PR-URL: #58387 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 3499285 commit 9fccb06

7 files changed

Lines changed: 26 additions & 8 deletions

File tree

lib/internal/bootstrap/node.js

Lines changed: 2 additions & 1 deletion

src/node_config.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ static void InitConfig(Local<Object> target,
4848
READONLY_FALSE_PROPERTY(target, "isDebugBuild");
4949
#endif // defined(DEBUG) && DEBUG
5050

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+
5157
#if HAVE_OPENSSL
5258
READONLY_TRUE_PROPERTY(target, "hasOpenSSL");
5359
#else

test/parallel/test-crypto-getcipherinfo.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@ assert(getCipherInfo('aes-128-cbc', { ivLength: 16 }));
6262

6363
assert(!getCipherInfo('aes-128-ccm', { ivLength: 1 }));
6464
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+
}
6769

6870
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+
}

test/parallel/test-crypto-hkdf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const algorithms = [
125125
['sha256', '', 'salt', '', 10],
126126
['sha512', 'secret', 'salt', '', 15],
127127
];
128-
if (!hasOpenSSL3)
128+
if (!hasOpenSSL3 && !process.features.openssl_is_boringssl)
129129
algorithms.push(['whirlpool', 'secret', '', 'info', 20]);
130130

131131
algorithms.forEach(([ hash, secret, salt, info, length ]) => {

test/parallel/test-process-features.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const expectedKeys = new Map([
99
['debug', ['boolean']],
1010
['uv', ['boolean']],
1111
['ipv6', ['boolean']],
12+
['openssl_is_boringssl', ['boolean']],
1213
['tls_alpn', ['boolean']],
1314
['tls_sni', ['boolean']],
1415
['tls_ocsp', ['boolean']],

test/parallel/test-tls-getprotocol.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ const clientConfigs = [
2929

3030
const serverConfig = {
3131
secureProtocol: 'TLS_method',
32-
ciphers: 'RSA@SECLEVEL=0',
3332
key: fixtures.readKey('agent2-key.pem'),
3433
cert: fixtures.readKey('agent2-cert.pem')
3534
};
3635

36+
if (!process.features.openssl_is_boringssl) {
37+
serverConfig.ciphers = 'RSA@SECLEVEL=0';
38+
}
39+
3740
const server = tls.createServer(serverConfig, common.mustCall(clientConfigs.length))
3841
.listen(0, common.localhostIPv4, function() {
3942
let connected = 0;

test/parallel/test-tls-write-error.js

Lines changed: 4 additions & 1 deletion

0 commit comments

Comments
 (0)