Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
benchmark: reflect current OpenSSL in crypto key benchmarks
  • Loading branch information
panva committed Aug 13, 2025
commit d2de1dc9d671f41cc5cde352612f70846bf86831
8 changes: 6 additions & 2 deletions benchmark/crypto/create-keyobject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
const { hasOpenSSL } = require('../../test/common/crypto.js');
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
Expand All @@ -21,11 +22,14 @@ const keyFixtures = {
'ec': readKeyPair('ec_p256_public', 'ec_p256_private'),
'rsa': readKeyPair('rsa_public_2048', 'rsa_private_2048'),
'ed25519': readKeyPair('ed25519_public', 'ed25519_private'),
'ml-dsa-44': readKeyPair('ml_dsa_44_public', 'ml_dsa_44_private'),
};

if (hasOpenSSL(3, 5)) {
keyFixtures['ml-dsa-44'] = readKeyPair('ml_dsa_44_public', 'ml_dsa_44_private');
}

const bench = common.createBenchmark(main, {
keyType: ['rsa', 'ec', 'ed25519', 'ml-dsa-44'],
keyType: Object.keys(keyFixtures),
keyFormat: ['pkcs8', 'spki', 'der-pkcs8', 'der-spki', 'jwk-public', 'jwk-private'],
n: [1e3],
});
Expand Down
8 changes: 6 additions & 2 deletions benchmark/crypto/oneshot-sign.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
const { hasOpenSSL } = require('../../test/common/crypto.js');
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
Expand All @@ -14,16 +15,19 @@ const keyFixtures = {
'ec': readKey('ec_p256_private'),
'rsa': readKey('rsa_private_2048'),
'ed25519': readKey('ed25519_private'),
'ml-dsa-44': readKey('ml_dsa_44_private'),
};

if (hasOpenSSL(3, 5)) {
keyFixtures['ml-dsa-44'] = readKey('ml_dsa_44_private');
}

const data = crypto.randomBytes(256);

let pems;
let keyObjects;

const bench = common.createBenchmark(main, {
keyType: ['rsa', 'ec', 'ed25519', 'ml-dsa-44'],
keyType: Object.keys(keyFixtures),
mode: ['sync', 'async', 'async-parallel'],
keyFormat: ['pem', 'der', 'jwk', 'keyObject', 'keyObject.unique'],
n: [1e3],
Expand Down
8 changes: 6 additions & 2 deletions benchmark/crypto/oneshot-verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
const { hasOpenSSL } = require('../../test/common/crypto.js');
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
Expand All @@ -21,16 +22,19 @@ const keyFixtures = {
'ec': readKeyPair('ec_p256_public', 'ec_p256_private'),
'rsa': readKeyPair('rsa_public_2048', 'rsa_private_2048'),
'ed25519': readKeyPair('ed25519_public', 'ed25519_private'),
'ml-dsa-44': readKeyPair('ml_dsa_44_public', 'ml_dsa_44_private'),
};

if (hasOpenSSL(3, 5)) {
keyFixtures['ml-dsa-44'] = readKeyPair('ml_dsa_44_public', 'ml_dsa_44_private');
}

const data = crypto.randomBytes(256);

let pems;
let keyObjects;

const bench = common.createBenchmark(main, {
keyType: ['rsa', 'ec', 'ed25519', 'ml-dsa-44'],
keyType: Object.keys(keyFixtures),
mode: ['sync', 'async', 'async-parallel'],
keyFormat: ['pem', 'der', 'jwk', 'keyObject', 'keyObject.unique'],
n: [1e3],
Expand Down
Loading