Skip to content

Commit

Permalink
test,crypto: make crypto tests work with BoringSSL
Browse files Browse the repository at this point in the history
PR-URL: #55491
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Filip Skokan <[email protected]>
  • Loading branch information
codebytere authored and ruyadorno committed Nov 27, 2024
1 parent a6b3ed5 commit cd0d748
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-crypto-dh-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-private-decrypt-gh32240.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const pkeyEncrypted =
pair.privateKey.export({
type: 'pkcs1',
format: 'pem',
cipher: 'aes128',
cipher: 'aes-128-cbc',
passphrase: 'secret',
});

Expand Down
9 changes: 2 additions & 7 deletions test/parallel/test-tls-getcertificate-x509.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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');
Expand Down

0 comments on commit cd0d748

Please sign in to comment.