From 534562f51d4bece7baa6a3767b129bb58a047abd Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 1 Feb 2023 19:51:39 +0000 Subject: [PATCH] test: make more crypto tests work with BoringSSL PR-URL: https://github.com/nodejs/node/pull/46429 Reviewed-By: Luigi Pinca Reviewed-By: Filip Skokan Reviewed-By: James M Snell --- test/parallel/test-tls-cert-chains-concat.js | 6 +++--- test/parallel/test-tls-cert-chains-in-ca.js | 6 +++--- test/parallel/test-tls-empty-sni-context.js | 2 +- test/parallel/test-tls-set-ciphers-error.js | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-cert-chains-concat.js b/test/parallel/test-tls-cert-chains-concat.js index 7802d8ecb49ddb..ffb29cf5aae2c7 100644 --- a/test/parallel/test-tls-cert-chains-concat.js +++ b/test/parallel/test-tls-cert-chains-concat.js @@ -25,7 +25,7 @@ connect({ assert.strictEqual(peer.subject.emailAddress, 'adam.lippai@tresorit.com'); assert.strictEqual(peer.subject.CN, 'Ádám Lippai'); assert.strictEqual(peer.issuer.CN, 'ca3'); - assert.strictEqual(peer.serialNumber, '5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE'); + assert.match(peer.serialNumber, /5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE/i); const next = pair.client.conn.getPeerCertificate(true).issuerCertificate; const root = next.issuerCertificate; @@ -33,12 +33,12 @@ connect({ debug('next:\n', next); assert.strictEqual(next.subject.CN, 'ca3'); assert.strictEqual(next.issuer.CN, 'ca1'); - assert.strictEqual(next.serialNumber, '147D36C1C2F74206DE9FAB5F2226D78ADB00A425'); + assert.match(next.serialNumber, /147D36C1C2F74206DE9FAB5F2226D78ADB00A425/i); debug('root:\n', root); assert.strictEqual(root.subject.CN, 'ca1'); assert.strictEqual(root.issuer.CN, 'ca1'); - assert.strictEqual(root.serialNumber, '4AB16C8DFD6A7D0D2DFCABDF9C4B0E92C6AD0229'); + assert.match(root.serialNumber, /4AB16C8DFD6A7D0D2DFCABDF9C4B0E92C6AD0229/i); // No client cert, so empty object returned. assert.deepStrictEqual(pair.server.conn.getPeerCertificate(), {}); diff --git a/test/parallel/test-tls-cert-chains-in-ca.js b/test/parallel/test-tls-cert-chains-in-ca.js index b38058c794739e..8b4cbac36c2902 100644 --- a/test/parallel/test-tls-cert-chains-in-ca.js +++ b/test/parallel/test-tls-cert-chains-in-ca.js @@ -30,16 +30,16 @@ connect({ const peer = pair.client.conn.getPeerCertificate(); debug('peer:\n', peer); - assert.strictEqual(peer.serialNumber, '5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE'); + assert.match(peer.serialNumber, /5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE/i); const next = pair.client.conn.getPeerCertificate(true).issuerCertificate; const root = next.issuerCertificate; delete next.issuerCertificate; debug('next:\n', next); - assert.strictEqual(next.serialNumber, '147D36C1C2F74206DE9FAB5F2226D78ADB00A425'); + assert.match(next.serialNumber, /147D36C1C2F74206DE9FAB5F2226D78ADB00A425/i); debug('root:\n', root); - assert.strictEqual(root.serialNumber, '4AB16C8DFD6A7D0D2DFCABDF9C4B0E92C6AD0229'); + assert.match(root.serialNumber, /4AB16C8DFD6A7D0D2DFCABDF9C4B0E92C6AD0229/i); return cleanup(); }); diff --git a/test/parallel/test-tls-empty-sni-context.js b/test/parallel/test-tls-empty-sni-context.js index cb76430f65330f..87219976a1ebda 100644 --- a/test/parallel/test-tls-empty-sni-context.js +++ b/test/parallel/test-tls-empty-sni-context.js @@ -16,7 +16,7 @@ const options = { const server = tls.createServer(options, (c) => { assert.fail('Should not be called'); }).on('tlsClientError', common.mustCall((err, c) => { - assert.match(err.message, /SSL_use_certificate:passed a null parameter/i); + assert.match(err.message, /passed a null parameter/i); server.close(); })).listen(0, common.mustCall(() => { const c = tls.connect({ diff --git a/test/parallel/test-tls-set-ciphers-error.js b/test/parallel/test-tls-set-ciphers-error.js index f963b414f44630..0df5a9288de1df 100644 --- a/test/parallel/test-tls-set-ciphers-error.js +++ b/test/parallel/test-tls-set-ciphers-error.js @@ -15,11 +15,11 @@ const fixtures = require('../common/fixtures'); ciphers: 'aes256-sha' }; assert.throws(() => tls.createServer(options, common.mustNotCall()), - /no cipher match/i); + /no[_ ]cipher[_ ]match/i); options.ciphers = 'FOOBARBAZ'; assert.throws(() => tls.createServer(options, common.mustNotCall()), - /no cipher match/i); + /no[_ ]cipher[_ ]match/i); options.ciphers = 'TLS_not_a_cipher'; assert.throws(() => tls.createServer(options, common.mustNotCall()), - /no cipher match/i); + /no[_ ]cipher[_ ]match/i); }