Skip to content

Conversation

@GarmashAlex
Copy link
Contributor

The guard in validate_private_key_parts used prime < 1 instead of prime <= 1, so it only caught zero but let prime == 1 slip through. A few lines below, NonZero::new(prime - 1).unwrap() panics on zero, exactly as the existing comment warns: "Any primes ≤ 1 will cause divide-by-zero panics later."

Copy link
Member

@tarcieri tarcieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sidebar: this should probably use a constant-time comparison, but this is a start

@tarcieri tarcieri merged commit ca31a4a into RustCrypto:master Feb 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants