Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Jul 27, 2024

The previous mul_mod was variable-time with respect to the modulus. This adds a proper constant-time version.

It also changes the p argument to be NonZero<Self>

The previous `mul_mod` was variable-time with respect to the modulus.

This adds a proper constant-time version.
@andrewwhitehead
Copy link
Contributor

An updated version of mul_mod_vartime would not require an odd modulus, but I think requiring a NonZero modulus would make sense.


fn mul_mod(&self, rhs: &Self, p: &Self) -> Self {
self.mul_mod(rhs, p)
self.mul_mod_vartime(rhs, &NonZero::new(*p).expect("p should be non-zero"))
Copy link
Member Author

Choose a reason for hiding this comment

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

This should probably be mul_mod but I would need to add the extra bounds

@tarcieri tarcieri merged commit ff7f3a5 into master Jul 27, 2024
@tarcieri tarcieri deleted the uint/split-mul-mod-vs-mul-mod-vartime branch July 27, 2024 19:35
@tarcieri tarcieri mentioned this pull request Jan 22, 2025
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.

3 participants