From 0ea74f3d028708f7bae9137c9913d284366fa488 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 24 Oct 2024 15:37:15 +0200 Subject: [PATCH] test,crypto: make crypto tests work with BoringSSL PR-URL: https://github.com/nodejs/node/pull/55491 Reviewed-By: Richard Lau Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca Reviewed-By: Filip Skokan --- test/parallel/test-crypto-dh-errors.js | 4 ++-- test/parallel/test-crypto-private-decrypt-gh32240.js | 2 +- test/parallel/test-tls-getcertificate-x509.js | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-crypto-dh-errors.js b/test/parallel/test-crypto-dh-errors.js index fcf1922bcdba73..476ca64b4425b5 100644 --- a/test/parallel/test-crypto-dh-errors.js +++ b/test/parallel/test-crypto-dh-errors.js @@ -43,7 +43,7 @@ for (const g of [-1, 1]) { const ex = { code: 'ERR_OSSL_DH_BAD_GENERATOR', name: 'Error', - message: /bad generator/, + message: /(?:bad[_ ]generator)/i, }; assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex); assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex); @@ -55,7 +55,7 @@ for (const g of [Buffer.from([]), const ex = { code: 'ERR_OSSL_DH_BAD_GENERATOR', name: 'Error', - message: /bad generator/, + message: /(?:bad[_ ]generator)/i, }; assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex); assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex); diff --git a/test/parallel/test-crypto-private-decrypt-gh32240.js b/test/parallel/test-crypto-private-decrypt-gh32240.js index 1785f5eef3d202..e88227a215ba4f 100644 --- a/test/parallel/test-crypto-private-decrypt-gh32240.js +++ b/test/parallel/test-crypto-private-decrypt-gh32240.js @@ -24,7 +24,7 @@ const pkeyEncrypted = pair.privateKey.export({ type: 'pkcs1', format: 'pem', - cipher: 'aes128', + cipher: 'aes-128-cbc', passphrase: 'secret', }); diff --git a/test/parallel/test-tls-getcertificate-x509.js b/test/parallel/test-tls-getcertificate-x509.js index aa685ca9e09cf0..704aa33e6edfab 100644 --- a/test/parallel/test-tls-getcertificate-x509.js +++ b/test/parallel/test-tls-getcertificate-x509.js @@ -20,9 +20,7 @@ const server = tls.createServer(options, function(cleartext) { server.once('secureConnection', common.mustCall(function(socket) { const cert = socket.getX509Certificate(); assert(cert instanceof X509Certificate); - assert.strictEqual( - cert.serialNumber, - '5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE'); + assert.match(cert.serialNumber, /5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE/i); })); server.listen(0, common.mustCall(function() { @@ -33,10 +31,7 @@ server.listen(0, common.mustCall(function() { const peerCert = socket.getPeerX509Certificate(); assert(peerCert.issuerCertificate instanceof X509Certificate); assert.strictEqual(peerCert.issuerCertificate.issuerCertificate, undefined); - assert.strictEqual( - peerCert.issuerCertificate.serialNumber, - '147D36C1C2F74206DE9FAB5F2226D78ADB00A425' - ); + assert.match(peerCert.issuerCertificate.serialNumber, /147D36C1C2F74206DE9FAB5F2226D78ADB00A425/i); server.close(); })); socket.end('Hello');