Skip to content

Commit 2f4197f

Browse files
committed
review
1 parent cca2a21 commit 2f4197f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ext/node_crypto/primes.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ impl Prime {
2525
/// When `add` is set but `rem` is not:
2626
/// - If safe is false, rem defaults to 1
2727
/// - If safe is true, rem defaults to 3
28+
///
29+
/// This follows the same algorithm as OpenSSL's BN_generate_prime_ex():
30+
/// generate random candidates in [2^(n-1), 2^n), adjust to satisfy the
31+
/// add/rem constraint, then test with Miller-Rabin. For safe primes,
32+
/// also verify (p-1)/2 is prime.
2833
pub fn generate_with_options(
2934
n: usize,
3035
safe: bool,

tests/node_compat/config.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@
412412
"parallel/test-crypto-psychic-signatures.js": {},
413413
"parallel/test-crypto-randomfillsync-regression.js": {},
414414
"parallel/test-crypto-randomuuid.js": {},
415+
"parallel/test-crypto-prime.js": {},
415416
"parallel/test-crypto-rsa-pss-default-salt-length.js": {},
416417
"parallel/test-crypto-sec-level.js": {},
417418
"parallel/test-crypto-secret-keygen.js": {},

0 commit comments

Comments
 (0)