Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RsaPrivateKey::from_components fallible #167

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

tarcieri
Copy link
Member

Adds an error case in the event the number of primes provides is fewer than 2, which prevents panics when invoking methods which expect primes to always be present at indices 0 and 1 (i.e. p and q)

Fixes #163

Adds an error case in the event the number of `primes` provides is fewer
than 2, which prevents panics when invoking methods which expect primes
to always be present at indices 0 and 1 (i.e. `p` and `q`)

Fixes #163
Comment on lines +67 to +68
[profile.dev]
opt-level = 2
Copy link
Member Author

Choose a reason for hiding this comment

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

Threw this in there too. It significantly speeds up non-release tests.

@tarcieri
Copy link
Member Author

We could also add a check that the modulus is under some prescribed sanity limit (e.g. 16384 bits)

@Erik1000
Copy link

We could also add a check that the modulus is under some prescribed sanity limit (e.g. 16384 bits)

Yes, there should definitely be a sanity check. E.g. because of #166 since this would probably work with private keys too.

Copy link
Member

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

@dignifiedquire
Copy link
Member

We could also add a check that the modulus is under some prescribed sanity limit (e.g. 16384 bits)

Lets do that together with the compile time flags though, as that will be a (bigger) breaking change

@tarcieri tarcieri merged commit 4ccdcf9 into master Jul 25, 2022
@tarcieri tarcieri deleted the make-rsaprivatekey-from-components-fallible branch July 25, 2022 12:35
@tarcieri tarcieri mentioned this pull request Oct 10, 2022
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.

RsaPrivateKey::from_components might panic
3 participants