-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.
Description
With today's master:
const assert = require('assert');
const crypto = require('crypto');
for (let bits = 3; bits <= 15; bits++) {
const p = crypto.createDiffieHellman(bits).getPrime();
assert.strictEqual(p.length, 2);
assert.strictEqual(p.readUInt16BE(0), 35963);
}I'd expect the test case to fail (it should find different primes) but it returns the same prime for sizes 3 to 15. It's only at bits >= 16 that it starts to find different primes.
I'm not sure if this is a Node.js or an openssl bug. log2(35963) > 15 though so it definitely seems wrong to return that prime (and only that prime) for bits <= 15.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.