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

Add constant-time Uint::shr() and Uint::shl() #267

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Aug 25, 2023

This overrides the shr() implementation in #263 - this one is more efficient (O(LIMBS * log2(BITS)) instead of O(LIMBS^2)). For U2048 it's ~10x slower than the vartime equivalent.

Question for @tarcieri : what behavior do we want on overflow? shl()/shr() currently return 0, their vartime equivalents return the original value. I wonder if it would be better to return a pair (Self, CtChoice) where the second element indicates the overflow.

@fjarri fjarri force-pushed the ct-shifts branch 7 times, most recently from fe6f087 to 54e9f8f Compare August 28, 2023 06:07
@tarcieri tarcieri merged commit e0d71af into RustCrypto:master Aug 28, 2023
@fjarri fjarri deleted the ct-shifts branch August 28, 2023 20:25
@tarcieri tarcieri mentioned this pull request Sep 4, 2023
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